public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { if (SunLight.current == null) { return; } CommandBuffer buffer = data.buffer; int pass; lightBlock.Clear(); if (SunLight.current.enableShadow) { PipelineFunctions.UpdateShadowMapState(ref SunLight.shadMap, lightBlock, ref SunLight.current.settings, buffer); PipelineFunctions.DrawShadow(cam.cam, data.resources.gpuFrustumCulling, buffer, ref data.baseBuffer, ref SunLight.current.settings, ref SunLight.shadMap, cascadeShadowMapVP, shadowFrustumVP); PipelineFunctions.UpdateShadowMaskState(lightBlock, ref SunLight.shadMap, cascadeShadowMapVP); pass = 0; } else { pass = 1; } lightBlock.SetVector(ShaderIDs._LightFinalColor, SunLight.shadMap.light.color * SunLight.shadMap.light.intensity); buffer.SetRenderTarget(cam.targets.renderTargetIdentifier, cam.targets.depthIdentifier); lightBlock.SetVector(ShaderIDs._LightPos, -SunLight.shadMap.shadCam.forward); buffer.DrawMesh(GraphicsUtility.mesh, Matrix4x4.identity, shadMaskMaterial, 0, pass, lightBlock); }