BGLPBD files (Binary Graphics Light Probe Bake Data) are AAMP files used in Mario Kart 8 and Mario Kart 8 Deluxe. They contain cached light probes used to render global illumination in tracks. In Mario Kart 8 they are found within each track's folder with the name course.bglpbd. In Mario Kart 8 Deluxe, they're compressed using Yaz0 into SZS files, named course_bglpbd.szs.
File Format
The file format is no different from other AAMP files.
Structure
BGLPBD files found in Mario Kart 8 and Mario Kart 8 Deluxe consist of a root AABB voxel-based grid that can be subdivided in more sub-grids. These files make use of spherical harmonics in order to render global illumination on drivers, vehicles, items and some course objects
Root structure
Parameter name |
Description
|
root_grid |
Contains information about the root AABB grid.
|
param_obj |
Version, number of grids and global lighting parameters.
|
root_grid
Parameter name |
Type |
Description
|
aabb_min_pos |
Vector3f |
Minimum point of the root AABB grid.
|
aabb_max_pos |
Vector3f |
Maximum point of the root AABB grid.
|
voxel_step_pos |
Vector3f |
Voxel subdivision size. The grid is divided in n voxels of this size.
|
param_obj
Parameter name |
Type |
Description
|
version |
UInt32 |
BGLPBD version. Always 1.
|
dir_light_indirect |
Float |
Direct light indirect effect scale.
|
point_light_indirect |
Float |
Point light indirect effect scale.
|
spot_light_indirect |
Float |
Spot light indirect effect scale.
|
emission_scale |
Float |
Emission effect scale.
|
used_box_num |
UInt32 |
Number of used sub-grids.
|
Sub-grid
Each AABB sub-grid (named b_ followed by its index number) consists of a buffer of light probes per voxel. It contains its own structure and parameters.
Sub-grid structure
Parameter name |
Description
|
param_obj |
Grid index and type.
|
grid |
Contains information about the AABB voxel sub-grid.
|
sh_index_buffer |
Buffer of indices used to determine which light probes are used in each voxel.
|
sh_data_buffer |
Buffer of light probe spherical harmonic values stored as single-precision floats.
|
param_obj
Parameter name |
Type |
Description
|
index |
UInt32 |
Index of this sub-grid.
|
type |
UInt32 |
Grid type. Always 0.
|
grid
Parameter name |
Type |
Description
|
aabb_min_pos |
Vector3f |
Minimum point of this AABB grid.
|
aabb_max_pos |
Vector3f |
Maximum point of this AABB grid.
|
voxel_step_pos |
Vector3f |
Voxel subdivision size. The grid is divided in n voxels of this size.
|
sh_index_buffer
Parameter name |
Type |
Description
|
type |
UInt32 |
Buffer type. Always 1 (index buffer).
|
used_index_num |
UInt32 |
Number of used indices. This number determines how many of the voxels' indices can be used for light calculations.
|
max_index_num |
UInt32 |
Number of total indices (n).
|
index_buffer |
UInt32[n] |
Buffer of light probe indices. This buffer contains 8 integers per voxel (presumably one per vertex). They are assigned to the float arrays from the light probe data buffer.
|
sh_data_buffer
Parameter name |
Type |
Description
|
type |
UInt32 |
Buffer type. Always 0 (data buffer).
|
max_sh_data_num |
UInt32 |
Number of total light probes (n).
|
used_data_num |
UInt32 |
Number of used light probes.
|
per_probe_float_num |
UInt32 |
Number of spherical harmonic values per probe. Always 27.
|
data_buffer |
Float[n] |
Buffer of light probe spherical harmonics. This buffer consists of 27 floats (3 for each of its 9 coefficients per spherical harmonic) per light probe.
|
Tools
The following tools can handle BGLPBD files: