Hello Guest

Simple way to do point sprites - without points

  • 17 Replies
  • 13725 Views
Re: Simple way to do point sprites - without points
« Reply #15 on: May 19, 2013, 01:09:19 »
Yeah... though here's a final question (maybe final, who knows)

I can get data into the texCoord[n] variable by sending data into glMultiTexCoord2f(GL_TEXTUREn, ...) before sending the vertices. (I think.)

But is there anything else you need to do to enable multitexture? For now, I'm using a few pairs of texture coordinates against the same texture in my fragment shader.

EDIT:

Sigh. nevermind. I was not passing from gl_multitexcoord1 to gl_TexCoord[1] in the vertex shader. Once I crisp animations I'll put up some code to share whatever I've got, in case someone else wants some help on this topic.
« Last Edit: May 19, 2013, 01:31:14 by RiverC »

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: Simple way to do point sprites - without points
« Reply #16 on: May 19, 2013, 10:10:42 »
I for one would be quite interested to see how it turns out so...

Re: Simple way to do point sprites - without points
« Reply #17 on: May 20, 2013, 03:59:41 »
The clamping needs a little work, sometimes you're seeing angles on the composites that make for awkward visuals. Particularly, it seems that at the 45 degree pitch and 45 degree yaw position you see the top or bottom part. This is probably because the clamping for each dimension doesn't depend on the value of the other dimension (giving the space you see the 'top' a square shape rather than a round one like it should have.) i.e
Code: [Select]
float fudge_factor = .4;
int direction = 0;

if(n.x < -fudge_factor) {
   direction | back_bit;
} else if (n.x > fudge_factor) {
   direction | front_bit;
}

if(n.y < -fudge_factor) {
  direction | right_bit;
} else if (n.y > fudge_factor) {
  direction | left_bit;
}

if(n.z < -fudge_factor) {
  direction | bottom_bit;
} else if (n.z > fudge_factor) {
  direction | top_bit;
}

return direction;
This gives you any of 26 possible directions; Seems the eye expects the top images to show up later at 45-degree angles than this simple clamping gives me. Another possibility is I need another layer of angled images closer to the top view, which isn't my favored solution but might be the way to getting the sprites to have a production quality appearance from all directions.

Additionally, I've noticed when the sprites are at the edges of a perspective view, some skew needs to be applied to the quads or the parts look disjointed. I'll have to look into how to get the right amount of skew...