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

Discussion in 'Beginners Zone' started by inlimbo, Mar 26, 2017.

  1. inlimbo

    Newcomer

    Joined:
    Feb 16, 2007
    Messages:
    161
    Likes Received:
    11
    Meaning a like-for-like match in number of lights, but using hardware lighitng and multipass rendering. Roughly what's the performance hit?
     
  2. MDolenc

    Regular

    Joined:
    May 26, 2002
    Messages:
    684
    Likes Received:
    410
    Location:
    Slovenia
    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...
     
    DavidGraham likes this.
  3. inlimbo

    Newcomer

    Joined:
    Feb 16, 2007
    Messages:
    161
    Likes Received:
    11
    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?
     
  4. Exophase

    Veteran

    Joined:
    Mar 25, 2010
    Messages:
    2,406
    Likes Received:
    425
    Location:
    Cleveland, OH
    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.
     
  5. inlimbo

    Newcomer

    Joined:
    Feb 16, 2007
    Messages:
    161
    Likes Received:
    11
    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
     
  6. Exophase

    Veteran

    Joined:
    Mar 25, 2010
    Messages:
    2,406
    Likes Received:
    425
    Location:
    Cleveland, OH
    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.
     
  7. jlippo

    Veteran Regular

    Joined:
    Oct 7, 2004
    Messages:
    1,183
    Likes Received:
    239
    Location:
    Finland
  8. inlimbo

    Newcomer

    Joined:
    Feb 16, 2007
    Messages:
    161
    Likes Received:
    11
    Ah, ok. Goes to show you how holey my graphics knowledge is.

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

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...