# Portal system- lights in 2 or more cells

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im implementing a portal scheme to my engine, with shadow volumes...the problem is when a light has it radius such that affects 2 or more portal cells...if I add the lights to the cells, even when im not seeing a cell its light can be hitting the cell im in, so the light will 'pop' when look to portal (like in FarCry, where the lights cannot cross portals)...im thinking in let the light cross at max N portals, so for each cell node, i check for N levels of portals if its lights hits the frustum...i should do a intersection between lights's sphere with the portal polygons, and use this new volume as the tester against frustum... how do u manage this kind of thing? [Edited by - Coluna on July 11, 2005 1:02:32 PM]

##### Share on other sites
Can't you first calculate the portals that the light affects, and then cull these by the camera frustum? Then you won't get any popping.

##### Share on other sites
Alternatively move the Light to a higher node (at worst Root).

##### Share on other sites
Here's what I do.

For the camera and every light in the world, build a tree of visible regions. Each region represents the volume of space that is visible to the camera or to a light in a single cell. The root region of each tree corresponds to the cell that the camera or light is in. For each portal that is visible to the camera or reachable by a light in a particular cell, create a new region for the cell that the portal leads to and make it a child node in the tree bounded by the planes formed by the camera/light position and the edges of the portal.

In addition to knowing what regions correspond to which light source, you'll need to be able to get a list of all light regions for a given cell. You can then walk the visibility tree for the camera, and for each cell determine which lights could be shining into a visible area. Intersecting camera regions and light regions will give you very good culling, but just knowing which lights shine into the visible cells is good enough to render everything correctly.

Since the light regions are arranged as a tree, you can walk up any of the trees from the light regions in the visible cells to their roots so that you can find any cells between what you can see and the light source. This is necessary for finding objects that aren't visible themselves, but could be casting shadows into an area that is visible.

I know that this is just a high-level overview -- the implementation details are very complicated and require a lot of good structural engineering. I'm thinking of talking about it in more detail at GDC 2006.

-- Eric Lengyel

##### Share on other sites
Thanks for replying! MumbleFuzz, if i cull the portals instead of lights, a light that its cell is in a portal behind the player wont be processed, even if its radius is greater than the distance to camera....and Eric, i hope u release some paper of your techniqe....
im planning in doing like i said...recurse N levels to neighbour cells and do frustum culling with camera and light sphere (maybe use the volume from light position->portal polygon)...i know its not the best solution, but its simple and works...any other ideas?

##### Share on other sites
Quote:
 if i cull the portals instead of lights, a light that its cell is in a portal behind the player wont be processed, even if its radius is greater than the distance to camera
Sorry, I should have been more specific. You certainly need to take that into account.

I forget the details of my implementation, but I used a method similar to Eric's. I think I used a boolean array to represent the visible regions, though, and used some slightly unintuitive recursive functions. A tree sounds like a much better idea.

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011793
• ### Who's Online (See full list)

There are no registered users currently online

×