OpenGL: rendering over 8 lights, how?

How do I implement more than 8 lights in OpenGL?

I would like to make an unlimited number of lights effectively.

So what is the preferred method for this?

+6
c ++ opengl
source share
2 answers

Deferred shading.

In a nutshell, you shoot your scene without any lights. Instead, you save the normals and world positions along with textured pixels into several frame buffers (so-called rendering goals). You can do this in one go if you use multiple render extensions.

After you have prepared the buffers, you will begin to display a bunch of full-size ATVs, each of which has a pixel shader program that reads normals and positions and calculates light for one or more light sources.

Since the light is additive, you can display as many full-screen quads as possible, and also accumulate light on as many light sources as you want.

At the last stage, a composition is created between your light and the unlit textured frame buffer.

This is a more or less modern way of doing this. However, the fog and transparency that work with such a system is a problem.

+14
source share

OpenGL Lights is a simplified system that, as far as I know, is already in an obsolete list. You must control the light by writing a shader . Take a look here .

+7
source share

All Articles