Prowl’s lighting system is built around a frame-collected light list: everyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
Light component calls RenderPipeline.AddLight(this) in its Update(), and the DefaultRenderPipeline processes that list at render time to build a GPU-side structured buffer (_Lights) that shaders read for PBR calculations and soft shadows. Four concrete light types are available — DirectionalLight, PointLight, SpotLight, and AreaLight — alongside scene-level parameters for ambient illumination and fog that are applied globally via PropertyState.
The Light Base Class
All lights extend the abstractLight : MonoBehaviour class, which defines the properties common to every light type.
color
Linear HDR color of the light. Combine with
intensity for physically based values.intensity
Brightness multiplier in scene units. The default of
16.0 is a reasonable daylight value for an HDR pipeline.castShadows
Toggle per-light shadow rendering. Shadows are rendered into the shared
ShadowAtlas texture.Directional Light
DirectionalLight models an infinitely distant light source (sun, moon). All rays are parallel, so position is irrelevant — only the GameObject.Transform.forward direction matters. It casts orthographic shadows over a configurable shadowDistance.
DirectionalLight Shadow Properties
| Property | Type | Range | Description |
|---|---|---|---|
shadowResolution | Resolution enum | 512–4096 | Shadow map texel resolution |
shadowDistance | float | 10–512 | Orthographic frustum half-width/height (world units) |
shadowRadius | float | 0.001–4 | Penumbra size for PCSS soft shadows |
qualitySamples | int | 8–32 | PCF sample count — higher is softer but slower |
blockerSamples | int | 8–32 | PCSS blocker search sample count |
Point Light
PointLight emits light equally in all directions from a single world-space position, attenuating over radius units.
Point lights do not currently cast shadows in the
DefaultRenderPipeline — GetShadowMatrix returns identity matrices. They are still fully lit with per-pixel PBR calculations.Spot Light
SpotLight emits a cone of light from its position toward Transform.forward. The cone is defined by angle (cosine of the half-angle) and falloff (soft inner cone cosine), with range capped at distance.
angle and falloff are stored as cosine values (0 = 90°, 1 = 0°). A value of 0.97 corresponds to roughly a 14° half-angle. To convert from degrees: MathF.Cos(MathF.PI * degrees / 180f).Area Light
AreaLight is a rectangular emitter — useful for windows, monitors, or fluorescent ceiling panels. Shadow casting is not implemented for area lights; set castShadows = false.
Shadow System: ShadowAtlas
All shadow maps share a singleRenderTexture atlas. Prowl allocates atlas tiles dynamically each frame based on light distance from the camera — closer lights get higher-resolution tiles.
How the ShadowAtlas works
How the ShadowAtlas works
The atlas is a single large The atlas texture is bound as
R32_Float depth texture. Its size is either 8192×8192 (if the GPU supports it) or 4096×4096. The atlas is divided into 32-pixel tiles. Each shadow-casting light reserves a block of tiles proportional to its rendered resolution. At the start of every frame the atlas is cleared and all reservations reset._ShadowAtlas in shaders, where the Standard.shader reads it for PCSS soft shadow calculations.Scene-Level Ambient Lighting
Ambient light is configured on theScene object via Scene.Ambient (AmbientLightParams). The render pipeline reads this each frame and sets global shader uniforms (prowl_AmbientColor, prowl_AmbientMode, etc.).
- Uniform Ambient
- Hemisphere Ambient
A single flat color fills all shadowed areas. Fastest and suitable for most games.
Fog Parameters
Fog is also defined per-scene inScene.Fog (FogParams). Three exponential and one linear mode are available.
| Mode | Description |
|---|---|
Off | No fog |
Linear | Linear interpolation between Start and End distances |
Exponential | exp(-density * distance) |
ExponentialSquared | exp(-(density * distance)²) — default |
Fog uniforms are set as globals (
prowl_FogColor, prowl_FogParams, prowl_FogStates) by DefaultRenderPipeline each frame. The Standard.shader automatically reads and applies these. Custom shaders must #include "Prowl.hlsl" and use the PROWL_FOG_COORDS / PROWL_APPLY_FOG macros to participate in the fog system.Procedural Sky
TheDefaultRenderPipeline renders a sky dome using the built-in ProceduralSky.shader when a camera’s ClearFlags is set to CameraClearFlags.Skybox. The sky is drawn after opaque geometry using the sky dome mesh (SkyDome.obj), driven by the first directional light’s direction to calculate sun position and atmospheric scattering.