Full screen FX
by Frank Bignone · in Torque Game Engine Advanced · 07/22/2007 (3:56 am) · 58 replies
Here are two examples of a simple framework I have added to the canvas GUI in order to have full screen shaders. The first example is a rendering in sepia tones:

The second one is a special rendering effect which highlights the screen around the mouse pointer (like a flash light effect).

The framework allows the following:
- vertex effect (like flag, image deformation...) based on time (time is passed to shaders)
- effect linked to mouse position
- 16 floating user-defined values
- 2 user-defined textures (used for examples if rendering of old-movie style effects)
This is an under development ressource that when ready, I will post here if people are interested.

The second one is a special rendering effect which highlights the screen around the mouse pointer (like a flash light effect).

The framework allows the following:
- vertex effect (like flag, image deformation...) based on time (time is passed to shaders)
- effect linked to mouse position
- 16 floating user-defined values
- 2 user-defined textures (used for examples if rendering of old-movie style effects)
This is an under development ressource that when ready, I will post here if people are interested.
About the author
Real programmers don't waste time recompiling; they patch the binary files... ... Real programmers don't waste time patching binary files; they patch memory.
#43
08/11/2008 (9:13 am)
Is that the resource of TGEA 1.7.1?
#44
08/11/2008 (9:14 am)
Ooops yeap :D, sorry i did not read that
#45
08/11/2008 (9:59 am)
Awsome Frank, thanks for posting it as a resource. I've been waiting for that for quite some time.
#47
08/11/2008 (7:28 pm)
Great to see this released. Nice work man.
#48
08/11/2008 (8:44 pm)
@Pat: thanks sounds interesting, will look at it.
#49
08/12/2008 (6:25 am)
By the way, it is looking like the resource is getting some time to get approved. You can still use the previous link as it is a direct link to the resource.
#50
I integrated everything and I recompiled with no errors.
I entered "doFxSepia(%gui);" in the console.
The errors I get are "Unable to find object ' 'attempting to call function 'setFXVars' "
"Unable to find object ' 'attempting to call function 'setFX' "
"Unable to find object ' 'attempting to call function 'startFX' "
Should the variable %gui be entered as is, or should it be substituted with something else?
08/12/2008 (2:03 pm)
The resource won't work.I integrated everything and I recompiled with no errors.
I entered "doFxSepia(%gui);" in the console.
The errors I get are "Unable to find object ' 'attempting to call function 'setFXVars' "
"Unable to find object ' 'attempting to call function 'setFX' "
"Unable to find object ' 'attempting to call function 'startFX' "
Should the variable %gui be entered as is, or should it be substituted with something else?
#51
%gui has to be the gui that you want to do the Fx, example, doFXSepia(PlayGui);, whit that the play gui has the fx, anyhow, its like that...
PD sorry for my bad english im from DR
08/12/2008 (2:37 pm)
Sorin:%gui has to be the gui that you want to do the Fx, example, doFXSepia(PlayGui);, whit that the play gui has the fx, anyhow, its like that...
PD sorry for my bad english im from DR
#52
I was thinking that a variable should be placed in there, but I wasn't sure which one.
What other variables can I enter to get the same effects as the ones in the pictures (i.e. the sepia on the Terrain only)?
08/13/2008 (12:06 am)
Thanks. That worked.I was thinking that a variable should be placed in there, but I wasn't sure which one.
What other variables can I enter to get the same effects as the ones in the pictures (i.e. the sepia on the Terrain only)?
#53
08/13/2008 (6:57 am)
@Sorin: doFxSepia(SceneGui);
#54
08/13/2008 (7:02 am)
I tried it with SceneGui and it said it could not find the object.
#55
08/13/2008 (7:17 am)
In the console do canvas.listobjects(), this will list the GUI object you can use for the Fx. Then select the one which is your 3D control. For the demo shown in screenhot, it is SceneGui. For the general demo, it can be PlayGui. It all depends on your code.
#56
08/13/2008 (7:21 am)
Ah, ok, I was using PlayGUI before. I thought that maybe SceneGui was something esle.
#57
08/13/2008 (9:22 am)
Now if in game.cs, onCliententergame, i put, doFxHeatVision(PlayGui);, it says in console Canvas Size is invalid or no canvas, but if in console dlg i put the same code in runtime it works
#58
Usually you should put this code inside the initialControlSet callback:
08/13/2008 (3:53 pm)
When you allocate a Fx, the gui must be attached to a Canvas (used to retrieve the size of the screen). So in onClientEnterGame, you should put the doFxHeatVision(PlayGui); after pushing the PlayGui on the canvas, not before, like:Usually you should put this code inside the initialControlSet callback:
Canvas.setContent(PlayGui); doFxHeatVision(PlayGui);
Torque 3D Owner Pat Wilson
void RenderInstManager::render() { GFX->pushWorldMatrix(); MatrixF proj = GFX->getProjectionMatrix(); if( mRenderBins.size() ) { for( U32 i=0; i<GFXBin_NumRenderBins; i++ ) { #ifndef TORQUE_SHIPPING if( !( 1 << i & mRenderBinMask ) ) continue; #endif if( mRenderBins[i] ) { GFX->beginBinNotify( (GFXRenderBinTypes)i ); mRenderBins[i]->render(); GFX->endBinNotify(); } } } GFX->popWorldMatrix(); GFX->setProjectionMatrix( proj ); }And in GFX...
void beginBinNotify( GFXRenderBinTypes type ) { mCurrentBinType = type; _beginBin(); getDeviceEventSignal().trigger(deStartRenderBin); } void endBinNotify() { getDeviceEventSignal().trigger(deEndRenderBin); _endBin(); mCurrentBinType = GFXBin_NumRenderBins; }Then you can drive FS effects off of the render bin signals.