PDA

View Full Version : Shading problem



jbrehm
04-29-2003, 03:19 PM
I have and interesting problem I hope someone can help me out with. I am rendering a river scene with animated water. The problem is that when I move the water along in the river, the lighting on the water seems to stay in the same place as it was when the scene started out. Does anybody know what might be going on?

Humus
04-29-2003, 06:27 PM
Dunno, maybe forgot to animate the normals?

knackered
04-30-2003, 12:07 AM
Right, let's play 20 questions...
Are you using standard opengl lighting? (not any fancy per-pixel stuff? no per-pixel reflections? basically, nothing advanced?
If the answer is yes, then go to the beginners forum and post your question there. http://www.opengl.org/discussion_boards/...e=20&LastLogin= (http://www.opengl.org/discussion_boards/cgi_directory/forumdisplay.cgi?action=topics&forum=OpenGL+coding:+beginners&number=2&DaysPrune=20&LastLogin=)

dorbie
04-30-2003, 07:45 AM
You need to position your light at the correct time in relation to your modelview matrix operations.

If the light is in the 'world' then you need to position it with the glLight call right after you move the eye (inverse viewing on the modelview stack).

If the light is following the water then it is likely that you position the light after you apply the matrix to position the water, or you are making a similar mistake.