# [DirectX 10] Blinn-Phong lighting explanation

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

## Recommended Posts

Hi,
When I implemented lighting in my game engine, I used some code I found on the Internet without understanding it very well...

So now I want to make everything about the Blinn-Phong lighting clear:

This is my shader for calculating Parallel Light:
(The end of shader might seem strange because Im implementing Light Pre-Pass)
float4 ParallelLight(Surface v, Light L, float3 eyePos){	float3 litColor = float3(1.0f,1.0f,1.0f); 	float3 lightVec = -normalize(L.dir);		float NdL                = dot(v.normal, lightVec);	float3 reflectionVector  = normalize(reflect(-lightVec, v.normal));	float3 directionToCamera = normalize(eyePos - v.pos);	float specPower  = max(v.spec.a, 10.0f);	float specFactor = pow(saturate(dot(reflectionVector, directionToCamera)), specPower);		return float4(L.diffuse.x * NdL, L.diffuse.y * NdL, L.diffuse.z * NdL, specFactor * NdL);}

->N.L (N.L):
For what I've understood N.L = dot(pixel normal in world space(I guess), light direction vector

->N.H^n:
Ive seen this on many articles but I dont know if I calculate this, because I dont know what N.H^n is...

->Half vector (half vector between light vector and view vector):
Ive seen this in wikipedia but I don't understand the point of it...

->Etc...

So can anyone explain me this terms and others that might be important?

And it is a lot simpler, so do this shader give realistic results?

##### Share on other sites
That shader you've posted used Phong shading, not Blinn-Phong. Have a look through this, especially the section on Blinn-Phong.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013739
×