Layers and PostProcessing

Sep 8, 2011 at 3:00 PM
Edited Sep 8, 2011 at 3:54 PM

I've just implemented a depth of field post processor for my game and now have a problem that IGF layers are all rendered before Sunburn runs its post processors which means my HUD layer is affected by the depth of field effect and blurred out. Is there a mechanism already in IGF to render a layer after Sunburns post processor or do i need code around it myself ?

If you want the post processor for IGF btw i'm happy to contribute it

Coordinator
Sep 9, 2011 at 9:25 AM

Hi

Layers in IGF can be used in two different ways:

  1. Used to custom render "objects" outside of the SunBurn rendering pipeline by overriding the Draw method and adding your own rendering code;
  2. Used to structure your "objects" in groups so that it is easier for you to maintain your code (i.e.: it's easier to find all your HUD objects/sprites in a HUD layer than in your GameState instance ;) )

If you are using the 2. point for your layer (which is probably the case based on your post), it doesn't matter when the Layer draw method is called as all the rendering is handled by the GuiManager.

Therefore, if you don't want your HUD to be affected by the post processing, just make sure the GuiManager.ManagerOrder property is set with an integer higher than the PostProcessingManager provided by SunBurn ;)

As for your DOF post processor effect, I'd be glad to add it to the framework if it is generic enough to work with other games and not specific to yours ;)

Regards,

Philippe

 

 

 

 

Sep 10, 2011 at 11:39 PM
Edited Sep 11, 2011 at 1:45 AM

Hi - the DOF effect is completely generic and runs as a standard sunburn postprocessor, however for the blur pass i used some code from a demo sample http://www.dhpoware.com/demos/xnaGaussianBlur.html . I've emailed the devs from that site to ask if they would be happy for me to contribute the postprocessor given that it uses some of their code. If i get an all clear from them i'll fire it over to you.

Edit - Just received confirmation from the guy at dhpoware that he's happy for me to submit the effect with the code i've used. I'll tidy it up a bit and make sure it all follows your code style and get it through to you.

Steve

Sep 15, 2011 at 9:51 AM

Hi Phillipe - i've bundled the files for the DoF effect here http://fatbat.co.uk/IFDoF.zip - hope you can make use of them

Coordinator
Sep 15, 2011 at 5:03 PM

I'll look onto it and let you know. Thanks for sharing ;)

Coordinator
Oct 6, 2011 at 10:47 AM

Hi bamyazi,

I added the files in the framework but I can't seem to get it working. I've made some modifications to comply to the IGF naming conventions but normally, I didn't change a line of the processing stuff.

I noticed there are a few parameters you set in the DOFPostProcessor constructor that I removed from it but let them be accessible through Property setters. Maybe that's the trick!

Could you provide me with some default values that I could place as a start?

The DOF is the latest feature before I release IGF v0.8.0.0 so I'm eager to get it working, otherwise, I'll have to push it back on a future release since I want to have a clear release to publish a set of tutorials ;)

Thanks

Philippe

Coordinator
Oct 6, 2011 at 12:12 PM

My bad, I forgot to add the ComputeXXX method calls on the constructor.

Still now, I have the XNA 4 samplerstates bug appearing: "XNA Framework HiDef profile requires TextureFilter to be Point when using texture format HdrBlendable."
It happens on the DOF Depth combine FullFrameQuad.Render() call. Do you have any idea how I can sort that out?

Thanks

Philippe

Coordinator
Oct 6, 2011 at 12:56 PM

Finally got rid of the exception by reseting all SamplerStates to PointClamp before calling the FullFrameQuad.Render() method.

Thanks bamyasi for this, you're on the credits now ;-)

Nov 7, 2011 at 8:17 PM

That XNA bug is a nightmare - i've had no end of problems with it in various situations. Although from reading Shawn Hargreaves comments regarding it it is apparently a feature.

Nov 22, 2011 at 4:57 PM
indiefreaks wrote:

Hi

Layers in IGF can be used in two different ways:

  1. Used to custom render "objects" outside of the SunBurn rendering pipeline by overriding the Draw method and adding your own rendering code;
  2. Used to structure your "objects" in groups so that it is easier for you to maintain your code (i.e.: it's easier to find all your HUD objects/sprites in a HUD layer than in your GameState instance ;) )

If you are using the 2. point for your layer (which is probably the case based on your post), it doesn't matter when the Layer draw method is called as all the rendering is handled by the GuiManager.

Therefore, if you don't want your HUD to be affected by the post processing, just make sure the GuiManager.ManagerOrder property is set with an integer higher than the PostProcessingManager provided by SunBurn ;)

As for your DOF post processor effect, I'd be glad to add it to the framework if it is generic enough to work with other games and not specific to yours ;)

Regards,

Philippe

Quick question, given that I have various layers with different types of objects (ex: one layer for the skybox, one layer for game objects, one layer for the UI, etc.) The solution you provided would exclude post processing from any UI rendering but would not help in the case that I would want one layer with certain post processing and other layers with other post processing.

Is there a way of doing this?

Coordinator
Nov 22, 2011 at 10:55 PM

Hi Wudek,

IGF doesn't change the SunBurn rendering pipeline so there are no built in ways to do what you want.

I bet the SunBurn forums could get you with a some better and more precise advices but you could probably create a PostProcessor which would look on the ObjectManager instance using the Find() method for SceneObject instances with a custom Component (say for instance ToonEdgeProcessorComponent) and use them to render only specific SceneObject instances.

Nov 23, 2011 at 3:33 AM

Alright thanks, I'll post on the sunburn forums