NormalsRenderingShared.hlsl 506 B

123456789101112131415161718
  1. #if !defined(NORMALS_RENDERING_PASS)
  2. #define NORMALS_RENDERING_PASS
  3. float4 NormalsRenderingShared(float4 color, float3 normalTS, float3 tangent, float3 bitangent, float3 normal)
  4. {
  5. float4 normalColor;
  6. float3 normalWS = TransformTangentToWorld(normalTS, float3x3(tangent.xyz, bitangent.xyz, normal.xyz));
  7. float3 normalVS = TransformWorldToViewDir(normalWS);
  8. normalColor.rgb = 0.5 * ((normalVS)+1);
  9. normalColor.a = color.a; // used for blending
  10. return normalColor;
  11. }
  12. #endif