Search code examples
openglrenderinglightblending

Order of light calculation on scene


Does lights (or their type) order on scene matters?

I'm working on forward renderer using OpenGL and I have different results (shadow color) depending on lights order (each light got it's own pass with additive blending)

enter image description here enter image description here


Solution

  • I used wrong order of configuring rendering pipeline:

    bind framebuffer
    set viewport & clear buffers
    depth stage settings
    blending settings
    other rasterizer settings
    

    I've moved set viewport & clear buffers to the end. Now everything looks the same regardless of the lighting (render pass) order.