Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

Normals, GLSL, FP/VP

This topic is 4910 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

I have per pixel lighting setup and running in a FP/VP using a DOT3 Bumpmap. So now I am moving to GLSL and my lighting is all messed up... I am not using the DOT3 bumpmap, I am as of now unsure what is wrong. #1. With GLSL do I still need to process my normals as I did before on the CPU? I am using a VBO to store my whole terrain data in. e.g. vertex, normals, texcoords. Or can the normals be done in GLSL? Which way is better? I am doing this in my VS.
/* first transform the normal into eye space and normalize the result */
	normal = normalize(gl_NormalMatrix * gl_Normal);


Any help would be greatly appreciated. Thanks

Share this post


Link to post
Share on other sites
Advertisement
you still need to supply your model normals, GLSL is just like the VP/FP in this regard.

and as long as your normals are unit length I'm 99% sure you shouldnt need to renormalise that equation either...

Share this post


Link to post
Share on other sites
Well isnt the normal matrix the upper left 3x3 matrix of the modelview inverse transpose? which SHOULD mean that its an orthonormal basis that contains only rotation.. right? So yes its magnitude should remain constant

hope that helps
-Dan

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
you still need to supply your model normals, GLSL is just like the VP/FP in this regard.

and as long as your normals are unit length I'm 99% sure you shouldnt need to renormalise that equation either...


Ok, so leave my code alone to upload my normals to OpenGL then. So all I should have to do is pass my normal through the vertex shader to the fragment shader then? And use the normal in the fragment shader?

Share this post


Link to post
Share on other sites
Quote:
Original post by Ademan555
Well isnt the normal matrix the upper left 3x3 matrix of the modelview inverse transpose? which SHOULD mean that its an orthonormal basis that contains only rotation.. right? So yes its magnitude should remain constant

hope that helps
-Dan


?? Lost me on what you're getting at? :)

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
Ok, so leave my code alone to upload my normals to OpenGL then. So all I should have to do is pass my normal through the vertex shader to the fragment shader then? And use the normal in the fragment shader?


Well, you'll want to transform it by the normal matrix, but then you can just pass it down as a varying and use it in the fragment shader, yes

Share this post


Link to post
Share on other sites
Ok, I think I am on to something working, I see my lighting changes when I move my camera around?? I didn't have this issue when I used a FP/VP??? Any ideas?

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
Ok, I think I am on to something working, I see my lighting changes when I move my camera around?? I didn't have this issue when I used a FP/VP??? Any ideas?


Hmmm, how can my lightposition be moving around when my camera is moving around shouldn't it stay still if I am not updating the glLightPosition???

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!