Colouring the screen.

Editor
Feb 7, 2010 at 12:06 AM

just wondering if there is a simple way to apply a colour to the whole screen, just to create a kinda 'underwater' effect, so that when the camera falls below the water there is a blue tint to the screen to give the illusion of being underwater? thanks. bubzy

Coordinator
Feb 7, 2010 at 12:53 AM

That's post-processing. You'd override DefaultEngine.DrawHook and do a custom drawing routing. Of course, you'll need to know the principles of how to do post-processing and make sure you make the correct Ox draw calls.

Here's how drawing is currently done -

            depthStencilBuffer.Activate();
            sceneSystem.PreDraw(gameTime, Camera);

            backBuffer.Activate();
            {
                GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.Black, 1.0f, 0);
                sceneSystem.Draw(gameTime, Camera);
                guiSystem.Draw(gameTime);
            }
            backBuffer.Resolve();

            frameRater.RegisterFrame(gameTime);

You'll need to copy-paste-modify this in the override to be in line with your desired post-processing algorithm. I haven't done any post-processing work yet, so I'm not sure what the your implementation will end up looking like.