Last active
August 29, 2015 14:00
-
-
Save Neill3d/11232304 to your computer and use it in GitHub Desktop.
LightingPS.cg in the MoBu Dynamic Lighting shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To make the spot light works in correct way with normal maps assigned on meshes, you should change lines to these one | |
// And last but not least, figure out the spot factor ... | |
float spotFactor = 1.0f; | |
if( LightPositions[index].w ) | |
{ | |
float3 spotLightDir = normalize(LightDirections[index].xyz); | |
//spotLightDir = mul(fTangentMat, spotLightDir); | |
spotFactor = saturate( (dot( -normalize(lightDiff), -spotLightDir ) - LightDirections[index].w) / (1 - LightDirections[index].w) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment