浏览代码

Adopt the convention that the 'depthOffsetVS' is always positive

/Branch_Batching2
Evgenii Golubev 8 年前
当前提交
841bef3d
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 6
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  2. 8
      Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl

6
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


}
// Since POM "pushes" geometry inwards (rather than extrude it), { height = height - 1 }.
return height * maxHeight - maxHeight;
// Since the result is used as a 'depthOffsetVS', it needs to be positive, so we flip the sign.
return maxHeight - height * maxHeight;
}
return 0.0;

}
// Since POM "pushes" geometry inwards (rather than extrude it), { height = height - 1 }.
return height * maxHeight - maxHeight;
// Since the result is used as a 'depthOffsetVS', it needs to be positive, so we flip the sign.
return maxHeight - height * maxHeight;
}
return 0.0;

8
Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl


return positionVS.xyz / positionVS.w;
}
// depthOffsetVS is always in the direction of the view vector (V)
// 'depthOffsetVS' is in the direction opposite to the view vector 'V', e.i. away from the camera.
posInput.depthVS -= depthOffsetVS;
// Just add the offset along the view vector is sufficient for world position
posInput.positionWS += V * depthOffsetVS;
posInput.depthVS += depthOffsetVS;
posInput.positionWS -= depthOffsetVS * V;
float4 positionCS = mul(viewProjMatrix, float4(posInput.positionWS, 1.0));
posInput.depthRaw = positionCS.z / positionCS.w;

正在加载...
取消
保存