Thursday, March 24, 2011

Lighting: The specular effect and textures

  • I presented my computer graphics project today for grading and to my surprise, the teacher wasn't pleased with it. That upset me a lot to say the least, because I've put a great deal of effort and a great deal of myself on it, but turns out that he was right (as teachers regularly are).

  • The specular effect wasn't working as it should be, the reason is that when using textures, opengl multiplies the primitive's lighting color components with the texture color components if we use GL_MODULATE  which is my preferred mode regarding the texture environment. The solution : to add this line of code to your lighting setup

[sourcecode language="cpp"]

And that's it, the difference in lighting is dramatic:

[caption id="attachment_142" align="aligncenter" width="300" caption="proyectoGraficacion_v.0.3"][/caption]

There still some other minor details I need to take care of. It was a good idea to present my advances ahead of time.

Source for this post:

No comments:

Post a Comment