Game Development Community

Fixed function rendering

by Mark O · in Torque Game Engine Advanced · 09/15/2005 (2:54 am) · 4 replies

I just got TSE yesterday and I'm interested in having non-shader fall-back rendering for my game since I feel that a lot of my potential customers would not have high-powered vid cards. I haven't really had much of a chance to look at the TSE code base but I'd appreciate any opinions as to whether something like this would be fairly easy to do at this point and, if so, what would be a good approach to doing it?

#1
09/15/2005 (3:57 am)
You're asking if something is very hard to do at this point, but without knowing how much knowledge you got.. it's a question without an answer.

It's doable, but definatly not easy.
#2
09/15/2005 (4:20 am)
I think that if a surface/texture doesn't have a material map, it will render in "fixed-function". That's not to say that it will run on non-shader cards, though.
#3
09/15/2005 (7:23 am)
I'm asking based on a comment made by a GG person in this thread.

www.garagegames.com/mg/forums/result.thread.php?qt=26054

Would it still be considered "a piece of cake"?
#4
09/15/2005 (11:56 am)
If I were going to try to support fixed function stuff, here's what I'd do:

1. I'd start with writing a new CustomMaterial derived class. I'd override setupPass to set up whatever render states were necessary.
2. Then set up fallbacks for all of your materials to use your new CustomMaterial class.

To get an idea of how the shaders get activated during rendering, just do a search for setupPass, you'll find lots of pieces of code that look like this:

while( mat->setupPass( sgData ) )
         {
            GFX->drawPrimitive( node.primInfoIndex );
         }

This is where the material is suppossed to set the graphics/state and shader state. So, your new class would just not set shaders, and set whatever texture states you needed.

What Brian is alluding to at the end of that thread is that shading and lighting algorithm implementations tend to diverge quite a bit between a shader based implementation and a fixed function implementation, so it'll be hard to keep these features looking decent on the fixed function version.

I'm pretty sure I heard this new material idea on IRC a while back, and it now makes a lot of sense now that I've mucked about with TSE rendering more.