0
\$\begingroup\$


I'm currently playing with writing a rendering engine and implementing a forward rendering pipeline.
I have few doubts on how things should be implemented regarding the render passes as-well as the rendering of multiple lights.

So I'm wondering what is the better approach here:

  1. Uber shader that is generated dynamically to adjust for the number of lights that currently affect the active scene. This have the nice benefits of only one render pass for the lighting shader so much less binding occurs which is a plus.
  2. have separate lighting shader for each type of light and have a render pass for each mesh with each type of light, combining in the end the result of (possibly 2 render target that we ping-pong between) with additive blending. This have the nice benefits of separation and more modular and maintainable shader code, but in the other hand the're more render passes and more binding going on and not to mention the ping-pong of additive blending between the render targets.
  3. Other Ideas that I didn't heard/thought about and would love to hear

Ofcourse there's always room for optimization of both techniques such as ocllusion test, test which point/spot light affect which mesh (relevant to the second technique).

So I'm wondering what is the take on it of modern rendering/game engine and maybe I didn't list what their approach is and would love to hear about it.

Also if you side for one technique or another would like to have your thoughts on the pros and cons.

Thanks in advance!

\$\endgroup\$
  • 1
    \$\begingroup\$ Regarding your curiosity about how game engines approach this, have you taken inspiration from their published documentation on the matter? Be prepared that in game development, we rarely have one unambiguously "best" implementation, just a lot of possibilities with different trade-offs that might be better or worse for the needs of a particular project or the development style of a particular team. So you may do better just running with an idea that sounds good to you, rather than waiting for strangers to pick one for you. \$\endgroup\$ – DMGregory Apr 27 at 16:31
  • \$\begingroup\$ @DMGregory Hey thanks for the link. I'm not looking for people to pick a technique for me, I'm more interested to hear about "people who've been there and done that" and have a recommendation about one thing over another and so I could be biased in to reading and delving in to one technique over another since implementing them all and then seeing what works best for me is not an option it'll be a waste of time. Also I've just found about clustered rendering (Doom 2016, JC3) and it looks interesting. \$\endgroup\$ – Jorayen Apr 28 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.