Lighting
Lighting is the most important aspect of making a scene look good.
Physically Based Rendering
There are many formulas for computing lighting on surfaces. The defacto industry standard, which is also used in ezEngine, is Physically Based Rendering (PBR) which describes a surface in terms of color, the surface normals, its roughness, whether it is a metal. Using this data, very convincing lighting can be computed.
Therefore the standard type of material requires you to provide such textures. Optionally an occlusion texture can pronounce the lighting for small crevices.
Static vs. Dynamic Lighting
Many games differentiate between static or baked lighting, and dynamic lighting. Static lighting is precomputed and typically stored in lightmaps (dedicated textures) and other data structures. Dynamic lighting does not require any preprocessing or extra data. Baked lighting typically has the advantage that it can look much better because it can simulate light bounces and thus illuminate areas that are not directly lit.
Currently ezEngine only supports dynamic lighting. That means every light source that you add to the scene can be moved around and change its color or brightness. It also means that every light source has a performance cost. The renderer uses a clustered forward rendering approach which can handle a relatively large amount of light sources efficiently. The most important rule is to reduce the number of overlapping light sources. The editor render modes allow you to look for hotspots.
Shadows
Dynamic lights have the disadvantage that they don't provide shadows by default. Instead, casting shadows is a separate process, which costs a lot of performance for every light source involved. Therefore, each light source requires you to decide whether it should cast shadows or not. You can use many small fill lights, as long as they don't cast shadows, but you should keep the number of shadow casting lights as low as possible, and each light should only cover an area as small as possible.
For more details see the chapter about dynamic shadows.
Light Component Types
There are different component types to provide different types of lighting:
- Ambient Light Component: For lighting up a scene in general.
- Directional Light Component: For sun/moon light.
- Point Light Component: For light bulbs and overall fill lights.
- Spot Light Component: For flashlights and directed lighting.
- Sky Light Component: For dynamic light contribution from the sky.
- Reflection Probe Components: For localized reflection probes.