pouët.net

Go to bottom

Point sprites shader distance bla bla issue size

category: general [glöplog]
Tiago: are you sure you've viewport-mapped the z-coordinate properly?
added on the 2009-01-26 14:55:37 by kusma kusma
Ah, it appears not. Divide homogen z by w, and you should be pretty much set.
added on the 2009-01-26 14:56:32 by kusma kusma
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.
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);
added on the 2009-01-26 15:52:50 by pommak pommak
Yes, that's what I mean :)
added on the 2009-01-26 16:02:10 by xernobyl xernobyl
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.
added on the 2009-01-26 16:51:08 by xernobyl xernobyl

login

Go to top