Use abs instead of saturate to do double-sided lighting on meshes

* This means we don't need to care about winding making normals inside
  out, and in this case it's not a bad thing to light backfaces I think.
This commit is contained in:
baldurk
2015-01-26 13:24:24 +00:00
parent 41be32a5cd
commit 5c46ccb86d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ void main(void)
{
vec3 lightDir = normalize(vec3(0, -0.3f, -1));
color_out = vec4(RENDERDOC_GenericFS_Color.xyz*clamp(dot(lightDir, IN.norm.xyz), 0.0f, 1.0f), 1);
color_out = vec4(RENDERDOC_GenericFS_Color.xyz*abs(dot(lightDir, IN.norm.xyz)), 1);
}
else //if(type == MESHDISPLAY_SOLID)
{
+1 -1
View File
@@ -253,7 +253,7 @@ float4 RENDERDOC_MeshPS(wireframeV2F IN) : SV_Target0
{
float3 lightDir = normalize(float3(0, -0.3f, -1));
return float4(WireframeColour.xyz*saturate(dot(lightDir, IN.norm)), 1);
return float4(WireframeColour.xyz*abs(dot(lightDir, IN.norm)), 1);
}
else //if(type == MESHDISPLAY_SOLID)
return float4(WireframeColour.xyz, 1);