There are several rendering paths. How do we get to set specific path to use?

"r_renderer [ arb | nv10 | nv20 | r200 | arb2 ]"

A thread in our forums shows an ATI employee improving performance on ATI hardware by changing a Doom3 shader. There have been widespread discussions on this, not only in that particular Beyond3D thread but on other public forums as well. Please visit this forum post to understand the reasoning behind the following 2 questions. This interviewer pointed John Carmack to that particular forum thread, as did the individual which started the thread.

Now, without taking anything away from that guy for experimentations, something must be up because:

1) I can't believe you didn't think of this :) ; and
2) You couldn't do that because it (probably) affects some other stuff (specific lookup tables, for instance)

Any comments on what might be actually happening?

The ARB2 path uses a lookup that exactly matches the bias / square calculations used by the NV10 / NV20 / R200 paths so the surfaces look the same in the different rendering modes.

Does that mean you're using different lookups for different materials? What exponent exactly are you trying to approximate?

The specular function in Doom isn't a power function, it is a series of clamped biases and squares that looks something like a power function, which is all that could be done on earlier hardware without fragment programs. Because all the artwork and levels had been done with that particular function, we thought it best to mimic it exactly when we got fragment program capable hardware. If I had known how much longer Doom was going to take to ship from that time, I might have considered differently.

It should be noted that a power function is a strictly empirical approximation of a surface's specular response, so other specular approximations shouldn't be looked at as just approximating a power function. For instance, especially for broad highlights, it is nice to have a finite cutoff angle, rather than the power limit approach.

The lookup table is constant in Doom, so there isn't any real strong argument against replacing it with code. The lookup table was faster than doing the exact sequence of math ops that the table encodes, but I can certainly believe that a single power function is faster than the table lookup.


We'd like to thank John for taking the time to entertain this interviewer's frequent emails to him. We'd also like to add that id's Marty Stratton has informed us that they're working on the Linux client and it will be made available as soon as possible.


Other related articles: