Point sprites shader distance bla bla issue size
category: general [glöplog]
Tiago: are you sure you've viewport-mapped the z-coordinate properly?
Ah, it appears not. Divide homogen z by w, and you should be pretty much set.
What's gl_DepthCoord? Surely you don't mean gl_FragDepth?
This is how I updated depth of parallax textures with results that look ok, although I doubt they are mathematically correct.
This is how I updated depth of parallax textures with results that look ok, although I doubt they are mathematically correct.
Code:
vec3 p = pos;
p.z -= normalize(p).z*(1.0-bheight)/-e.y*200.0; // modify this line to adjust the depth
vec2 planes = vec2(-zfar/(zfar-znear), -zfar*znear/(zfar-znear));
gl_FragDepth = ((planes.x*p.z+planes.y)/-p.z);
Yes, that's what I mean :)
I've got it working now. The math is ok. Maybe it was just my debugging that was bugging, since I can't see any real values. I'm using a midi controller now to move sprites on the screen and tweak some shader parameters.