Let's talk about s...
by Michael Woerister · in Torque Game Builder · 04/12/2006 (9:10 am) · 5 replies
... shaders.
I've been toying around with shader integration over last few days. I didn't know much about shaders at all two weeks ago, so my knowledge is still fragmentary. But after finding out which OpenGL extensions to add (and with the help of Pat Wilson's resource found here) it was fairly easy to integrate them. It took about an afternoon to render my static sprites through a vertex shader instead of the fixed function pipeline.
Until now this only works with OpenGL. I guess one would have to extend the opengl2d3d.dll to get this working with DirectX (though they seem to use different assembly languages which is another problem). Atm, there is no support for Cg, GLSL, or HLSL either. (Cg and GLSL do not seem to work very good with my ATI card. However, my graphics driver has just had its second birthday which might be the reason. And because my notebook vendor is not supported by ATI, I cannot update it :/ )
But it's a beginning. :) And I want to start a discussion and shaders in TGB:
1) What do you think could be the benefits of using shaders in TGB? What nice graphical / performance increasing effects can you think of?
2) What are GG's plans on this? Will shaders ever be standard for TGB? Any interactions with TSE?
3) Why shaders and not sex, dammit!
I guess some of you already have some experience with shaders. Tell us what you think :)
-Michael
I've been toying around with shader integration over last few days. I didn't know much about shaders at all two weeks ago, so my knowledge is still fragmentary. But after finding out which OpenGL extensions to add (and with the help of Pat Wilson's resource found here) it was fairly easy to integrate them. It took about an afternoon to render my static sprites through a vertex shader instead of the fixed function pipeline.
Until now this only works with OpenGL. I guess one would have to extend the opengl2d3d.dll to get this working with DirectX (though they seem to use different assembly languages which is another problem). Atm, there is no support for Cg, GLSL, or HLSL either. (Cg and GLSL do not seem to work very good with my ATI card. However, my graphics driver has just had its second birthday which might be the reason. And because my notebook vendor is not supported by ATI, I cannot update it :/ )
But it's a beginning. :) And I want to start a discussion and shaders in TGB:
1) What do you think could be the benefits of using shaders in TGB? What nice graphical / performance increasing effects can you think of?
2) What are GG's plans on this? Will shaders ever be standard for TGB? Any interactions with TSE?
3) Why shaders and not sex, dammit!
I guess some of you already have some experience with shaders. Tell us what you think :)
-Michael
#2
2) What would I know? Doesn't look like something I'd hold my breath for though.
3) hmm.. that's a question for the wife!
Good to see someone messing with this. I played with shaders years ago, even some Cg stuff. I was more into Nvidia since they had such nice demos and presentations. If a card supports shaders some great effects can be done efficiently. The main problem I'd say is the number of cards that don't support them. There is a resource on adding functions to the DirectX DLL too.
04/12/2006 (9:47 am)
1) Tons of stuff :)2) What would I know? Doesn't look like something I'd hold my breath for though.
3) hmm.. that's a question for the wife!
Good to see someone messing with this. I played with shaders years ago, even some Cg stuff. I was more into Nvidia since they had such nice demos and presentations. If a card supports shaders some great effects can be done efficiently. The main problem I'd say is the number of cards that don't support them. There is a resource on adding functions to the DirectX DLL too.
#3
04/12/2006 (2:20 pm)
Correct me if I'm wrong, but I think "Geometry Wars" on the Xbox 360 is basically a 2d game that uses shaders for all kind of cool effects (the background grid gets torn, displays wave effects resulting from explosions/shots). It would be very nice to have such possibilities in TGB! I dont know if it's going to be possible to combine the TSE and TGB at some point, but that would really be great (garagegames devs, are you listening;-) ?). together with the particle effects, this could really result in cool looking games.
#4
I'll probably get flamed for this but - Shaders - pshaww who needs 'em?
With TGB we have particle Fx, transparency and OGL Blending options, that's enough to do a LOT without even getting into shaders.
With XBox 360 you have a fixed target platform- so seem shaders are great in that context. But in the PC world it seems like a LOT of work and hassle to deploy shaders when you aren't sure whether the user's Gfx card wil even run it.
It was a real downer for me playing around with the TSE demos and crappy performance, on (I thought) a decent enough cpu . gfx card Athlon 2Ghz + Geforce FX 5700.
So when I want a distraction from writing my game, I will just go straight to sex and probably won't use shaders anytime soon.
But all the power to you and the other Shader-Lovers ;-)
Alex
04/12/2006 (11:38 pm)
Responding to question 3) I'll probably get flamed for this but - Shaders - pshaww who needs 'em?
With TGB we have particle Fx, transparency and OGL Blending options, that's enough to do a LOT without even getting into shaders.
With XBox 360 you have a fixed target platform- so seem shaders are great in that context. But in the PC world it seems like a LOT of work and hassle to deploy shaders when you aren't sure whether the user's Gfx card wil even run it.
It was a real downer for me playing around with the TSE demos and crappy performance, on (I thought) a decent enough cpu . gfx card Athlon 2Ghz + Geforce FX 5700.
So when I want a distraction from writing my game, I will just go straight to sex and probably won't use shaders anytime soon.
But all the power to you and the other Shader-Lovers ;-)
Alex
#5
you are right. Different to no support on different hardware is a problem. From what I've seen TSE seems to solve this problem with its material system as it downscales the shaders to earlier versions if needed. Vertex shaders can be emulated by the CPU quite well. But it is true: If you use shaders many people won't be able to play your game. Altough, if they are just eye candy then it should not be a problem to turn them off on older hardware. And non-shader hardware will die out anyway. If you are aiming for the casual market then better stay safe and don't use them. Yet the possibility to use them should be provided.
If you look at it as software developer the fixed function approach is rather insane. It was a technical restriction some time ago but now, as this is no longer true, fixed function rendering should really be abolished as it can't do anything that shaders can't do. On the long run. Practically, a shaders-only TGB would be stupid of course.
Comment on 1) from myself:
Lots of old school effects like palette rotation are possible again with shaders. It should not be to hard to create fragment shader that makes paletted images possible. And of course all kinds of post-processing stuff, sepia-, grayscale tones, underwater or heat effects on the whole screen (as Marc already said), those super-sai-filters you see in ZSNES. Given the possibly very low demand on your graphics hardware in TGB, one could think of very elaborate post-processing effects.
These two threads already exist on this topic:
http://www.garagegames.com/mg/forums/result.thread.php?qt=31110
http://www.garagegames.com/mg/forums/result.thread.php?qt=36813
From what you read there, it should not be too hard to integrate TGB with TSE. Unfortunatly TSE does not fit into my budget. Either TSE or something to eat for the next 4 weeks ;)
I'll give that a try some time.
04/13/2006 (1:56 am)
@Alex,you are right. Different to no support on different hardware is a problem. From what I've seen TSE seems to solve this problem with its material system as it downscales the shaders to earlier versions if needed. Vertex shaders can be emulated by the CPU quite well. But it is true: If you use shaders many people won't be able to play your game. Altough, if they are just eye candy then it should not be a problem to turn them off on older hardware. And non-shader hardware will die out anyway. If you are aiming for the casual market then better stay safe and don't use them. Yet the possibility to use them should be provided.
If you look at it as software developer the fixed function approach is rather insane. It was a technical restriction some time ago but now, as this is no longer true, fixed function rendering should really be abolished as it can't do anything that shaders can't do. On the long run. Practically, a shaders-only TGB would be stupid of course.
Comment on 1) from myself:
Lots of old school effects like palette rotation are possible again with shaders. It should not be to hard to create fragment shader that makes paletted images possible. And of course all kinds of post-processing stuff, sepia-, grayscale tones, underwater or heat effects on the whole screen (as Marc already said), those super-sai-filters you see in ZSNES. Given the possibly very low demand on your graphics hardware in TGB, one could think of very elaborate post-processing effects.
These two threads already exist on this topic:
http://www.garagegames.com/mg/forums/result.thread.php?qt=31110
http://www.garagegames.com/mg/forums/result.thread.php?qt=36813
From what you read there, it should not be too hard to integrate TGB with TSE. Unfortunatly TSE does not fit into my budget. Either TSE or something to eat for the next 4 weeks ;)
Quote:
On the driver: look for dhmodtool, this allows you to use the desktop drivers on your mobile. I've been using that quite long :-)
I'll give that a try some time.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
1) One cool thing would be "stretching" / warp effects within the picture without scaling it. Usable for "heat" effects
Another cool thing would be the possibility to dynamically blend different textures to a sprite using a mixing texture (grayscale). thats definitely possible, have done similar things with frament programs.