Changing from Forward to Deferred lighting in SunBurn

Open your content project and change the Content Processor for your Content.repo to “Content Repository – SunBurn deferred content repository”:


Then open up your Game.cs class (or where ever you are initialising the Scene Interface) and change the preference to use Deferred lighting:

sceneInterface = new SceneInterface();
sceneInterface.CreateDefaultManagers(RenderingSystemType.Deferred, CollisionSystemType.Physics, true);

If this is a new game & you don’t have any models loaded yet, this should run as expected. Every model now added through the editor will be setup for Deferred rendering.


Pipeline Dreams

If you’re adjusting this for an existing game then there you also need to change the models processors. You’ll know if this is the case because you will receive an error message like this “Deferred rendering does not support non-deferred effects (SceneObject ‘Press Start’). Make sure effects derive from IDeferredObjectEffect or model processors are set to a deferred processor.”

The error message is thrown using the name of the object, based on it’s setup within the Scene. However you actually need to change the processor directive for the model. Open your Content.repo file and find the model; it will have a line like this:


You need to update this to use the Deferred model processor, which as co-incidence (or really smart design work 🙂 requires you to just add Deferred to so that it looks like this:


If you just want to jump ahead, run a find and replace for all objects within your Content.repo file and update them


For those of you using SGMotion; you will need to also change the processor for your animated models from


To the Deferred version


Finishing touches

If you’ve been using effects or have created your own methods to pass data in to effects you will need to swap them over to deferred rendering as well. Locate any code that is referencing anything from: (Just comment out the reference and work out what breaks?)

using SynapseGaming.LightingSystem.Effects.Forward;

You need to up update the references to use Deferred rendering:

using SynapseGaming.LightingSystem.Effects.Deferred;

There will be some small differences to change. I had the following code, passing in an incrementing value to a Thruster effect each update. Part of this code is to change the Transparency mode to Additive; which relies on casting the Effect. As per the snippet below.

theObject = (SceneObject)ParentObject;
(theObject.RenderableMeshes[0].Effect as SasLightingEffect).TransparencyMode = TransparencyMode.Additive;

This needs to change, such that the effect is being cats to it’s deferred equivalent:

theObject = (SceneObject)ParentObject;
(theObject.RenderableMeshes[0].Effect as DeferredSasEffect).TransparencyMode = TransparencyMode.Additive;

Another example where of setting the transparency of an object. The forward lighting values would look like:

if ((theObject.RenderableMeshes[0].Effect as LightingEffect).TransparencyMode == TransparencyMode.None)
    (theObject.RenderableMeshes[0].Effect as LightingEffect).TransparencyMode = TransparencyMode.Blend;

    // This is for the standard forward lighting effect from SunBurn (theObject.RenderableMeshes[0].Effect as LightingEffect).TransparencyAmount = _TransparentAmount;


Which needs to be swapped over to the Deferred equivalent

if ((theObject.RenderableMeshes[0].Effect as DeferredObjectEffect).TransparencyMode == TransparencyMode.None)
    (theObject.RenderableMeshes[0].Effect as DeferredObjectEffect).TransparencyMode = TransparencyMode.Blend;

    // This is for the standard Deffered Object Effect from SunBurn (theObject.RenderableMeshes[0].Effect as DeferredObjectEffect).TransparencyAmount = _TransparentAmount;

Welcome to the world of Deferred Lighting!

Update (13/10/12)

If your swapping between forward and deferred (going either way) and you have Terrain in your solution, you also need to update it’s processor:

If you don’t, you might get a strange error which doesn’t tell which SceneObject needs to be changed:  Message=Forward rendering does not support deferred effects (SceneObject ”). Make sure model processors are set to a non-deferred processor.


Leave a Reply

Your email address will not be published. Required fields are marked *