In this image of my simple scene there are 2 point lights that uses deffered rendering. The problem is what the 2 red arrows point to. The artifacts seem to be caused by the 2 spheres I use as my light volumes clipping each other. I use additive blending(one-to-one) to combine the lights. Is there a way to get rid of the 2 objects clipping each other like that?
Please give us some more details about how you actually render the lights in your light pre-pass (deferred lighting) solution.
Do you render the point lights as spheres in the object space? Or you use some solely screen space solution and lay down some mask in the stencil buffer before that?
It is very difficult to answer your question without more detail.
I’m using opengl 3.3;glsl 330.
I render sphere geometry in object space to represent my light volume. I project it into screen-space and use it to define my texcoords so that the area that the sphere covers renders the correct part of the texture stored in the other parts of my g-buffer(normal,depth buffer).
my calculations are done in world-space.
I do additive blending [one to one]. I had tried keeping the blending limited to the framebuffer but it seems I can only do that in opengl 4.x.
Any ideas would be appreciated.
Can you give us a screen shot where the light sphere geometry is also visible e.g. as a wireframe?
At first look it seems that there is some problem with the attenuation factor, at least such problems are usually the source of such large gradient cliffs, however, this is just speculation as it is very difficult to figure out what is the problem without visualizing the light volumes.
Here it is:
I know that the light volumes are huge but I had originally done it to make sure that the lights would blend together correctly. I noticed also that you can follow the wire and see that the artifact match’s up with it.
I know it sounds weird but in your case the problem seems to be that the light bounding volume has some triangles that shouldn’t be there, that’s why there you can see the two bright areas.
Here you can see what I mean:
In case of the blue sphere I even marked the correct triangles with grey (they are correctly there), however, there is one more edge marked with red (the same with the green sphere, both marked with an arrow).
So it seems the problem is with your sphere geometry. Please double-check it, especially where the latitudinal strips start/end.
Thanks for the hint! It’s very possible since I auto generate the sphere myself instead of loading from a file. I didn’t really have a reliable loader until recently.
Yep that was the problem!! It was very easy to fix. I didn’t really notice since I didn’t think to check the wireframe. It was starting to get annoying when I started working on importing objects.
I’m happy that I was able to help. Feel free to ask about anything else if you need help. I’m particularly familiar to deferred rendering techniques, no matter if it is deferred shading or deferred lighting, however, personally I prefer the former, but obviously, if you don’t need much variation in your lighting equation, deferred lighting (or light pre-pass if you like this term better) is more lightweight as it does not need a “fat” G-Buffer.