Пример #1
0
        private void Init()
        {
            if (m_Initialized)
            {
                return;
            }

            m_DepthOnlyPass                       = new DepthOnlyPass();
            m_MainLightShadowCasterPass           = new MainLightShadowCasterPass();
            m_AdditionalLightsShadowCasterPass    = new AdditionalLightsShadowCasterPass();
            m_SetupForwardRenderingPass           = new SetupForwardRenderingPass();
            m_ScreenSpaceShadowResolvePass        = new ScreenSpaceShadowResolvePass();
            m_CreateLightweightRenderTexturesPass = new CreateLightweightRenderTexturesPass();
            m_BeginXrRenderingPass                = new BeginXRRenderingPass();
            m_SetupLightweightConstants           = new SetupLightweightConstanstPass();
            m_RenderOpaqueForwardPass             = new RenderOpaqueForwardPass();
            m_CreatePostOpaqueColorPass           = new CreateColorRenderTexturesPass();
            m_OpaquePostProcessPass               = new PostProcessPass();
            m_DrawSkyboxPass                      = new DrawSkyboxPass();
            m_CopyDepthPass                       = new CopyDepthPass();
            m_CopyColorPass                       = new CopyColorPass();
            m_CreatePostTransparentColorPass      = new CreateColorRenderTexturesPass();
            m_RenderTransparentForwardPass        = new RenderTransparentForwardPass();
            m_PostProcessPass                     = new PostProcessPass();
            m_FinalBlitPass                       = new FinalBlitPass();
            m_CapturePass        = new CapturePass();
            m_EndXrRenderingPass = new EndXRRenderingPass();

#if UNITY_EDITOR
            m_SceneViewDepthCopyPass  = new SceneViewDepthCopyPass();
            m_LitGizmoRenderingPass   = new GizmoRenderingPass();
            m_UnlitGizmoRenderingPass = new GizmoRenderingPass();
#endif

            // RenderTexture format depends on camera and pipeline (HDR, non HDR, etc)
            // Samples (MSAA) depend on camera and pipeline
            m_ColorAttachment.Init("_CameraColorTexture");
            m_ColorAttachmentAfterOpaquePost.Init("_CameraColorTextureAfterOpaquePost");
            m_ColorAttachmentAfterTransparentPost.Init("_CameraColorTextureAfterTransparentPost");
            m_DepthAttachment.Init("_CameraDepthAttachment");
            m_DepthTexture.Init("_CameraDepthTexture");
            m_OpaqueColor.Init("_CameraOpaqueTexture");
            m_MainLightShadowmap.Init("_MainLightShadowmapTexture");
            m_AdditionalLightsShadowmap.Init("_AdditionalLightsShadowmapTexture");
            m_ScreenSpaceShadowmap.Init("_ScreenSpaceShadowmapTexture");

            m_Initialized = true;
        }
        public ForwardRendererSetup(ForwardRendererData data)
        {
            Material blitMaterial               = CoreUtils.CreateEngineMaterial(data.blitShader);
            Material copyDepthMaterial          = CoreUtils.CreateEngineMaterial(data.copyDepthShader);
            Material samplingMaterial           = CoreUtils.CreateEngineMaterial(data.samplingShader);
            Material screenspaceShadowsMaterial = CoreUtils.CreateEngineMaterial(data.screenSpaceShadowShader);

            m_DepthOnlyPass                       = new DepthOnlyPass();
            m_MainLightShadowCasterPass           = new MainLightShadowCasterPass();
            m_AdditionalLightsShadowCasterPass    = new AdditionalLightsShadowCasterPass();
            m_SetupForwardRenderingPass           = new SetupForwardRenderingPass();
            m_ScreenSpaceShadowResolvePass        = new ScreenSpaceShadowResolvePass(screenspaceShadowsMaterial);
            m_CreateLightweightRenderTexturesPass = new CreateLightweightRenderTexturesPass();
            m_BeginXrRenderingPass                = new BeginXRRenderingPass();
            m_SetupLightweightConstants           = new SetupLightweightConstanstPass();
            m_RenderOpaqueForwardPass             = new RenderOpaqueForwardPass();
            m_OpaquePostProcessPass               = new PostProcessPass();
            m_DrawSkyboxPass                      = new DrawSkyboxPass();
            m_CopyDepthPass                       = new CopyDepthPass(copyDepthMaterial);
            m_CopyColorPass                       = new CopyColorPass(samplingMaterial);
            m_RenderTransparentForwardPass        = new RenderTransparentForwardPass();
            m_PostProcessPass                     = new PostProcessPass();
            m_FinalBlitPass                       = new FinalBlitPass(blitMaterial);
            m_CapturePass        = new CapturePass();
            m_EndXrRenderingPass = new EndXRRenderingPass();

#if UNITY_EDITOR
            m_SceneViewDepthCopyPass  = new SceneViewDepthCopyPass(copyDepthMaterial);
            m_LitGizmoRenderingPass   = new GizmoRenderingPass();
            m_UnlitGizmoRenderingPass = new GizmoRenderingPass();
#endif

            // RenderTexture format depends on camera and pipeline (HDR, non HDR, etc)
            // Samples (MSAA) depend on camera and pipeline
            m_ColorAttachment.Init("_CameraColorTexture");
            m_ColorAttachmentAfterOpaquePost.Init("_CameraColorTextureAfterOpaquePost");
            m_ColorAttachmentAfterTransparentPost.Init("_CameraColorTextureAfterTransparentPost");
            m_DepthAttachment.Init("_CameraDepthAttachment");
            m_DepthTexture.Init("_CameraDepthTexture");
            m_OpaqueColor.Init("_CameraOpaqueTexture");
            m_MainLightShadowmap.Init("_MainLightShadowmapTexture");
            m_AdditionalLightsShadowmap.Init("_AdditionalLightsShadowmapTexture");
            m_ScreenSpaceShadowmap.Init("_ScreenSpaceShadowmapTexture");
        }