What defines a Pass?

Started by
17 comments, last by Toji 18 years, 9 months ago
Just curious... what exactly is a rendering pass? I mean, if terrain is drawn, then objects, then effects... is that three passes, or is a pass defined when you call glFinish() or whatever? :) if I render to texture, and then draw a hud or something, would that be two passes? cheers
"Game Maker For Life, probably never professional thou." =)
Advertisement
As I understand, both of the cases you mentioned are one pass.

A "pass" can be considered something like "a render of the same thing". Well, not exactly the same thing... I better give an example, I dont think I will be able to define it so well in english ;)

If in a scene you have 3 lights, and you render your scene once, with a shader that takes into account all 3 lights, thats 1 pass.
If you render the geometry with a shader that uses just one light, do it 3 times and use blending to get them all together, thats 3 passes.

If you draw the same geometry many times, adding more & more stuff, then thats many passes. Imho, but dont take my word for it, there might (has to) be a better definition :)
"A screen buffer is worth a thousand char's" - me
If you have a render() and you have all your relevent rending code in it and you call it 3 times you have just made 3 passess. Its better to just multi-texturing if possible instead of multi-pass rendering if thats what you are asking about due to terrain like rendering has large amounts of vertices to be transformed and can be expensive.
A pass can be a few things.. usually it means multitexturing like it was said.. in the old days, cards had few texture units so passes were needed to decide how much could be multitextures (if at all) at a time. If it couldn't do the multitexture the pass would setup a blending mode and redraw the face(s) again. That's the basic idea. But passes are still very used, most engines today probably do anywhere from 6+. Quake3 did something like up to 12 scene passes and could do multiple passes per face(s) as well.

it means it's a pass over the current object being drawn, or it can mean an entire pass over the scene too. It is not really clearly defined it can mean either. It can be for lights, shadows, objects, textures, bump maps... it encapsulates a state for a particular rendering op.
"It's such a useful tool for living in the city!"
Okay.

Well, now that that is settled; thanks everyone! :)
"Game Maker For Life, probably never professional thou." =)
Quote:Original post by Name_Unknown
But passes are still very used, most engines today probably do anywhere from 6+.

Dear God, I hope not ;) An average of 2 to 3 is a more realistic figure. If you need more for general purpose geometry, you should check your algorithms, and optimize by caching and temporal coherence. Some very specific shaders will require substancially more (especially recursive reflections or raytracing shaders), but they would usually only make a small percentage of the overall geometry.

Quote:
Quake3 did something like up to 12 scene passes and could do multiple passes per face(s) as well.

You mean Doom3. Please, do not take Doom3 as an example - it's the perfect example of how to NOT do it. Its insane number of passes are a direct result of a design mistake Carmack made (and he later admitted it, yet it was too late to correct): stencil shadows. Using better suited shadow algorithms (shadow map based, today that would probably be something like PSM/TSM), you can easily get Doom3 style graphics with 2 to 4 passes per frame.
Once again YannL to the rescue...
Quote:Original post by Yann L
Quote:Original post by Name_Unknown
Quake3 did something like up to 12 scene passes and could do multiple passes per face(s) as well.

You mean Doom3. Please, do not take Doom3 as an example - it's the perfect example of how to NOT do it. Its insane number of passes are a direct result of a design mistake Carmack made (and he later admitted it, yet it was too late to correct): stencil shadows. Using better suited shadow algorithms (shadow map based, today that would probably be something like PSM/TSM), you can easily get Doom3 style graphics with 2 to 4 passes per frame.


He was not that far of tho, Q3 engine could do up to 10 "passes" on a frame(I say in quotes here since people seem to be huntung definitions and I sure don't feel like defining a "pass" in this general context :P).

According to this article Brian Hooks (id software) at a SIGGRAPH '98 course explained Q3's different passes.
Quote:
* (passes 1 - 4: accumulate bump map)
* pass 5: diffuse lighting
* pass 6: base texture (with specular component)
* (pass 7: specular lighting)
* (pass 8: emissive lighting)
* (pass 9: volumetric/atmospheric effects)
* (pass 10: screen flashes)

Only on the fastest machines can up to 10 passes be done to render a single frame. If the graphics accelerator cannot maintain a reasonable framerate, various passes (those in parantheses) can be eleminated.


But for modern engines to do such humongous amount of passes is quite rare. In the good old times(tm) there was so little you could do at once so you had to resort to repeating. Nowdays you can often just smash everything out at once/in parallell.

So far the most amount of passes I have had to use myself ever was 3, for a realtime water caustics algorithm for GPU, and even then the third pass could be skipped as it was just used to fake some eye-water refractions.

If you have to do *alot* of passes you should really be asking yourself, am I doing the right thing(tm) now?
Quote:Original post by Yann L
Quote:Original post by Name_Unknown
But passes are still very used, most engines today probably do anywhere from 6+.

Dear God, I hope not ;) An average of 2 to 3 is a more realistic figure. If you need more for general purpose geometry, you should check your algorithms, and optimize by caching and temporal coherence. Some very specific shaders will require substancially more (especially recursive reflections or raytracing shaders), but they would usually only make a small percentage of the overall geometry.

Quote:
Quake3 did something like up to 12 scene passes and could do multiple passes per face(s) as well.

You mean Doom3. Please, do not take Doom3 as an example - it's the perfect example of how to NOT do it. Its insane number of passes are a direct result of a design mistake Carmack made (and he later admitted it, yet it was too late to correct): stencil shadows. Using better suited shadow algorithms (shadow map based, today that would probably be something like PSM/TSM), you can easily get Doom3 style graphics with 2 to 4 passes per frame.



oops.. dunno why I typed 6 really... sorry.
I'd say 4 is the magic number. I only have 2 in my code. I was thinking 6 for some reason, counting some things that are really a part of the other passes.

But yeah quake 3 really did do up to 10 passes or so.



"It's such a useful tool for living in the city!"
Quote:Original post by Yann L
You mean Doom3. Please, do not take Doom3 as an example - it's the perfect example of how to NOT do it. Its insane number of passes are a direct result of a design mistake Carmack made (and he later admitted it, yet it was too late to correct): stencil shadows.

What? Taken from Carmack's speech at QuakeCon 2k4: "At the time there was a lot of speculation about which way things should go. Some people thought that shadow buffers might have been a better choice on there. Having done much more work on it now it's really clear that a generalized rendering architecture would not have been viable with shadow buffers in Doom's timeframe to cover our entire target market on there."

This topic is closed to new replies.

Advertisement