Can I use shaders with TGB for neat 2D effects?
by John Klimek · in Torque Game Builder · 05/19/2007 (11:17 pm) · 6 replies
I really don't know the first thing about shaders but I do know they can create some very amazing looking special effects.
Does TGB support using them?
Thanks,
John
Does TGB support using them?
Thanks,
John
About the author
Recent Threads
#2
I'm in the exact same boat as you: I want awesome special effects, but have no idea of how to get them.
Many times though, shader effects can be imitated pretty effectively using particle effects and what not, though these solutions are never as freeform as true shader effects.
05/21/2007 (6:48 pm)
Hey John,I'm in the exact same boat as you: I want awesome special effects, but have no idea of how to get them.
Many times though, shader effects can be imitated pretty effectively using particle effects and what not, though these solutions are never as freeform as true shader effects.
#3
05/21/2007 (7:11 pm)
You can do an awful lot of "cheating" when you work with 2d graphics. I've done some pretty neat stuff with combinations of particle effects and various blended sprites (Some simple scripting to animate your blends and particles and it becomes even more powerful).
#4
05/21/2007 (7:55 pm)
I'd love to see some examples if you had any :)
#5
Here's another example from Harmonic Convergence;

(I can't take credit for most of the wonderful art on this one, I believe it was made by Jan-Ove Leksell, I was only responsible for the effect this time).
This should obviously be seen in motion to get the full effect, but basically there's a number of things that work together here. The water have fully animated waves made with a particle effect (the stuff that looks like a "reflection" of the sun in the water), there's a moving sun sprite and then there's two images blended on top of the scene to create the day/sunset/night cycle. The amount of blending of these two overlay images are controlled through a script that base it's values on the position of the sun object.
05/21/2007 (9:48 pm)
I posted some stuff in my latest blog here on the GG site.Here's another example from Harmonic Convergence;

(I can't take credit for most of the wonderful art on this one, I believe it was made by Jan-Ove Leksell, I was only responsible for the effect this time).
This should obviously be seen in motion to get the full effect, but basically there's a number of things that work together here. The water have fully animated waves made with a particle effect (the stuff that looks like a "reflection" of the sun in the water), there's a moving sun sprite and then there's two images blended on top of the scene to create the day/sunset/night cycle. The amount of blending of these two overlay images are controlled through a script that base it's values on the position of the sun object.
#6
Basically, it was a ton of work for questionable benefit, especially when a good artist can do amazing things without them just by using OpenGL blending.
-JF
05/21/2007 (10:22 pm)
I actually hacked a very primitive GLSL capability into TGB at one point as an experiment for Harmonic Convergence, but quickly abandoned the idea. It was quite a lot of effort to get even trivial support into the engine, I never got it performing anywhere near adequate for even a trivial channel-substitution shader (swap red and blue channels) -- I came to the conclusion that the only way to make it perform adequately would involve changing the rendering order of objects to group triangles by shader program and that was far beyond my ken. On top of that, I lacked the expertise required to develop *useful* shaders, which would mean expensive contract work. And most example shaders available online really only made sense in the presence of light sources, so weren't terribly useful for a 2D game.Basically, it was a ton of work for questionable benefit, especially when a good artist can do amazing things without them just by using OpenGL blending.
-JF
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
TGB has no shaders.
If you want shaders and a minimum requirement of Shader 2, you could use TGBX thought which bases on XNA and has full shader 2+ support.
But writing shaders is hard work and needs good knowledge on how the hardware works and normally on complex math stuff as well.