4
\$\begingroup\$

I have already a system that at the moment handle multiple lights just passing an array of light struct and loop through it. I had been told to switch to a multipass rendering approach. How should I do this in an efficient way? Can you link me to some resources about this?

I cannot switch to defferred rendering.

\$\endgroup\$
3
\$\begingroup\$

I'm not exactly sure what you want to hear, but I think deferred lighting is still the best for many light sources. The way you do that is that first you gather all the geometry properties by rendering the scene without any lighting at all. You basically render the scene in 4 versions into a buffer called G-Buffer: color, normal, depth, position. You may want to have more layers in your G-Buffer, like specular maps, and other information that you might need to get more control over the material properties. With that information you're able to calculate the lighting easily as before, just this time not for every texel but only for every fragment on the screen. This saves a lot of calculations. Another way to make that more efficient is now to render the lights as spheres into another buffer, where as the sphere size is calculated by the lights power and thus the effect radius, to determine which fragments to calculate lighting for.

I think this tutorial does a great job explaining how it works: http://ogldev.atspace.co.uk/www/tutorial35/tutorial35.html

\$\endgroup\$
  • \$\begingroup\$ Go to deferred rendering would mean change to much of the current system I have which is not exactly small. \$\endgroup\$ – juan_morata Jul 23 '14 at 14:59
  • \$\begingroup\$ I'm sorry to hear that. It's about the only efficient way I know and I don't think there are a lot more alternatives, maybe Forward+, but that seems more complicated to me. Anyway, maybe you find a new way of doing that :) \$\endgroup\$ – rfreytag Jul 23 '14 at 16:13
0
\$\begingroup\$

I am not super familiar with the topic but I did do a little digging for you to try and come up with some easy to understand tutorials or articles. I hope you find at least one of these useful to you. I tried to avoid links that used deferred rendering.

Link One

Link Two

Tutorials

Advanced Rendering in OpenGL

Random Tutorial Website

\$\endgroup\$
  • \$\begingroup\$ Sorry but I couldn't find what I needed in those links, but thanks for the reply anyway \$\endgroup\$ – juan_morata Jul 23 '14 at 15:20
  • \$\begingroup\$ You're welcome. Sorry I couldn't be of more help. \$\endgroup\$ – Benjamin Anderson Jul 23 '14 at 15:59
  • \$\begingroup\$ All of these links describe the old, deprecated fixed-function pipeline. Since the question was tagged with glsl and mentions efficiency, it's safe to say @juan_morata is not interested in glLightf, et al. \$\endgroup\$ – bcrist Jul 23 '14 at 18:33

Your Answer

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

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