-
Notifications
You must be signed in to change notification settings - Fork 0
Lighting
The addon provides three lighting systems: LightGrid (spatial light sampling), Lightmaps (baked textures), and Point Lights (custom feature). All lighting operations are in the Lighting & Baking panel.
The lightgrid is a spatial grid that stores pre-computed light colours at regular intervals. The game samples this grid at runtime for dynamic lighting on characters and effects.
Binary .dat file, version 3:
| Field | Type | Description |
|---|---|---|
| Version | uint32 | Always 3 |
| Grid Offset | uint32 | Header size (typically 32) |
| Width | uint32 | Grid cells wide |
| Height | uint32 | Grid cells tall |
| Bounds X | float32 | Physical world size X |
| Bounds Y | float32 | Physical world size Y |
| Light Scale | float32 | Global intensity multiplier (0.0–10.0) |
| Fullbright Intensity | float32 | Ambient light level (0.0–1.0) |
| Cell Data | 24 bytes × (W×H) | 6 BGRA colours per cell |
Each cell stores 6 directional colour samples (24 bytes total):
C1 — Directional light sample 1 (4 bytes BGRA)
C2 — Directional light sample 2 (4 bytes BGRA)
C3 — Directional light sample 3 (4 bytes BGRA)
C4 — Directional light sample 4 (4 bytes BGRA)
C5 — Sky/ambient light (4 bytes BGRA)
C6 — Bounce/environment light (4 bytes BGRA)
- Open Lighting & Baking panel.
- Set grid dimensions (default: 256×256).
- Set bounds in world units (default: 12877.52 — Summoner's Rift size).
- Configure light scale and fullbright intensity.
- Click Create LightGrid.
Parameters are stored as scene custom properties.
The bake process samples light at every grid cell:
- Create a lightgrid (or import an existing one).
- Place Blender light objects in the scene (any type: Point, Spot, Sun, Area).
- Mark meshes that block light as Occluder (see below).
- Mark ground planes to skip as Ignore.
- Set sample height (Z offset, default 1.0).
- Click Bake LightGrid.
The baker:
- Iterates every grid cell
- Casts 6 directional rays from the cell centre
- Ray-traces to each light, checking for occluder intersections
- Stores resulting BGRA colours per cell
- Shows progress:
Baking cell 14221 / 65536
| Button | Property | Effect |
|---|---|---|
| Set Occluder | lightgrid_occluder = true |
Mesh casts shadows during bake — rays hitting it block light |
| Set Ignore | lightgrid_occluder = false |
Mesh is transparent to rays — light passes through |
| Operation | Format | Description |
|---|---|---|
| Import LightGrid |
.dat binary |
Load official map lightgrid |
| Export LightGrid |
.dat binary |
Save baked lightgrid for game |
Click Visualize LightGrid to render cell colours in the viewport as coloured dots/cubes.
Click Clear LightGrid to remove all grid data from the scene.
scene["lightgrid_width"] # Grid width in cells
scene["lightgrid_height"] # Grid height in cells
scene["lightgrid_bounds"] # [X, Y] physical bounds
scene["lightgrid_light_scale"] # Intensity multiplier
scene["lightgrid_fullbright_intensity"] # Ambient level
scene["lightgrid_cell_count"] # Total cells
scene["lightgrid_cells_baked"] # JSON with all cell data (RGBA per C1-C6)
scene["lightgrid_cells_preview"] # First 100 cells for UI display
scene["lightgrid_baked"] # Boolean flag
scene["lightgrid_filepath"] # Source file if importedLightmaps store pre-computed lighting as texture atlases applied via UV mapping. Every official League map uses lightmaps for static mesh lighting.
Each mesh can have up to 3 light channels:
| Channel | Use | Description |
|---|---|---|
| Baked | Primary | Static pre-baked lighting |
| Stationary | Unused | Reserved for custom point lights |
| Paint | Overlay | Painted texture data |
Each channel stores:
-
Texture path — e.g.
ASSETS/Maps/Particles/.../bakedlight_srf_001.dds -
Scale — UV scale
(U, V), typically(1.0, 1.0) -
Bias — UV offset
(U, V), typically(0.0, 0.0)
Lightmap UVs are stored in a dedicated UV layer named LightmapUV (mapped to TEXCOORD7 in the mapgeo format).
Click Prepare Lightmap Setup:
- Auto-populates
lightmap_texturepath based on mesh name - Sets scale to
[1.0, 1.0]and bias to[0.0, 0.0] - Marks meshes as occluders
Click Create Lightmap UVs:
- Creates
LightmapUVlayer on each mesh - Runs smart UV projection (66° angle limit, 3% island margin)
- Sets as active render UV layer
Click Remove NO_BAKED_LIGHT:
- Strips
NO_BAKED_LIGHTandNO_BAKED_LIGHTINGfrom material shader macros - Required: materials with this macro ignore lightmap data
Click Bake Lightmaps:
- Switches to Cycles renderer
- Bakes diffuse lighting (direct + indirect)
- Uses OpenImageDenoise for clean results
- Creates image texture per mesh
- Saves as PNG to export folder
Settings:
| Setting | Default | Description |
|---|---|---|
| Resolution | 2048×2048 | Lightmap texture size |
| Samples | 64 | Ray sample count |
| Margin | 2 | Padding around UV islands |
| Selected Only | Off | Process only selected meshes |
| Export Folder | — | Output directory path |
| Game Path | — | In-game texture path root |
Click Export Lightmaps:
- Writes PNG files to the export folder
- Updates texture path properties on meshes
- Files are ready for injection into the game WAD
Use Assign Lightmap Texture to manually set texture paths and UV parameters on selected meshes. This is useful for restoring lightmap settings or pointing to different textures.
Warning: Point lights are not used in official League maps. A scan of 195 mapgeo files found zero meshes using the
stationary_lightfield. This feature is for custom/modded maps only and requires a modified game client or custom renderer.
- Select one or more mesh objects.
- Set light properties:
- Color (RGB)
- Intensity (Watts, default 500)
- Radius (influence radius, default 5.0)
- Z Offset (height above mesh, default 2.0)
- Click Add Point Light.
The addon:
- Creates a Blender Point Light object
- Parents it to the mesh
- Stores properties as mesh custom properties
mesh["point_light_enabled"] # true
mesh["point_light_color"] # [R, G, B]
mesh["point_light_intensity"] # float (watts)
mesh["point_light_radius"] # float
mesh["point_light_offset_z"] # floatClick Export Point Lights to write a JSON file:
{
"version": 1,
"lights": [
{
"mesh": "wall_segment_001",
"position": [100.0, 50.0, 32.0],
"color": [1.0, 0.8, 0.6],
"intensity": 500.0,
"radius": 5.0
}
]
}Select meshes → Remove Point Light to delete light objects and clear custom properties.
Panel: Light Manager (in Lighting & Baking)
Manage scene lights as a group:
| Operation | Description |
|---|---|
| Create Light | Place a new light (Point, Spot, Sun, Area) at 3D cursor |
| Duplicate Light | Copy selected lights |
| Delete Light | Remove selected lights |
| Select by Type | Select all lights of a specific type |
| Toggle Visibility | Show/hide all lights |
| Export Lights JSON | Save all scene lights with properties to JSON |
| Import Lights JSON | Restore lights from a previously exported JSON |
| Property | Description |
|---|---|
| Type | POINT / SPOT / SUN / AREA |
| Name | Light name |
| Power | Energy in Watts |
| Color | RGB colour |
| Radius | Influence radius (Point/Spot) |
| Spot Size | Cone angle in radians (Spot) |
| Spot Blend | Soft edge falloff (Spot) |
| Distance | Custom cutoff distance |
All addon-created lights are tagged with mapgeo_light = true for easy filtering.
from MapgeoAddon.lightgrid_parser import Color, LightGridCell, LightGrid
# Create a colour from BGRA integer
c = Color.from_bgra(0xFF8060FF) # B=255, G=128, R=96, A=255
print(f"R={c.r:.2f} G={c.g:.2f} B={c.b:.2f} A={c.a:.2f}")
# Build a cell
cell = LightGridCell()
cell.c1 = Color(1.0, 0.9, 0.8, 1.0) # Warm directional
cell.c2 = Color(0.2, 0.3, 0.5, 1.0) # Cool fill
cell.c5 = Color(0.6, 0.7, 0.9, 1.0) # Sky ambient
cell.c6 = Color(0.1, 0.1, 0.1, 1.0) # Minimal bounce
# Read a lightgrid file
grid = LightGrid.load("path/to/lightgrid.dat")
print(f"Grid: {grid.width}x{grid.height}, {grid.width * grid.height} cells")
print(f"Bounds: {grid.bounds_x:.1f} x {grid.bounds_y:.1f}")
print(f"Light scale: {grid.light_scale}, Fullbright: {grid.fullbright}")