Light Probe

From Reflex Wiki
Jump to: navigation, search
Reflex Light Probes Inside Volume
Reflex 8,000 Wasted Probes in Blank 3D Space
Reflex 10,000 Wasted Probes via Separated Rooms
Reflex Wasted Volume Matters
by Devil
Synopsis
The more compact and neatly organized you can make the total volume of your map the better it is for the lighting engine.

Light Probes Explained

Light Probes by default are spaced 64 units apart in 45 degree angles in any direction on its 64u grid. Spacing can be changed with the cvar r_lm_probe_seperation. They sample light bounces during the light map building process and calculate how much light should be provided to the 3D space it is sampling. They are simply put; lighting samplers. Light Probes will automatically detect all brush work in your map and cover every possible corner of your entire map area. They will scale across every possible used corner of your map in an attempt to make a 3D box that will include every brush in your map. If you accidentally allow an errant brush to get away from you out into 3D space; your lightmap build time will be affected because the light probes will scale all the way out to that brush. The less light probes you have the more efficiently your lightmap will build. Probes will sample the interior of some brushes too. If the interior of a brush happens to intersect with the 64u spacing of a light probe then the interior of a brush will get sampled. Unless you use dev_nolight and at least a 32u thick exterior wall then there is a good chance that a light leak will occur. This is how light leaks happen, it is because the interior of brushes are sampled too not just the exterior brush faces, otherwise the interior of all brushes would be pitch black. If you have ever flown through a brush in editor mode you know it is not pitch black even after the lightmap is built.

Wasted Light Probes

For the purposes of optimization it is better to build rooms side-by-side either using a common wall or two walls very close to each other. Avoid creating separated rooms that require a teleporter to go from one room to another. Separating a room into 2 distinctly separate rooms in 3D space means wasted space. Wasted 3D space in Reflex automatically means wasted light probes. Because light probes go from corner to corner of the most distant brushes in your map any blank space in between is automatically filled with light probes. By joining the two rooms together you will save thousands of lightprobes. In the example test map it only improved by a few seconds when building the lightmap. Most maps will be much more complex but have about the same volume so you can expect a few percent of improvement. Any improvement is an improvement though.

Volume Matters

Volume is a hard concept to think about when you are trying to be creative but at some point it has to become a consideration otherwise your lightmap build time could stretch past an hour if you have a really large map. Trust me, waiting an hour every time you want to work on lighting is a huge deal. Light probes basically touch every brush both on the inside and outside of a surface therefore they are consuming a volume and it can be calculated. The bigger the volume the more lightprobes will be created to fill it using the default 64 unit grid. Think of light probes as water that covers every brush face and fills every brush in your map. The more volume the larger your map is. When it comes to lighting, light maps, and light probes it is all about volume. The less volume you consume and the more efficient your layout is the better the lighting engine will perform especially when it comes time to build your lightmap. The trick to optimizing your map is to reduce the total volume. Sometimes that can mean moving entire rooms around and fitting them together like tetris pieces so that you waste as little volume as possible while still keeping everything you want to be in the map. There is a limit to how much volume you can take up before the engine starts bogging down with drawcalls and lightcalls affecting your FPS to an unplayable rate. Optimizations are important to large map designs and this is just another trick you can use to help your map run as efficiently as possible.

Light Probe vs Dev_Nolight Optimization

Light probe optimizations are no where near as effective for your lightmap build time as using dev_nolight. If we take the example images on the right and build the lightmap it takes about 336 seconds. That same exact map reworked completely with nolight takes only 163 seconds to build.

Light probe optimization is actually a very small optimization. It will only provide very limited gains. There are gains to be had depending on how you originally started organizing the rooms in your map. If you separated rooms distantly from each other then you will only see a small improvement in lighting lightmap build time, by a few percent. If you have not separated your rooms and everything is organized neatly then you will not see any gains from light probe optimization. Using dev_nolight is easily 2 times more effective in reducing lightmap build time than light probe volume optimizations alone. It is better to tackle light probe optimizations only after you have done a dev_nolight optimization of your map.