浏览代码

Optimize GetViewReflectedNormal() a bit

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
fb07d38f
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 8
      ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl

8
ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl


NdotV = dot(N, V);
float NdotV1 = abs(NdotV);
float3 N1 = N - 2 * NdotV * V;
bool front = NdotV >= 0;
N = (NdotV >= 0) ? N : (N - 2 * NdotV * V);
NdotV = abs(NdotV);
NdotV = front ? NdotV : NdotV1;
return front ? N : N1;
return N;
}
// Generates an orthonormal right-handed basis from a unit vector.

正在加载...
取消
保存