So, this is a real time, per-pixel lighting engine. Performance can be a total nightmare, even on the PC.
- Keep your spaces tight and twisty, lots of narrow apertures for double-portals. Two portals snapped to the geometry fairly close to each other (like on either side of a thick door frame) really help force the renderer to only render what you can actually physically see.
- Keep your number of true shadow-casting lights low, like 2 to 3 in a room. (You can change lights from shadow-casters to simple fills by altering the FleshLightType property. You'll find it.)
- Keep the radii of these as low as you possibly can because the larger they are, the more objects and BSP surfaces they strike. You want to minimize overlap between shadowcasters, as well, because almost nobody even sees the weaker shadow that an object casts, it's a big waste. Keeping the radii low is conducive to that purpose.
- Supplement these with dim 'moonlight' lights that don't have a lot of effect on the light gem (LightType OmniNoShadow, I believe)
- Static meshes, when placed in game, default to *not* cast a shadow. This is a very good thing, and will save you frame-rate. Once you've lit the space how you want it, then walk through it, and turn meshes that *must* cast a shadow on, one by one. Ignore the rest, as your players won't notice or care if some ugly sliver-shadow on a mostly-embedded wooden beam is missing. (you turn on mesh shadows by adding a property to the object, under the Render sub-head, as I recall.)
- BSP, on the other hand, needs to have shadows manually toggled off for each surface. Fortunately, there's a select-all command, and a select-all-coplanar command, etc. I periodically selected all the BSP surfaces in my level, and turned shadowcasting off on all of them -- once again, walking through and fixing cases where it looked wrong, such as a surface that has a door cut into it, or a hatch, etc. The reason you do this is that big BSP surfaces project MONSTROUS, WORLD INGESTING STENCIL SHADOWS into the void when struck by a shadowcasting light (one for each light!) even when you can't see them at all. That's one of the biggest performance hogs of all.
- Distance fog is a separate rendering pass on everything. That can hurt. Some maps don't even need it. Use when you must, bail if you can make it look good. Horror experiences, for example, work better with pure-black contrasty shadows anyway, and fog washes them out.
- Try to balance your polygon density (static meshes) in full knowledge of the fact that you're paying for *tons* of polygons worth of shadow volumes. Even on the PC, Thief maps won't be able to be chock-full of objects or architectural detail unless you literally plan to have no dynamic shadows.
- Torch guards are a big investment. They can travel anywhere, adding a whole new rendering pass to any object struck by their torches. If you use them, keep their stomping grounds even more conservative, lighting-wise.
Good luck, all. Just thought I'd throw some of that out there to help prevent some of the the 'my god, I'm getting 5 FPS, and my map is only six rooms' posts we're likely to see.
Back to T3ed Tutorials