浏览代码

Clearing a 3D texture doesn't seem to work

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
decbf974
共有 2 个文件被更改,包括 10 次插入10 次删除
  1. 7
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/VolumeRendering.hlsl
  2. 13
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.cs

7
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/VolumeRendering.hlsl


real x = 1 - exp(-extinction * intervalLength);
weight = x * rcp(extinction);
offset = -log(1 - rndVal * x) * rcp(extinction);
// Avoid division by 0.
real rcpExt = extinction != 0 ? rcp(extinction) : 0;
weight = x * rcpExt;
offset = -log(1 - rndVal * x) * rcpExt;
}
// Implements equiangular light sampling.

13
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.cs


m_VBufferLighting[i].Create();
m_VBufferLightingRT[i] = new RenderTargetIdentifier(m_VBufferLighting[i]);
// No clean way to clear a RenderTexture without a CommandBuffer? Ridiculous.
RenderTexture saveRT = UnityEngine.RenderTexture.active;
RenderTexture.active = m_VBufferLighting[i];
GL.Clear(false, true, CoreUtils.clearColorAllBlack);
RenderTexture.active = saveRT;
}
}

if (GetGlobalFogComponent() == null)
{
// Clear the render target instead of running the shader.
CoreUtils.SetRenderTarget(cmd, GetVBufferLightingHistory(viewOffset), ClearFlag.Color, CoreUtils.clearColorAllBlack);
return;
// CoreUtils.SetRenderTarget(cmd, GetVBufferLightingIntegral(viewOffset), ClearFlag.Color, CoreUtils.clearColorAllBlack);
// return;
// Clearing 3D textures does not seem to work!
// Use the workaround by running the full shader with no volume.
}
bool enableClustered = m_FrameSettings.lightLoopSettings.enableTileAndCluster;

正在加载...
取消
保存