# Calculate specular

• 08-05-2009
Devils Child
Calculate specular
hi!

lets say i want to calculate specularity to do something like this:
http://plouj.com/projects/erlang-ray...aced-r27-1.png

i have:
• light vector
• surface normal
• camera look vector

i want:
specularity
all i get when trying to do this is something that doesn't look much like specular, but more like a paintball match. i'm not very good at vector maths, so i'm asking YOU ;)

anyone got an idea?
thanks :)
• 08-05-2009
VirtualAce
From the D3D SDK
Quote:

Specular Lighting = Cs * sum[Ls * (N • H)^P * Atten * Spot]

Cs = specular color
Ls = light specular color
N = vertex normal
H = halfway vector
P = reflection power
Atten = attenutation factor
Spot = spotlight attenuation factor
True specular - no halfway vector (Phong)

R = 2 * (N dot L) * N - L
I = Ai * Ac * Di * Dc * (N dot L) * Si * Sc * (R dot V)^n

Ai = ambient intensity
Ac = ambient color
Di = diffuse intensity
Dc= diffuse color
N = normal
L = Light direction
Si = specular intensity
Sc = specular color
R = reflection vector
V = view direction
n = specular power
• 08-06-2009
Devils Child
this should help. thanks :)
i'll come back if it doesn't work