#### Archived

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

# Question about computing specular lighting

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

## 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 on other sites
Yes, V is the camera direction. So, just use the coordinates of the eye point for V.

##### Share on other sites
No, if l is the (normalised) vector from point to light, then v should be the normalised vector from point to camera position.

Cameron

##### 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 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 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.

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633345
• Total Posts
3011441
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!