public ShadowManager(CustomRenderPipelineAsset asset)
        {
            m_Asset = asset;
            m_ScreenSpaceShadowsMaterial = CoreUtils.CreateEngineMaterial(m_Asset.ScreenSpaceShadowShader);

            BuildShadowSettings();

            ShadowConstantBuffer._WorldToShadow             = Shader.PropertyToID("_WorldToShadow");
            ShadowConstantBuffer._ShadowData                = Shader.PropertyToID("_ShadowData");
            ShadowConstantBuffer._DirShadowSplitSpheres     = Shader.PropertyToID("_DirShadowSplitSpheres");
            ShadowConstantBuffer._DirShadowSplitSphereRadii = Shader.PropertyToID("_DirShadowSplitSphereRadii");
            ShadowConstantBuffer._ShadowOffset0             = Shader.PropertyToID("_ShadowOffset0");
            ShadowConstantBuffer._ShadowOffset1             = Shader.PropertyToID("_ShadowOffset1");
            ShadowConstantBuffer._ShadowOffset2             = Shader.PropertyToID("_ShadowOffset2");
            ShadowConstantBuffer._ShadowOffset3             = Shader.PropertyToID("_ShadowOffset3");
            ShadowConstantBuffer._ShadowmapSize             = Shader.PropertyToID("_ShadowmapSize");

            m_ShadowMapRTID            = Shader.PropertyToID("_ShadowMap");
            m_ScreenSpaceShadowMapRTID = Shader.PropertyToID("_ScreenSpaceShadowMap");

            m_ScreenSpaceShadowMapRT = new RenderTargetIdentifier(m_ScreenSpaceShadowMapRTID);

            for (int i = 0; i < kMaxCascades; ++i)
            {
                m_DirectionalShadowSplitDistances[i] = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
            }
            m_DirectionalShadowSplitRadii = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
        }
        public TextureUtil(CustomRenderPipelineAsset asset)
        {
            m_Asset = asset;

            m_CopyTextureSupport       = SystemInfo.copyTextureSupport;
            m_BlitQuad                 = LightweightUtils.CreateQuadMesh(false);
            m_BlitMaterial             = CoreUtils.CreateEngineMaterial(asset.BlitShader);
            m_CopyDepthMaterial        = CoreUtils.CreateEngineMaterial(asset.CopyDepthShader);
            m_PostProcessRenderContext = new PostProcessRenderContext();
        }
        public CustomRenderPipeline(CustomRenderPipelineAsset asset)
        {
            m_Asset = asset;

            SceneViewUtil.SetRenderingFeatures();

            PerFrameBuffer._GlossyEnvironmentColor = Shader.PropertyToID("_GlossyEnvironmentColor");
            PerFrameBuffer._SubtractiveShadowColor = Shader.PropertyToID("_SubtractiveShadowColor");

            // Lights are culled per-camera. Therefore we need to reset light buffers on each camera render
            PerCameraBuffer._MainLightPosition            = Shader.PropertyToID("_MainLightPosition");
            PerCameraBuffer._MainLightColor               = Shader.PropertyToID("_MainLightColor");
            PerCameraBuffer._MainLightDistanceAttenuation = Shader.PropertyToID("_MainLightDistanceAttenuation");
            PerCameraBuffer._MainLightSpotDir             = Shader.PropertyToID("_MainLightSpotDir");
            PerCameraBuffer._MainLightSpotAttenuation     = Shader.PropertyToID("_MainLightSpotAttenuation");
            PerCameraBuffer._MainLightCookie              = Shader.PropertyToID("_MainLightCookie");
            PerCameraBuffer._WorldToLight                       = Shader.PropertyToID("_WorldToLight");
            PerCameraBuffer._AdditionalLightCount               = Shader.PropertyToID("_AdditionalLightCount");
            PerCameraBuffer._AdditionalLightPosition            = Shader.PropertyToID("_AdditionalLightPosition");
            PerCameraBuffer._AdditionalLightColor               = Shader.PropertyToID("_AdditionalLightColor");
            PerCameraBuffer._AdditionalLightDistanceAttenuation = Shader.PropertyToID("_AdditionalLightDistanceAttenuation");
            PerCameraBuffer._AdditionalLightSpotDir             = Shader.PropertyToID("_AdditionalLightSpotDir");
            PerCameraBuffer._AdditionalLightSpotAttenuation     = Shader.PropertyToID("_AdditionalLightSpotAttenuation");

            CameraRenderTargetID.color     = Shader.PropertyToID("_CameraColorRT");
            CameraRenderTargetID.copyColor = Shader.PropertyToID("_CameraCopyColorRT");
            CameraRenderTargetID.depth     = Shader.PropertyToID("_CameraDepthTexture");
            CameraRenderTargetID.depthCopy = Shader.PropertyToID("_CameraCopyDepthTexture");

            m_ColorRT     = new RenderTargetIdentifier(CameraRenderTargetID.color);
            m_CopyColorRT = new RenderTargetIdentifier(CameraRenderTargetID.copyColor);
            m_DepthRT     = new RenderTargetIdentifier(CameraRenderTargetID.depth);
            m_CopyDepth   = new RenderTargetIdentifier(CameraRenderTargetID.depthCopy);

            // Let engine know we have MSAA on for cases where we support MSAA backbuffer
            if (QualitySettings.antiAliasing != m_Asset.MSAASampleCount)
            {
                QualitySettings.antiAliasing = m_Asset.MSAASampleCount;
            }

            Shader.globalRenderPipeline = "LightweightPipeline";

            m_ErrorMaterial = CoreUtils.CreateEngineMaterial("Hidden/InternalErrorShader");

            m_LightManager  = new LightManager(asset);
            m_ShadowManager = new ShadowManager(asset);
            m_TextureUtil   = new TextureUtil(asset);
            m_CullingUtil   = new CullingUtil();
        }
 public LightManager(CustomRenderPipelineAsset asset)
 {
     m_Asset = asset;
 }