Jump to content
  • Advertisement
Sign in to follow this  

Shadow Map (something small)(SOLVED)

This topic is 3793 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

*Well it seems that using texParamter(...,..,compare r to texture) works. I was doing the lookup and then comparing that with my current fragement (z/w) and for some reason that didnt work. Maybe a precision error? You can see that my problem is a function on the z coordinate with respect to the light. Those 3 things are trees. The reason I dont use the inverse of the View matrix, is because im using the original gl_Vertex (i.e. the trees have no model transform).
GL Application
//Shader and matrices

varying vec4 TexPos;

uniform mat4 shadowM;
void main(void)
	TexPos = gl_TextureMatrix[0]*gl_Vertex;
	gl_Position = ftransform();

varying vec4 TexPos;

uniform sampler2DShadow tex1;
void main(void)
	float shadow1 = shadow2DProj(tex1, (TexPos));

	if((TexPos.z) < shadow1)

		gl_FragColor = vec4(0,0,1,1);
	        //in shadow
		gl_FragColor = vec4(.5,.5,.5,1);

[Edited by - dpadam450 on May 29, 2008 7:48:10 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!