浏览代码

Add ortho projection support to GetWorldSpaceNormalizeViewDir()

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
fedcbf38
共有 1 个文件被更改,包括 16 次插入15 次删除
  1. 31
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl

31
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl


#endif
}
// Computes the world space view direction (pointing towards the camera).
float3 GetWorldSpaceNormalizeViewDir(float3 positionWS)
{
float3 V = GetCurrentCameraPosition() - positionWS;
// Uncomment this once the compiler bug is fixed.
// if (unity_OrthoParams.w == 1.0)
// {
// float4x4 M = GetWorldToViewMatrix();
// V = M[1].xyz;
// }
return normalize(V);
}
}
// Computes the world space view direction (pointing towards the camera).
float3 GetWorldSpaceNormalizeViewDir(float3 positionWS)
{
if (unity_OrthoParams.w == 0)
{
// Perspective
float3 V = GetCurrentCameraPosition() - positionWS;
return normalize(V);
}
else
{
// Orthographic
return -GetCameraForwardDir();
}
}
float3x3 CreateWorldToTangent(float3 normal, float3 tangent, float flipSign)

正在加载...
取消
保存