浏览代码

HDRenderLoop: Miss one file

/main
sebastienlagarde 8 年前
当前提交
5d4ad793
共有 1 个文件被更改,包括 0 次插入7 次删除
  1. 7
      Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl

7
Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl


// For information. In Unity Depth is always in range 0..1 (even on OpenGL) but can be reversed.
float3 UnprojectToWorld(float depth, float2 screenPos, float4x4 invViewProjectionMatrix)
{
// CAUTION: The camera projection we get with Unity don't include the reverse stuff and the depth need to be remap manually to -1..1
// We should simplify the process and have a way to do Camera.Projection matrix that return the projection martix use to project depth.
#if UNITY_REVERSED_Z
depth = 1.0 - depth;
#endif
depth = depth * 2.0 - 1.0;
float4 positionHS = float4(screenPos.xy * 2.0 - 1.0, depth, 1.0);
float4 hpositionWS = mul(invViewProjectionMatrix, positionHS);

正在加载...
取消
保存