← ClaudeAtlas

bake-lightinglisted

Use when a PlayCanvas scene's static lighting, shadows, or ambient occlusion costs too much per frame, or lighting must ship precomputed for startup or payload budgets.
playcanvas/skills · ★ 15 · AI & Automation · score 80
Install: claude install-skill playcanvas/skills
# Precompute static lighting Static geometry lit by static lights can bake into lightmap textures once, removing per-frame shadow-map rendering and per-pixel dynamic lighting for that light entirely. ## Engine `Lightmapper` flags - Engine-only bootstraps must register it: `AppOptions.lightmapper = Lightmapper`. `Application` wires this by default; only a manual `AppOptions` assembly needs the explicit line. - Per light: `light.bake = true`, then `light.affectDynamic = false` once every mesh it lights is lightmapped, so it stops contributing to the real-time pass. - Per mesh: `render.lightmapped = true` — required for the mesh to receive any light once `affectDynamic` is false, a correctness requirement, not just an optimization — `render.lightmapSizeMultiplier` to size its lightmap, `render.castShadowsLightmap` so lightmapped meshes still shadow each other in the bake. - Bake mode: `BAKE_COLOR` for flat diffuse materials; `BAKE_COLORDIR` adds a dominant-light-direction pass for normal- or specular-mapped materials that need one. - Baked ambient occlusion, independent of any light: `scene.ambientBake` plus `ambientBakeNumSamples`, `ambientBakeOcclusionBrightness`/`OcclusionContrast`. - Run `app.lightmapper.bake(null, mode)` once the scene exists; `null` bakes every lightmapped node. ## Verify UVs before trusting this on real assets The installed `Lightmapper` bakes a node only when every mesh instance on it has a second UV set (`mesh.vertexBuffer.format.hasU