Say you swapped deferred lighting for hardware lighting in the average game

inlimbo

Newcomer
Meaning a like-for-like match in number of lights, but using hardware lighitng and multipass rendering. Roughly what's the performance hit?
 
You mean the old hardware lighting that T&L engines provided? That's going to be seriously tricky to come up with even a ballpark figure but it would be a lot slower.
Modern deferred lighting algorithms are specifically designed to handle huge amounts of lights (100s) and they operate on pixel basis. T&L hardware allowed for a modest 8 light sources (and performance cost depends on type of light source) and it operated on vertex basis. So you'd have to adaptively tessellate down to close pixel sized triangles which would cause a performance drop on it's own even without rerendering geometry over and over again.
It also means that you'll have to specifically calculate lighting on all the vertices even the ones that are outside the range of some of the lights. Or split up geometry somehow. Or pay for branching penalties...
 
As expected, I guess, though you wouldn't have to worry about triangles and tessellation unless you were actually working with vertex lighting, which no one would. With the introduction of shaders videocards were able to support per pixel lights in hardware.

I do wonder how Doom 3 was able to throw around as many lights as it did, though. I mean I realize two or three passes is significantly less of a hit than say the double digit passes you might need to match a modern deferred pipeline, but still, Doom 3 was throwing around a lot of per pixel lights in its day. Did Carmack use some tricks there, akin to the way that Wind Waker used inverted spheres or some games have used straight up blended textures to fake lights?
 
As expected, I guess, though you wouldn't have to worry about triangles and tessellation unless you were actually working with vertex lighting, which no one would. With the introduction of shaders videocards were able to support per pixel lights in hardware.

I do wonder how Doom 3 was able to throw around as many lights as it did, though. I mean I realize two or three passes is significantly less of a hit than say the double digit passes you might need to match a modern deferred pipeline, but still, Doom 3 was throwing around a lot of per pixel lights in its day. Did Carmack use some tricks there, akin to the way that Wind Waker used inverted spheres or some games have used straight up blended textures to fake lights?

As far as I understand it, Doom 3 uses a separate pass for each light source but limits the amount of shading by using depth/stencil test and scissor rectangles to bound the light volume. So the fragment shader is only invoked where the light is visible, same as in a deferred shader.

The big drawback is that each pass needs to resubmit at least some of the geometry to the GPU for each pass. There could be some high level culling to remove meshes that are completely untouched by a light source but it'd be crude and relatively inefficient. AFAIK Doom 3 was before any kind of instancing was an option so it also had to perform transformation on the geometry.

And I think for light volumes that aren't well bounded by a scissor rectangle there'd be some overhead since even hi-depth/z isn't totally free.
 
Scissor testing to bound lights makes a lot of sense in Doom 3's case (not that I know exactly how you'd do that). And you could certainly do some instancing in '04 using vertex buffer objects
 
I don't see how VBOs in OpenGL 2 enable instancing, and when I say that what I really mean is resubmitting post-transform vertex data in between various state changes. AFAIK this didn't start to show up in extensions until 2011.
 
I don't see how VBOs in OpenGL 2 enable instancing, and when I say that what I really mean is resubmitting post-transform vertex data in between various state changes. AFAIK this didn't start to show up in extensions until 2011.

Ah, ok. Goes to show you how holey my graphics knowledge is.

And thanks for the link, jlippo. That's good stuff.
 
Back
Top