Skip to content

Instantly share code, notes, and snippets.

@Neill3d
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neill3d/11232304 to your computer and use it in GitHub Desktop.
Save Neill3d/11232304 to your computer and use it in GitHub Desktop.
LightingPS.cg in the MoBu Dynamic Lighting shader
// 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