@@ -65,8 +65,7 @@ public override void Render(ScriptableRenderContext context, Camera[] cameras)
6565 // Setup light and shadow shader constants
6666 SetupLightShaderVariables ( cull . visibleLights , context ) ;
6767 if ( shadowsRendered )
68- SetupShadowShaderVariables ( context , camera . nearClipPlane , cullingParameters . shadowDistance ,
69- m_ShadowSettings . directionalLightCascadeCount ) ;
68+ SetupShadowShaderVariables ( context , m_ShadowSettings . directionalLightCascadeCount ) ;
7069
7170 // Render Opaques
7271 var settings = new DrawRendererSettings ( cull , camera , m_ForwardBasePassName ) ;
@@ -315,22 +314,10 @@ private int GetMaxTileResolutionInAtlas(int atlasWidth, int atlasHeight, int til
315314 return resolution ;
316315 }
317316
318- void SetupShadowShaderVariables ( ScriptableRenderContext context , float shadowNear , float shadowFar ,
319- int cascadeCount )
317+ void SetupShadowShaderVariables ( ScriptableRenderContext context , int cascadeCount )
320318 {
321319 float shadowResolution = m_ShadowSlices [ 0 ] . shadowResolution ;
322320
323- // PSSM distance settings
324- float shadowFrustumDepth = shadowFar - shadowNear ;
325- Vector3 shadowSplitRatio = m_ShadowSettings . directionalLightCascades ;
326-
327- // We set PSSMDistance to infinity for non active cascades so the comparison test always fails for unavailable cascades
328- Vector4 PSSMDistances = new Vector4 (
329- shadowNear + shadowSplitRatio . x * shadowFrustumDepth ,
330- ( shadowSplitRatio . y > 0.0f ) ? shadowNear + shadowSplitRatio . y * shadowFrustumDepth : Mathf . Infinity ,
331- ( shadowSplitRatio . z > 0.0f ) ? shadowNear + shadowSplitRatio . z * shadowFrustumDepth : Mathf . Infinity ,
332- 1.0f / shadowResolution ) ;
333-
334321 const int maxShadowCascades = 4 ;
335322 Matrix4x4 [ ] shadowMatrices = new Matrix4x4 [ maxShadowCascades ] ;
336323 for ( int i = 0 ; i < cascadeCount ; ++ i )
@@ -349,8 +336,7 @@ void SetupShadowShaderVariables(ScriptableRenderContext context, float shadowNea
349336 var setupShadow = new CommandBuffer ( ) { name = "SetupShadowShaderConstants" } ;
350337 SetShadowKeywords ( setupShadow ) ;
351338 setupShadow . SetGlobalMatrixArray ( "_WorldToShadow" , shadowMatrices ) ;
352- setupShadow . SetGlobalVector ( "_PSSMDistancesAndShadowResolution" , PSSMDistances ) ;
353- setupShadow . SetGlobalVectorArray ( "g_vDirShadowSplitSpheres" , m_DirectionalShadowSplitDistances ) ;
339+ setupShadow . SetGlobalVectorArray ( "_DirShadowSplitSpheres" , m_DirectionalShadowSplitDistances ) ;
354340 setupShadow . SetGlobalFloatArray ( "_PCFKernel" , pcfKernel ) ;
355341 SetShadowKeywords ( setupShadow ) ;
356342 context . ExecuteCommandBuffer ( setupShadow ) ;
0 commit comments