Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
QDS 4.1
-
None
-
3
-
QDS Oulu - 2023 Week 15/16
Description
QDS 4.1 will include tech preview of baking lights, so it needs to be documented. Here's a quick guide to get you started:
For each model in the scene that should take part in the baking, specify the following properties:
Model {
id: myModel
// ...
bakedLightmap: myLightmap // Link to BakedLightmap item below
usedInBakedLighting: true // Indicates this model is included in baking
lightmapBaseResolution: 256 // Resolution of the baked lightmap for this model
BakedLightmap
}
If Models inside subcomponent need to be included in baking, they must be exposed from the subcomponent:
property alias lm_sphere1: sphere1
Node {
id: myScene
Model
}
And in the main qml you need to then do this:
MySphere {
id: mySphere
lm_sphere1.bakedLightmap: sphereMap1
lm_sphere1.usedInBakedLighting: true
lm_sphere1.lightmapBaseResolution: 128
BakedLightmap
// ...
}
Additionally, you can specify some global baking properties using LightMapper item and setting it to SceneEnvironment:
SceneEnvironment {
id: sceneEnvironment
lightmapper: lightMapper
Lightmapper
// ...
}
Once all the properties are set up, simply trigger the baking process from 3D view toolbar or context menu.
Baking happens on the background, in a separate process, allowing you to continue doing other things in the editor.
Once baking process is completed, the baking dialog will pop back up and you can close it.
Baking results in .exr (and potentially .mesh) files in the folder specified by loadPrefix properties.
.exr contains the baked texture for the model.
.mesh is a modified mesh file for the model, which is used instead of the normal mesh. It contains additional UVs for the baked texture. .mesh is only generated if the mesh didn't already contain baking UVs (it's an option during 3D import).
For more information, see: https://doc-snapshots.qt.io/qt6-dev/quick3d-lightmap.html