Vertices Engine Porting : Success

After a weekend of coding, porting, and compiling, I manged to get a large portion of the shaders ported over too MonoGame. It was really nice to finally see God Rays peak out on a Linux OpenGL platform. That said, all the coding and changing left the Rendering Engine an absolute mess. As well as I had been meaning for well over a year to get Deferred Lighting integrated with all the other shaders. I decided too recode it all, start fresh.

Getting the Deferred rendering working was the easy part. But I had a number of changes too it. It draws a colour map but it isn’t not used except for the alpha channel for the, i may change this even further if i need too pass more data through the pre-pass.

The way the rendering engine works is the following

Prep Pass

Does a multi pass rendering too the Color Map, Normal Map, Depth Map and Distortion Map.

01initial render

Base Scene. A break down of the Plain Render, Normal Map and Depth Map  can be seen at the top.

One of the most powerful things that I’ve begun to use is multi-target rendering where I’m able to render multiple passes in one pass. This results in a much more efficient render pass.Which target is used is simple as using multiple Color variables in your Shader code.

That said though, Pixel Shader 3.0 only allows for 4 Output channels.

Cascade Shadow Mapping

Draws the scene 4 times with different shadow mapping settings.


Cascade Shadow Mapping Debug View from Metric Racer.

Render Models

Render Scene as per Individual Model Shader (Lambert/Toon/Water etc…). This and the Cascade Shadow Mapping still needs to be fully integrated. Although it’s working in the previous revision of the engine just fine.

Light Map

Draws the individual light points onto the Light Map.

03 - Light Map

Light Map showing Multiple Points lights.


Final Combined image with lighting.

Post Processing

All of the post-processing (Light Maps, God Rays, Distortion, Bloom etc…) are preformed in this pass.


God Rays Working under MonoGame.

The reason why the Render Model pass isn’t incorporated into the Prep Pass is due to the fact that Alpha blending is required, but Alpha blending would be required too be implemented on all of the Render targets for a multitarget pass. This isn’t possible since the Depth Map is a Single Depth Buffer.

There’s still a lot of work to do in optimizing what is done in the prep pass and what’s performed in the final render. Other post processing I want to add is Screen Space Ambient Occlusion (SSAO) and Depth of Field and changing many of the other shader’s too use the depth buffer to calculate depth instead of using a mask render target which is the current “duct-tape and bubble gum” solution I currently have.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s