Пример #1
0
        public override void Process(IPostProcessorContext context)
        {
            Instrument.Begin(InstrumentProcess);

            DrawShadowScene(context);
            Filter(context);

            TextureDisplay.Add(shadowSceneMap);

            Instrument.End();
        }
Пример #2
0
        public override void Process(IPostProcessorContext context)
        {
            Instrument.Begin(InstrumentProcess);

            DrawNormalDepth(context);
            Filter(context);

            TextureDisplay.Add(normalDepthMap);

            Instrument.End();
        }
Пример #3
0
        // シャドウ マップを描画。
        public void Draw(ref Vector3 lightDirection)
        {
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState        = BlendState.Opaque;

            // 各ライト カメラで描画。
            for (int i = 0; i < splitCameras.Length; i++)
            {
                var camera        = splitCameras[i];
                var renderTarget  = splitRenderTargets[i];
                var shadowCasters = splitShadowCasters[i];

                //------------------------------------------------------------
                // ライトのビュー×射影行列の更新

                splitLightCameras[i].Update(camera, ref lightDirection);

                //------------------------------------------------------------
                // エフェクト

                shadowMapEffect.LightViewProjection = splitLightCameras[i].LightViewProjection;

                //------------------------------------------------------------
                // 描画

                GraphicsDevice.SetRenderTarget(renderTarget);
                GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.White, 1.0f, 0);

                while (0 < shadowCasters.Count)
                {
                    var shadowCaster = shadowCasters.Dequeue();
                    shadowCaster.Draw(shadowMapEffect);
                }

                if (shadowMapEffect.ShadowMapTechnique == Techniques.Vsm && blur != null)
                {
                    blur.Filter(renderTarget);
                }

                GraphicsDevice.SetRenderTarget(null);

                TextureDisplay.Add(renderTarget);
            }
        }