diff --git a/doc/qtdesignstudio/images/baked-lightmaps-add-property.png b/doc/qtdesignstudio/images/baked-lightmaps-add-property.png new file mode 100644 index 00000000000..96d4e3e3276 Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-add-property.png differ diff --git a/doc/qtdesignstudio/images/baked-lightmaps-edit-component.png b/doc/qtdesignstudio/images/baked-lightmaps-edit-component.png new file mode 100644 index 00000000000..54ba462e2da Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-edit-component.png differ diff --git a/doc/qtdesignstudio/images/baked-lightmaps-exit-component.png b/doc/qtdesignstudio/images/baked-lightmaps-exit-component.png new file mode 100644 index 00000000000..58b5893bed2 Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-exit-component.png differ diff --git a/doc/qtdesignstudio/images/baked-lightmaps-navigator-blm.png b/doc/qtdesignstudio/images/baked-lightmaps-navigator-blm.png new file mode 100644 index 00000000000..1fe50f46a27 Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-navigator-blm.png differ diff --git a/doc/qtdesignstudio/images/baked-lightmaps-navigator.png b/doc/qtdesignstudio/images/baked-lightmaps-navigator.png new file mode 100644 index 00000000000..a6fac65a00d Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-navigator.png differ diff --git a/doc/qtdesignstudio/images/baked-lightmaps-property-value.png b/doc/qtdesignstudio/images/baked-lightmaps-property-value.png new file mode 100644 index 00000000000..69a5fd3a82a Binary files /dev/null and b/doc/qtdesignstudio/images/baked-lightmaps-property-value.png differ diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-lights.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-lights.qdoc index 47e39f32118..8c798a31a4f 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-lights.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-lights.qdoc @@ -208,4 +208,97 @@ To specify the maximum distance for the shadow map, set the \uicontrol {Shadow map far} property value. Using smaller values may improve the precision and effects of the map. + + \section1 Baking Lightmaps + + \note Lightmaps baking is released as technical preview in \QDS 4.1. + + \section2 Baking Lightmaps for a 3D Model + Baked lightmap components are not visible in the \uicontrol Navigator view by default. To make + them visible, select \inlineimage icons/visibilityon.png + in the \uicontrol Navigator view. + + To bake lightmaps for a 3D model: + \list 1 + \li From \uicontrol Components, drag a \uicontrol {Baked Lightmap} component to + the 3D model in the \uicontrol Navigator view. + \image baked-lightmaps-navigator.png + \li In the \uicontrol Navigator view, select \e bakedLightmap and in the \uicontrol Properties + view: + \list + \li Select \uicontrol Enabled. + \li In \uicontrol Key, set the filename base for the generated light maps. This must be + a unique name. + \li In \uicontrol {Load Prefix}, set the relative path to the folder where the generated + light map files are saved. + \endlist + \li In the \uicontrol Navigator view, select the 3D model and in the \uicontrol Properties + view, select \uicontrol {Used in Baked Lighting}. + \li Optional. Adjust \uicontrol Resolution to set the light map resoution. This effects how + accurate and time-consuming the lightmap baking is. + \li In the \uicontrol Navigator view, select the light component that you want to bake + lightmaps for, and in the \uicontrol Properties view, set \uicontrol {Bake Mode} to BakeModeAll. + \li Right-click anywhere in the \uicontrol 3D view and select \uicontrol {Bake Lights}. + \endlist + + \section2 Baking Lightmaps for a 3D Model Inside a Sub Component + + To bake lightmaps for a 3D model inside a sub component, first add a local custom property to + expose the model: + + \list 1 + \li In the \uicontrol Navigator view, right-click the sub component and select + \uicontrol {Edit Component}. + \image baked-lightmaps-edit-component.png + \li In the \uicontrol Navigator view, select the root component. + \li In the \uicontrol Properties view, select \inlineimage icons/plus.png + in the \uicontrol {Local Custom Properties} section. + \li Add a new property, set \uicontrol Type to alias. + \image baked-lightmaps-add-property.png + \li For the property, set the value to the ID of the 3D model that you want + to bake lightmaps for. + \image baked-lightmaps-property-value.png + \li In the \uicontrol Navigator view, select the 3D model and in the \uicontrol Properties + view: + \list + \li Select \uicontrol {Used in Baked Lighting}. + \li Set \uicontrol Resolution to, for example, 128. + \endlist + \li Save your changes (\key {Ctrl+S}) and return to the main project file. To do this, select + the bread crumb in the top toolbar. + \image baked-lightmaps-exit-component.png + \li From the \uicontrol Components view, drag a \uicontrol {Baked Lightmap} component to the + sub component in the \uicontrol Navigator view. + \image baked-lightmaps-navigator-blm.png + \li In the \uicontrol Navigator view, select the sub component and go to the + \uicontrol Code view. + \li In the \uicontrol Code view, you need to set the properties for the model inside the sub + component by using the exposed property. + + Add the following code inside the sub component. + \code + lmSphere.bakedLightmap: bakedLightmap + \endcode + + It should look something like this: + \code + MyGroup { + id: group + lmSphere.bakedLightmap: bakedLightmap + BakedLightmap { + id: bakedLightmap + loadPrefix: "lightmaps" + } + } + \endcode + \li In the \uicontrol Navigator view, select \e bakedLightMap, and in the \uicontrol + Properties view: + \list + \li Select \uicontrol Enabled. + \li In \uicontrol Key, set the filename base for the generated light maps. This must be + a unique name. + \endlist + \li Right-click anywhere in the \uicontrol 3D view and select \uicontrol {Bake Lights}. + \endlist + */