Difference between revisions of "Partial scene baking"

From Bakery GPU Lightmapper: Wiki
Jump to navigation Jump to search
Line 40: Line 40:
  
 
<hr>
 
<hr>
 +
  
 
In the toy example above there is no real benefit of using sectors. But here is a real example:
 
In the toy example above there is no real benefit of using sectors. But here is a real example:

Revision as of 07:13, 3 May 2021

In the level design process, especially when working on very large maps, it is often desirable to only rebake a small chunk of the world and iterate on it. Originally Bakery's Lightmap Groups were meant to achieve it (apart from their other benefits). In practice, however, it didn't work well, as they are limited to a single lightmap atlas, and "Render Selected" functionality had too many constraints due to lightmapper's core architecture. "Render Selected" also didn't reduce the memory footprint of world geometry; all vertices and triangles of all loaded scenes had to be ready in VRAM.

Large scenes could be also split into multiple smaller scenes, but this approach required more setup and, most importantly, such scenes couldn't light/shadow each other.

The sector system

BakerySector component UI

The new sector system (upcoming in v1.9) attempts to solve this problem. BakerySector is a collection of objects that can be baked separately. Similar to Lightmap Groups, adding BakerySector component on a root object of a hierarchy, marks all objects in this hierarchy as belonging to this sector.

Main Bakery window (when viewed in Advanced/Experimental mode) now has a sector field:

Bsector field.jpg

If not set, all bakes will proceed normally; but if set to a specific sector, only this sector will be baked, or rendered in RTPreview.

Here is an example. Two white boxes belong to a sector. First, this is how it looks in RTPreview (and for the lightmapper) by default:

Bsector default.jpg

All scene objects are present and will be fully baked.

Now, with the sector selected:

Bsector only.jpg

Only white boxes are visible by the lightmapper now. They can be baked separately without breaking existing scene lightmaps. However, they lack shadows and bounces from the surrounding geometry.

To fix this problem, BakerySector has Capture Points. Each capture point is like a virtual omnidirectional camera (or a cubemap, if it's easier to grasp). These points capture the scene around them (depth and albedo information) and generate a simplified projected mesh. Multiple capture points can be combined to cover different viewpoints, acting similarly to a virtual version of 3D scanning. When the real scene is very large and complex, these projected meshes can work as its cheap approximation, providing desired shadows/bounces, while only requiring a fraction of memory/time to process. Projected geometry is temporary and only used in the bake/preview; it won't persist in the scene.

Here is the same scene in RTPreview, with 1 capture point added:

Bsector 1.jpg

Now shadows and bounces on the white boxes look just as if we had whole world geometry loaded; but instead of the real geometry, only this projected mesh is used.

Adding another capture point recovers more of the outside geometry:

Bsector 2.jpg



In the toy example above there is no real benefit of using sectors. But here is a real example: