Single pass Vs Multiple pass multitexturing

Started by
3 comments, last by d000hg 21 years, 10 months ago
I''m looking into the multitexturing stuff in ''Special effects game programming with DX8'' and have a couple of questions... 1)Firstly, how many of the maximum 8 texture stages are supported on current cards, a run down on as many from geforce1 to the newest cards would be appreciated - am I right thinking the GF4 has all 8 stages? 2)2nd trivial question: are eight stages actually enough? (Doom3 apparently uses 7!) 3)THE MAIN QUESTION: a)why do you have to explicity do multiple passes instead of D3D doing however many stages it can in the first pass then doing the next lot automatically in a second pass and continuing until all stages are complete? b)Am I correct in thinking that multiple passes entails completely re-rendering the whole scene? If so, how do you prevent the output from the previous pass being overdrawn? 4)I guess I''m going to have to code for cards that will need multiple passes - just writing for cards that''ll do it all in a single pass is dumb, right? 5)Do you guys use effect scripts and are they useful/effiicent etc
Advertisement
1) (For what it''s worth) My GeForce4MX apparently supports 8 texture stages, with 2 (possibly unique) textures between them. My old ATI XPert128 supported 3 texture stages, with 2 textures between them.

2) Doom3 uses the multi-pass techniques you were talking about on some cards, with the help of so-called "pixel shaders", which I''ve been given to understand allow many more mathematical operations than the "fixed pipeline" multi-stage approach. You can ALWAYS use more stages, more operations, more everything! Doom3 uses what are called register combiners for some cards, which are only available (really) through the OpenGL api. These allow more varied and numerous operations on cards like GeForce1 and GeForce2 than you could probably get out of D3D. I''ve run into this limitation a lot, but I''ve stuck with D3D because it (supposedly) has a unified interface across all the cards. I don''t think Doom3 uses the stage paradigm that much. Also, Doom3 uses about five or six textures per light, which on most cards (GeForce3, for instance) couldn''t be done in a single pass, even if it did have 8 or more stages...

3.a) A lot of the operation that you perform in the stages can''t be performed with blending (where you put the multiple passes together). For example, you can do a dot3 operation (needed for bumpmapping) within the texture stages, but you can''t render one pass, and then "dot3-it" with another pass. Plus, a lot of operations are much, much faster to do in texture stages than in blending stages, which require reads from the frame buffer. Perhaps one day, blending operations and texture stage operations will support the same features, and we can do what you say (which would be VERY nice).

3.b) Yes. The blending I mentioned earlier handles this. Just as the texture stages have a bunch of functions associated with them (add, modulate, ect...), so do the blending operations, which take one pass, and combine it with another. Some texture stage operations, such as add, can be mimicked using the blending, but a many cannot. See the DX documentation for more info.

4) If you''re trying to code for a wide audience, I guess that would be a good thing to do. You''ll probably have to right a couple version anyway, if you getting that involved. Most most modern cards don''t encourage the use of stages, but pixel and vertex shaders. You''ll probably want to right for these, since there is a lot more that you can do with them than you could normally do with the fixed pipeline stage approach.

5) I don''t use effect scripts, but I''m not really that advanced as a programmer. Pixels and vertex shaders can be looked at as "effect scripts", so a lot of programmers do use them.
-- SH
Be careful using the 8 texture stages on the NVIDIA cards unless you know what you are doing. On some of their cards that is how access the register combiners. I'm don't know if this is still the case on GF level cards, but you ought to look into it you you are planning on relying on more texture stage states than textures.

Here's an NVIDA paper on it.

http://developer.nvidia.com/docs/IO/1318/ATT/8_Stage_TNT.pdf

Yes, I use effects, and I wholehearted recommend them.

For multipass rendering you choose a alpha blend mode so it blends the textures instead of overwrites.

Jack

[edited by - JackNathan on June 6, 2002 9:58:02 AM]
Does using a pixel shader eliminate the need to bother checking how many texture stages are supported per card then? Does that mean any card with pixel shader support will run any pixel shader? And when did cards start supporting shaders (e.g GF1, 2,3,4...).
Basically, making my game need a GF3 is stupid when it should be able to run on a 3 year-old card.
No, you still need to see how many textures are supported. If your shader needs four texture inputs, but the card only supports three textures, the shader won''t work.

No, unfortunately, the pixels shaders are still rather effectively card specific. The language is the same, but some cards support features that others don''t. Like texture stages, it''s possible to write to a lowest common denominator so that your shader will work on a wider set of cards. Carmack has been pushing for a completely generalized architecture, where every function would be supported in some capacity, but we aren''t quite there yet. As an example, Doom3 uses several different renderers, each to support a different grahics card.

Pixel shaders are supported in GF3 cards an up. Vertex shaders are supported in all cards, though only the GF3+ support vertex shaders in hardware. ATI cards I think supported pixel shaders from the 8500 on up. I''m not sure though. Just about every card coming out now fully supports pixels and vertex shaders in hardware.

Yes. I suppose it''s best to just choose the lowest feature set you''re going to support, and work from there. Alternately, you can sort of do what Carmack is doing, and start with a GeForce3, write some really awesome stuff for it, but then write a really cheesy, no frills renderer for all the lower end cards.

JackNathan brought up a very good point about NVidia''s use of the 8-Stage pipeline.
-- SH

This topic is closed to new replies.

Advertisement