Jump to content
Posted 13 November 2012 - 05:02 AM
Posted 13 November 2012 - 02:25 PM
Edited by kauna, 13 November 2012 - 02:30 PM.
Posted 13 November 2012 - 04:03 PM
float3 directionToLight = normalize(lightPosition - In.WorldPosition) float3 norm = normalize(In.WorldNormal); float nDotL = saturate(dot(directionToLight, norm)); // Calculate the half angle: the half the angle between our light direction and camera view // Note: CameraView should be equal to (cameraPosition - worldPosition) float3 halfAngle = normalize(normalize(in.CameraView) + directionToLight); //Get Specular component specular = pow(saturate(dot(norm, halfAngle)), specularPower) * specularLightColor * specularIntensity * nDotL;
Edited by MJP, 13 November 2012 - 04:04 PM.
Posted 14 November 2012 - 12:16 PM