Archived

This topic is now archived and is closed to further replies.

Question about computing specular lighting

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

The commonly used equation for computing specular lighting is like this: specular color = (n.h)^shininess x specular color where h = normalize(l + v). Actually I wonder whether v is the camera direction or the vector from the camera position to the vertex.

Share this post


Link to post
Share on other sites
Maybe off topic!
the object has it''s color, if a green light hit a red ball, so we cannot see it.

In Opengl, a white light hit a red ball. So we''ll see it red.
But when add specular term, u can see a white spot on the red ball.

How i do that?
or do i miss something?

Share this post


Link to post
Share on other sites
If you use specular then you will get that white spot, not just a brighter red that you get using diffuse/ambient. If you''re texturing then you won''t see that white spot because it''s modulated with the texels. There''s an extension that allows drawing the specular after texturing, restoring that white spot to your mesh.

------------
- outRider -

Share this post


Link to post
Share on other sites
quote:

In Opengl, a white light hit a red ball. So we''ll see it red.
But when add specular term, u can see a white spot on the red ball.

How i do that?
or do i miss something?


Diffuse light is multiplicative: red_ball * white_diffuse_light = red. Or: red_ball * blue_diffuse_light = black.

Specular light is additive: red_ball + white_specular_light = white. Or red_ball + blue_specular_light = yellow.

Share this post


Link to post
Share on other sites