Пример #1
0
        public Renderer2D(Renderer2DData data) : base(data)
        {
            m_BlitMaterial = CoreUtils.CreateEngineMaterial(data.blitShader);

            m_ColorGradingLutPass  = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, data.postProcessData);
            m_Render2DLightingPass = new Render2DLightingPass(data);
            m_PostProcessPass      = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalBlitPass        = new FinalBlitPass(RenderPassEvent.AfterRendering + 1, m_BlitMaterial);

#if POST_PROCESSING_STACK_2_0_0_OR_NEWER
            m_PostProcessPassCompat = new PostProcessPassCompat(RenderPassEvent.BeforeRenderingPostProcessing);
#endif

            m_UseDepthStencilBuffer = data.useDepthStencilBuffer;

            // We probably should declare these names in the base class,
            // as they must be the same across all ScriptableRenderer types for camera stacking to work.
            k_ColorTextureHandle.Init("_CameraColorTexture");
            k_DepthTextureHandle.Init("_CameraDepthAttachment");
            k_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture");
            k_ColorGradingLutHandle.Init("_InternalGradingLut");

            m_Renderer2DData = data;

            supportedRenderingFeatures = new RenderingFeatures()
            {
                cameraStacking = true,
            };
        }
Пример #2
0
        public Renderer2D(Renderer2DData data) : base(data)
        {
            m_ColorGradingLutPass  = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, data.postProcessData);
            m_Render2DLightingPass = new Render2DLightingPass(data);
            m_PostProcessPass      = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, data.postProcessData);
            m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, data.postProcessData);
            m_FinalBlitPass        = new FinalBlitPass(RenderPassEvent.AfterRendering, CoreUtils.CreateEngineMaterial(data.blitShader));

            m_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture");
            m_ColorGradingLutHandle.Init("_InternalGradingLut");
        }
Пример #3
0
        public Renderer2D(Renderer2DData data) : base(data)
        {
            //创建pass需要的mat
            m_BlitMaterial      = CoreUtils.CreateEngineMaterial(data.blitShader);
            m_CopyDepthMaterial = CoreUtils.CreateEngineMaterial(data.URPShaders.copyDepthPS);
            m_SamplingMaterial  = CoreUtils.CreateEngineMaterial(data.URPShaders.samplingPS);

            m_ColorGradingLutPass  = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, data.postProcessData);
            m_Render2DLightingPass = new Render2DLightingPass(data);

            //
            m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingTransparents, m_CopyDepthMaterial);
            m_CopyColorPass = new CopyColorPass(RenderPassEvent.AfterRenderingTransparents, m_SamplingMaterial);
            // m_Render2DLightingPass = new Render2DLightingPass(data);
            //
            m_PostProcessPass      = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalBlitPass        = new FinalBlitPass(RenderPassEvent.AfterRendering + 1, m_BlitMaterial);

#if POST_PROCESSING_STACK_2_0_0_OR_NEWER
            m_PostProcessPassCompat = new PostProcessPassCompat(RenderPassEvent.BeforeRenderingPostProcessing);
#endif

            m_UseDepthStencilBuffer = data.useDepthStencilBuffer;

            // We probably should declare these names in the base class,
            // as they must be the same across all ScriptableRenderer types for camera stacking to work.
            k_ColorTextureHandle.Init("_CameraColorTexture");
            k_DepthTextureHandle.Init("_CameraDepthAttachment");
            m_DepthTexture.Init("_2DCameraDepthTexture");
            m_OpaqueColor.Init("_2DCameraOpaqueTexture");
            k_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture");
            k_ColorGradingLutHandle.Init("_InternalGradingLut");

            m_Renderer2DData = data;

            supportedRenderingFeatures = new RenderingFeatures()
            {
                cameraStacking = true,
            };

            //Render Feature 支持
            m_RenderFeaturePasses = new Render2DObjectPass[m_Renderer2DData.RenderFeatures.Count];
            for (int i = 0; i < m_Renderer2DData.RenderFeatures.Count; i++)
            {
                var rf = m_Renderer2DData.RenderFeatures[i];
                if (rf.filterSettings.PassNames.Length > 0)
                {
                    var pass = new Render2DObjectPass(data, rf.Event, rf.filterSettings.PassNames, rf.filterSettings.RenderQueueType, rf.filterSettings.LayerMask, rf.cameraSettings);
                    m_RenderFeaturePasses[i] = pass;
                }
            }
        }
Пример #4
0
        public Renderer2D(Renderer2DData data) : base(data)
        {
            m_BlitMaterial = CoreUtils.CreateEngineMaterial(data.blitShader);

            m_ColorGradingLutPass  = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, data.postProcessData);
            m_Render2DLightingPass = new Render2DLightingPass(data);
            m_PostProcessPass      = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, data.postProcessData, m_BlitMaterial);
            m_FinalBlitPass        = new FinalBlitPass(RenderPassEvent.AfterRendering, m_BlitMaterial);

#if POST_PROCESSING_STACK_2_0_0_OR_NEWER
            m_PostProcessPassCompat = new PostProcessPassCompat(RenderPassEvent.BeforeRenderingPostProcessing);
#endif

            m_UseDepthStencilBuffer = data.useDepthStencilBuffer;

            m_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture");
            m_ColorGradingLutHandle.Init("_InternalGradingLut");

            m_Renderer2DData = data;
        }
Пример #5
0
        public Renderer2D(Renderer2DData data) : base(data)
        {
            m_BlitMaterial     = CoreUtils.CreateEngineMaterial(data.blitShader);
            m_SamplingMaterial = CoreUtils.CreateEngineMaterial(data.samplingShader);

            m_Render2DLightingPass = new Render2DLightingPass(data, m_BlitMaterial, m_SamplingMaterial);
            m_FinalBlitPass        = new FinalBlitPass(RenderPassEvent.AfterRendering + 1, m_BlitMaterial);

            UniversalRenderPipelineAsset urpAsset = GraphicsSettings.renderPipelineAsset as UniversalRenderPipelineAsset;

#pragma warning disable 618 // Obsolete warning
            PostProcessData postProcessData = data.postProcessData ? data.postProcessData : urpAsset.postProcessData;
#pragma warning restore 618 // Obsolete warning
            if (postProcessData != null)
            {
                m_ColorGradingLutPass  = new ColorGradingLutPass(RenderPassEvent.BeforeRenderingOpaques, postProcessData);
                m_PostProcessPass      = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing, postProcessData, m_BlitMaterial);
                m_FinalPostProcessPass = new PostProcessPass(RenderPassEvent.AfterRenderingPostProcessing, postProcessData, m_BlitMaterial);
                k_AfterPostProcessColorHandle.Init("_AfterPostProcessTexture");
                k_ColorGradingLutHandle.Init("_InternalGradingLut");
            }

            m_UseDepthStencilBuffer = data.useDepthStencilBuffer;

            // We probably should declare these names in the base class,
            // as they must be the same across all ScriptableRenderer types for camera stacking to work.
            k_ColorTextureHandle.Init("_CameraColorTexture");
            k_DepthTextureHandle.Init("_CameraDepthAttachment");

            m_Renderer2DData = data;

            supportedRenderingFeatures = new RenderingFeatures()
            {
                cameraStacking = true,
            };

            m_LightCullResult = new Light2DCullResult();
            m_Renderer2DData.lightCullResult = m_LightCullResult;
        }
Пример #6
0
 public Renderer2D(Renderer2DData data) : base(data)
 {
     m_Render2DLightingPass = new Render2DLightingPass(data);
     //m_PostProcessPass = new PostProcessPass(RenderPassEvent.BeforeRenderingPostProcessing);
     m_FinalBlitPass = new FinalBlitPass(RenderPassEvent.AfterRendering, CoreUtils.CreateEngineMaterial(data.blitShader));
 }