Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

Deffered Shaing sending multiple source of light to shader

$
0
0

I wrote a simple deferred shading shader for my engine, and I send light-sources to the shader like this:

struct Light {
    vec3 Position;
    vec4 Color;

    float Linear;
    float Quadratic;
    float Radius;
};

const int NR_LIGHTS = 4;
uniform Light lights[NR_LIGHTS];

well this works when I have fixed number of lights, but this wouldn't be a good idea with many light sources as we do have limits with number of uniforms and when the number of lights are dynamic.

I am using OpenGL 3.3, what is the best way of sending several light-sources to a shader.

 


Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>