Game Development Community

Bloom & other post-processing effects in TX2D?

by Matt Simpson · in Torque X 2D · 06/21/2010 (11:27 am) · 4 replies

Hi All

Could someone please give me the low-down on how Bloom and other post-processing shader effects work in Torque X 2D?

Many thanks!
Matt

#1
06/21/2010 (11:50 am)
To use post processing you need to extend the PostProcessor class, create an instance, and set it on the sceneview you want to apply it to. As it happens TX already comes with a bloom post processor (called BloomPostProcessor as it happens :) so definitely start by checking that out.
#2
06/22/2010 (10:29 am)
Hi Duncan

Thanks for your reply.

I've dug into the code and got bloom working. Cheers!

#3
08/04/2010 (7:21 am)
I'm trying to add this bloom effect to my 2d Torque X Platformer based on the platformer kit and I'm running into trouble.

I've got the bloom effect working, but it's causing some pixelization issues. I've tried editing the settings but haven't been able to fix it. Here is the code:

// set the parallax manager's target object
T2DSceneCamera camera = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("Camera");

ParallaxManager.Instance.ParallaxTarget = camera;
_sceneGraph = camera.SceneGraph as T2DSceneGraph;

// create game gui
GUIStyle playStyle = new GUIStyle();
GUISceneview play = new GUISceneview();
play.Name = "PlayScreen";
play.Style = playStyle;
play.Camera = camera;

BloomPostProcessor bloom = new BloomPostProcessor();

play.PostProcessor = bloom;

bloom.Setup(20, 20);
bloom.ExtractMaterial.BloomThreshold = 0.5f;
bloom.BlurMaterial.IsTranslucent = true;
bloom.BlurMaterial.Size = new Vector2(1.0f, 1.0f);
bloom.BlurMaterial.BlurAmount = 5.0f;
bloom.CombineMaterial.BaseIntensity = .9f;
bloom.CombineMaterial.BloomIntensity = 1.5f;
bloom.CombineMaterial.BaseSaturation = .9f;
bloom.CombineMaterial.BloomSaturation = 1.0f;


bloom.Cleanup();

GUICanvas.Instance.SetContentControl(play);
PlatformerDemoGUI.Instance.GUI.Folder = GUICanvas.Instance;

Any help would be appreciated. Thanks
#4
08/04/2010 (7:34 am)
p.s. here are some images to illustrate what I'm talking about

without bloom:

http://s989.photobucket.com/albums/af17/grantham_a/?action=view&current=WithoutBloom.jpg


with bloom:

http://s989.photobucket.com/albums/af17/grantham_a/?action=view&current=WithBloom.jpg