0
$\begingroup$

Ok so I am trying to understand how to combine these 2 techniques and I am failing.

The main goal is to reach the O(lights+fragments) complexity of deferred rendering, instead of O(lights*fragments) of naive/forward rendering.

This is how I am currently doing things:

Say we have n lights. Then we generate n shadow maps O(n)

Now we do one render pass to generate the normal, diffuse color, depth.... information in the geometry buffers.

Then we check for every fragment whether it is occluded in ALL lights. and shadow it if it is.

This has an O(Lights*Fragments) complexity, which is wrong, so how can you reach the ideal asymptotic complexity? What should you do?

$\endgroup$

1 Answer 1

2
$\begingroup$

Deferred rendering does not have an asymptic complexity of O(lights+fragments). It has a complexity of O(fragments+visibleFragments*lights).

What you are doing in deferred rendering is preventing having to calculate lighting for many fragments that cover the same screen pixel. Once you have found which ones are visible, all of those still have to calculate lighting from every light source.

This is faster than forward rendering on the premise that lighting calculations are heavier than geometry calculations and that most fragments are ocluded by other fragments.

$\endgroup$
5
  • $\begingroup$ Not necessarily. The main lights that cover the whole scene need to be done for each pixel, right enough. But the less-important lights that only affect a small local area can be rasterized as geometry, and a pixel shader run additively over just their area of effect. Good illustration of this technique used in GTA5 at adriancourreges.com/blog/2015/11/02/gta-v-graphics-study-part-2 (last 2 slides) $\endgroup$
    – russ
    Commented Feb 27, 2018 at 5:25
  • $\begingroup$ @russ that is not really related to my answer or to the nature of deferred shading. What you propose is just a technique for LODing distant light sources $\endgroup$ Commented Feb 27, 2018 at 5:30
  • $\begingroup$ Did you look at the last couple of slides where they're rendering the streetlamps and car lights at night? I'm not talking about the billboarding of distant light sources, rather the technique of rasterizing a sphere, cone, or whatever that covers a light's area of effect, and running an additive pixel shader only for the pixels it covers. $\endgroup$
    – russ
    Commented Feb 27, 2018 at 7:08
  • $\begingroup$ Seems the term I'm looking for is 'Light Volumes'. Better illustration here - spellcasterstudios.com/?p=339 $\endgroup$
    – russ
    Commented Feb 27, 2018 at 7:25
  • $\begingroup$ @russ ah i see what you mean. I will edit my answer to touch on that subject later. $\endgroup$ Commented Feb 27, 2018 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.