Point light clipping
#1 Members - Reputation: 304
Posted 11 November 2012 - 10:05 AM
I'm building a simple indoor level that is lit using point lights. The renderer uses deferred lighting. I have problems with point light placed near walls and corners to that influence/illuminate the next room/wall. I need a point light placed in a room to only illumunate the room it belongs to.
How can I achieve such thing in a matter of speed and simplicity ? Do I need to send some kind of "influence box" corners to the pixel shader and clip lit pixels aganst it in the shader ?
Thank you in advance.
#2 Members - Reputation: 3503
Posted 11 November 2012 - 10:55 AM
Or you can have the point lights be attached to each room model, and then draw each room as a separate model with only it's own lights.
#3 Members - Reputation: 505
Posted 11 November 2012 - 11:30 AM
So if you have a light source next to a wall, the custom light mesh would be half a sphere with a disc closing the sphere to the wall.
As I said, my memory is a bit foggy on this, but if you look over crytek's major presentations/papers you should find it.
#4 Members - Reputation: 304
Posted 12 November 2012 - 05:27 AM
I'll try to stay away from additional meshes for now. I implemented simple axis aligned boxes that enclose light areas and it works almost fine, but since they are axis aligned, the rooms in the level should be also axis aligned if the need to be lit with such lights. Probably I should transform the boxes later on, and pass the matrix to the pixel shader to transform the world position of the pixel being lit to the space of that transformation matrix.
#5 Members - Reputation: 4606
Posted 12 November 2012 - 06:24 AM
My engine is capable of rendering lot of light visible sources (>100), in this case I use it to assign several point lights to a logical light source. I.e. instead of one strong point light for a torch, I use 1 main point light with limited radius to avoid most of the light bleeding and a few fill lights, with an offset reaching into the room to give it an ambient light distribution. The fill lights don't affect the specular component to prevent multiple hi-lights, only the diffuse.
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
#6 Members - Reputation: 304
Posted 14 November 2012 - 12:30 AM
I don't wanna use Daaark suggestion because my level geometry won't let me. I can't break the level to separate rooms, based on lamps they have placed into.
Right now I use lights clipped against axis aligned boxes, that are properties of the lights. When I need the light to bleed into another room from a door or something, I use cube shadowed light or spot light with shadows.That way light won't bleed from a closed door etc..
Ashaman73, as I understand it, you are modeling some kind of "area" light with small point lights. That is sure a good idea - my engine is also deferred light count isn't that crucial.
I'm thinking about these things. :
1.Use geometry to simulate "area" lights. For example, a box encloses the lights influence to the boundary of the room, and another small box reaches from the open door to illuminate the corridor. At the time of rendering, render those boxes that belong to the light in question.
In the pixel shader, sample the G-Buffers with the screen position of the pixel being processed. Use lights usual attenuation. Gotta try this one. It is pretty close to what @Ohforf sake suggested about crytek.
2.Use light attenuation maps/textures. Right now I use 1D attenuation map to make the lights attenuation flexible and to avoid complex and expensive function in the shader. What about 2D attenuation maps, or even 3D cube maps ? Light propagate only where the 2D map ( for example in X/Z plane) allows. Want the room light to also illuminate the corridor without illuminating the next room, just draw it
What do you think. Am I missing something that would render those methods unpractical ?
#7 Members - Reputation: 4606
Posted 14 November 2012 - 12:46 AM
Really closeWhat about 2D attenuation maps, or even 3D cube maps ?
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
#8 Members - Reputation: 304
Posted 14 November 2012 - 02:58 AM
But man, with all those dynamic and per pixel lightings and stuff, sometimes I'm missing the light maps from the past..and the nice and fast illumination they offer..
#9 Members - Reputation: 4606
Posted 14 November 2012 - 05:00 AM
Lightmaps are still often used in current gen (e.g. UDK,Source), though the next generation of engines (and hopefully consoles) will start to support dynamic global illumination.But man, with all those dynamic and per pixel lightings and stuff, sometimes I'm missing the light maps from the past..and the nice and fast illumination they offer..
Lightmaps are almost the optimal solution if you have a small,static scenes, performance and qualtiy wise, but once you start to use dynamic scenes, lightmaps get really quickly clumpsy. As said, I've similar issues with my game and I'm still looking for some good (fake) solutions.
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
#10 Members - Reputation: 304
Posted 14 November 2012 - 09:09 AM
1. I have a WYSIWYG editor and they need slow preprocessing.
2.I need dynamics scenes with physics objects, including light properties animation( flicker, color cycle etc.) and dynamic shadows.
3.I use geometry instancing and in other words reuse mesh data and render an instance in several places. I'm not sure how a light map could be made to cope with a city in which any other building is a mesh reference or instance.
4. I need outdoor scenes with trees, sunlight and shadows. I'm not sure if a single lightmap could cope with a big scene and shadow and overall lighting quality.
5.Lighting quality is seems to be per-texel, not per pixel and I will probably need big lightmap textures and lots of vid RAM for big scenes.
#11 Members - Reputation: 505
Posted 14 November 2012 - 12:51 PM
http://advances.realtimerendering.com/s2010/Kaplanyan-CryEngine3(SIGGRAPH%202010%20Advanced%20RealTime%20Rendering%20Course).pdf
They call it "Clip Volumes" (see slides 68 - 74).
Edit: Fixed broken link.
Edited by Ohforf sake, 14 November 2012 - 12:56 PM.






