浏览代码

Implement a workaround for the case when disabling a keyword has no effect

I am referring to PERFORM_SKY_OCCLUSION_TEST.
/main
Evgenii Golubev 8 年前
当前提交
6da9eb72
共有 2 个文件被更改,包括 14 次插入0 次删除
  1. 6
      Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs
  2. 8
      Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader

6
Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs


if (builtinParams.depthBuffer != BuiltinSkyParameters.invalidRTI)
{
cmd.SetGlobalTexture("_CameraDepthTexture", builtinParams.depthBuffer);
cmd.SetGlobalFloat("_DisableSkyOcclusionTest", 0.0f);
}
else
{
// For some reason, disabling the 'PERFORM_SKY_OCCLUSION_TEST' keyword has no effect.
cmd.SetGlobalFloat("_DisableSkyOcclusionTest", 1.0f);
}
cmd.DrawMesh(builtinParams.skyMesh, Matrix4x4.identity, m_ProceduralSkyMaterial);
builtinParams.renderContext.ExecuteCommandBuffer(cmd);

8
Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader


float4x4 _InvViewProjMatrix;
float4x4 _ViewProjMatrix;
float _DisableSkyOcclusionTest;
#define IS_RENDERING_SKY
#include "AtmosphericScattering.hlsl"

float depthRaw = skyDepth;
float skyTexWeight = 1.0;
#endif
if (_DisableSkyOcclusionTest != 0.0)
{
depthRaw = skyDepth;
skyTexWeight = 1.0;
}
UpdatePositionInput(depthRaw, _InvViewProjMatrix, _ViewProjMatrix, posInput);

正在加载...
取消
保存