public void Initialize(EngineContext engineContext)
            {
                var renderContext  = engineContext.RenderContext;
                var rootRenderPass = renderContext.RootRenderPass;

                var linearColorPass   = new RenderPass("LinearColor");
                var reinhardColorPass = new RenderPass("ReinhardColor");
                var yebisPass         = new RenderPass("YebisColor");
                var filmicColorPass   = new RenderPass("FilmicColor");
                var composeColorPass  = new RenderPass("ComposeColor");

                rootRenderPass.AddPass(linearColorPass);
                rootRenderPass.AddPass(reinhardColorPass);
                rootRenderPass.AddPass(yebisPass);
                rootRenderPass.AddPass(filmicColorPass);
                rootRenderPass.AddPass(composeColorPass);

                LinearColorPlugin = new PostEffectPlugin("LinearColor")
                {
                    RenderPass = linearColorPass
                };

                ReinhardColorPlugin = new PostEffectPlugin("ReinhardColor")
                {
                    RenderPass = reinhardColorPass
                };

#if XENKO_YEBIS
                YebisPlugin = new YebisPlugin("ReinhardColor")
                {
                    RenderPass = yebisPass
                };
#endif

                FilmicColorPlugin = new PostEffectPlugin("FilmicColor")
                {
                    RenderPass = filmicColorPass
                };

                MainPlugin = new PostEffectPlugin("MainColor")
                {
                    RenderPass = composeColorPass
                };

                //MainDepthReadOnlyPlugin

                // YebisPlugin = new YebisPlugin() { RenderPass = yebisColorPass, MainDepthReadOnlyPlugin = null };

                //renderContext.Register(MainDepthReadOnlyPlugin);
                //renderContext.Register(SkyBoxPlugin);
                //renderContext.Register(PostEffectPlugin);

                //// Create and bind depth stencil buffer
                //renderContext.GraphicsResizeContext.SetupResize(
                //    (resizeContext) =>
                //    {
                //        MainDepthReadOnlyPlugin.DepthStencil = renderContext.GraphicsDevice.DepthStencilBuffer.New(DepthFormat.Depth32, renderContext.Width, renderContext.Height, true, "MainDepthBuffer");
                //        // Bind render target - comment when Yebis is off
                //        MainDepthReadOnlyPlugin.RenderTarget = renderContext.GraphicsDevice.RenderTarget2D.New(renderContext.Width, renderContext.Height, PixelFormat.HalfVector4, name: "MainRenderTarget");

                //        // Comment - when Yebis is on
                //        //MainDepthReadOnlyPlugin.RenderTarget = renderContext.GraphicsDevice.RenderTarget2D.New(renderContext.Width, renderContext.Height, PixelFormat.R8G8B8A8, name: "MainRenderTarget");
                //        //renderContext.GlobalPass.EndPass.AddFirst = threadContext => threadContext.GraphicsDevice.Copy(MainDepthReadOnlyPlugin.RenderTarget, engineContext.RenderContext.RenderTarget);
                //    });

                //// Yebis plugin must be initialized after creating MainDepthReadOnlyPlugin.RenderTarget
                //renderContext.Register(YebisPlugin);

                //YebisPlugin.ToneMap.Gamma = 1.0f;
                //YebisPlugin.ToneMap.Type = ToneMapType.Auto;
                //YebisPlugin.ToneMap.AutoExposure.MiddleGray = 0.25f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationSensitivity = 0.5f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationScale = 0.8f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationSpeedLimit = 4.0f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationSensitivity = 0.9f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationScale = 0.6f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationSpeedLimit = 4.0f;
                //YebisPlugin.ToneMap.AutoExposure.LightDarkExposureBorder = 1.0f;

                //YebisPlugin.Glare.Enable = true;
                //YebisPlugin.Glare.RemapFactor = 1f;
                //YebisPlugin.Glare.Threshold = 0f;

                //YebisPlugin.Lens.Vignette.Enable = true;

                //YebisPlugin.ColorCorrection.ColorTemperature = 3500;
            }
Beispiel #2
0
            public void Initialize(EngineContext engineContext)
            {
                var renderContext = engineContext.RenderContext;
                var rootRenderPass = renderContext.RootRenderPass;

                var linearColorPass = new RenderPass("LinearColor");
                var reinhardColorPass = new RenderPass("ReinhardColor");
                var yebisPass = new RenderPass("YebisColor");
                var filmicColorPass = new RenderPass("FilmicColor");
                var composeColorPass = new RenderPass("ComposeColor");

                rootRenderPass.AddPass(linearColorPass);
                rootRenderPass.AddPass(reinhardColorPass);
                rootRenderPass.AddPass(yebisPass);
                rootRenderPass.AddPass(filmicColorPass);
                rootRenderPass.AddPass(composeColorPass);

                LinearColorPlugin = new PostEffectPlugin("LinearColor") { RenderPass = linearColorPass };

                ReinhardColorPlugin = new PostEffectPlugin("ReinhardColor") { RenderPass = reinhardColorPass };

#if PARADOX_YEBIS
                YebisPlugin = new YebisPlugin("ReinhardColor") { RenderPass = yebisPass };
#endif

                FilmicColorPlugin = new PostEffectPlugin("FilmicColor") { RenderPass = filmicColorPass };

                MainPlugin = new PostEffectPlugin("MainColor") { RenderPass = composeColorPass };

                //MainDepthReadOnlyPlugin

                // YebisPlugin = new YebisPlugin() { RenderPass = yebisColorPass, MainDepthReadOnlyPlugin = null };

                //renderContext.Register(MainDepthReadOnlyPlugin);
                //renderContext.Register(SkyBoxPlugin);
                //renderContext.Register(PostEffectPlugin);

                //// Create and bind depth stencil buffer
                //renderContext.GraphicsResizeContext.SetupResize(
                //    (resizeContext) =>
                //    {
                //        MainDepthReadOnlyPlugin.DepthStencil = renderContext.GraphicsDevice.DepthStencilBuffer.New(DepthFormat.Depth32, renderContext.Width, renderContext.Height, true, "MainDepthBuffer");
                //        // Bind render target - comment when Yebis is off
                //        MainDepthReadOnlyPlugin.RenderTarget = renderContext.GraphicsDevice.RenderTarget2D.New(renderContext.Width, renderContext.Height, PixelFormat.HalfVector4, name: "MainRenderTarget");

                //        // Comment - when Yebis is on
                //        //MainDepthReadOnlyPlugin.RenderTarget = renderContext.GraphicsDevice.RenderTarget2D.New(renderContext.Width, renderContext.Height, PixelFormat.R8G8B8A8, name: "MainRenderTarget");
                //        //renderContext.GlobalPass.EndPass.AddFirst = threadContext => threadContext.GraphicsDevice.Copy(MainDepthReadOnlyPlugin.RenderTarget, engineContext.RenderContext.RenderTarget);
                //    });

                //// Yebis plugin must be initialized after creating MainDepthReadOnlyPlugin.RenderTarget
                //renderContext.Register(YebisPlugin);

                //YebisPlugin.ToneMap.Gamma = 1.0f;
                //YebisPlugin.ToneMap.Type = ToneMapType.Auto;
                //YebisPlugin.ToneMap.AutoExposure.MiddleGray = 0.25f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationSensitivity = 0.5f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationScale = 0.8f;
                //YebisPlugin.ToneMap.AutoExposure.AdaptationSpeedLimit = 4.0f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationSensitivity = 0.9f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationScale = 0.6f;
                //YebisPlugin.ToneMap.AutoExposure.DarkAdaptationSpeedLimit = 4.0f;
                //YebisPlugin.ToneMap.AutoExposure.LightDarkExposureBorder = 1.0f;

                //YebisPlugin.Glare.Enable = true;
                //YebisPlugin.Glare.RemapFactor = 1f;
                //YebisPlugin.Glare.Threshold = 0f;

                //YebisPlugin.Lens.Vignette.Enable = true;

                //YebisPlugin.ColorCorrection.ColorTemperature = 3500;
            }