浏览代码

Replaced the two clear shadow passes with one using the platform far plane define.

/main
uygar 7 年前
当前提交
7528e3f3
共有 2 个文件被更改,包括 4 次插入26 次删除
  1. 28
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/Resources/ShadowClear.shader
  2. 2
      ScriptableRenderPipeline/Core/CoreRP/Shadow/Shadow.cs

28
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/Resources/ShadowClear.shader


#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "CoreRP/ShaderLibrary/Common.hlsl"
float4 Frag() : SV_Target { return 0.0.xxxx; }
ENDHLSL
SubShader

Name "ClearShadow_0"
Name "ClearShadow"
ZTest Always
Cull Off
ZWrite On

float4 Vert_0( uint vertexID : VERTEXID_SEMANTIC ) : SV_POSITION
{
return GetFullScreenTriangleVertexPosition( vertexID, 0.0 );
return GetFullScreenTriangleVertexPosition( vertexID, UNITY_RAW_FAR_CLIP_VALUE );
ENDHLSL
}
Pass
{
Name "ClearShadow_1"
ZTest Always
Cull Off
ZWrite On
float4 Frag() : SV_Target{ return 0.0.xxxx; }
HLSLPROGRAM
#pragma vertex Vert_1
#pragma fragment Frag
float4 Vert_1( uint vertexID : VERTEXID_SEMANTIC ) : SV_POSITION
{
return GetFullScreenTriangleVertexPosition( vertexID, 1.0 );
}
}
Fallback Off
}

2
ScriptableRenderPipeline/Core/CoreRP/Shadow/Shadow.cs


cmd.SetViewport( m_EntryCache[i].current.viewport );
cbName = "Shadowmap.ClearRect";
cmd.BeginSample( cbName );
CoreUtils.DrawFullScreen( cmd, m_ClearMat, null, SystemInfo.usesReversedZBuffer ? 0 : 1 );
CoreUtils.DrawFullScreen( cmd, m_ClearMat, null, 0 );
cmd.EndSample( cbName );
cmd.SetViewProjectionMatrices( m_EntryCache[i].current.view, m_EntryCache[i].current.proj );
cmd.SetGlobalVector( "g_vLightDirWs", m_EntryCache[i].current.lightDir );

正在加载...
取消
保存