浏览代码

Fix case 1046713 - Planar reflection are black when viewing in the direction of the normal of the mirror for infinite projections.

/main
Frédéric Vauchelles 6 年前
当前提交
3b4360d3
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  2. 10
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoopDef.hlsl

4
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


out worldToCamera, out projection, out capturePosition, out captureRotation,
camera);
var gpuProj = GL.GetGPUProjectionMatrix(projection, true); // Had to change this from 'false'
var vp = gpuProj * gpuView * Matrix4x4.Translate(capturePosition);
// Provide non device dependent projection matrix (clip space range is [-1..1]^3)
var vp = projection * gpuView * Matrix4x4.Translate(capturePosition);
m_Env2DCaptureVP[fetchIndex] = vp;
}
else if (probe.reflectionProbe != null)

10
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoopDef.hlsl


{
if (cacheType == ENVCACHETYPE_TEXTURE2D)
{
//_Env2DCaptureVP is in capture space
float3 ndc = ComputeNormalizedDeviceCoordinatesWithZ(texCoord, _Env2DCaptureVP[index]);
// _Env2DCaptureVP transform from this camera view space to capture camera clip space.
// And it uses a non device dependent projection matrix (clip space range is [-1..1]^3)
float4 positionCS = mul(_Env2DCaptureVP[index], float4(texCoord, 1.0));
float3 ndc = (positionCS.xyz * rcp(positionCS.w)) * 0.5 + 0.5;
color.a = any(ndc.xyz < 0) || any(ndc.xyz > 1) ? 0.0 : 1.0;
// Clip against oblique near clip plane and side clip planes.
// Don't clip against far clip plane to handle properly infinite projection.
color.a = any(ndc.xyz < 0) || any(ndc.xy > 1) ? 0.0 : 1.0;
}
else if (cacheType == ENVCACHETYPE_CUBEMAP)
{

正在加载...
取消
保存