This is an experimental tool for baking 3D model lightmaps for the Nintendo 64. It takes in a GLTF model with a single lightmap texture and represents its colors using vertex colors. It doesn't work very well yet.
At least python 3.9.9 is needed.
python -m venv venv
. venv/bin/activate # activate environment on Linux
# venv/Scripts/activate # activate environment on Windows
pip install -r requirements.txt
python baker.py examples/cornellbox/cornellbox_tessellated.gltf --show
See the baking guide.
You can use any GLTF loader (in theory) or this simple binary model loader that only supports per-vertex position + RGBA colors.
- Only a single UV map is supported
- Very slow on lightmaps larger than 1024x1024
- Mesh needs to be in a single "GLTF primitive". Use a single material for everything.
- Smoothing value behaves weirdly
- If mesh has normals, Blender's GLTF export often duplicates vertices, leading to a faceted look.
- So make sure you export with Normals: Off
Based on the 2011 Least Squares Vertex Baking paper by L. Kavan, A.W. Bargteil, P.-P. Sloan.
MIT