BakedLightmap QML Type | Qt Quick 3D 6.5.3
Description: Specifies baked lightmap settings for a model.

- Qt 6.5
- Qt Quick 3D
- QML Types
- BakedLightmap
- Qt Quick 3D | Commercial or GPLv3

# BakedLightmap QML Type

Specifies baked lightmap settings for a model. More...

Import Statement: | import QtQuick3D
Since: | Qt 6.4

- List of all members, including inherited members

## Properties

- enabled : bool
- key : string
- loadPrefix : string

## Detailed Description

A BakedLightmap object can be used to enable:

- persistently storing the baked lightmap data - during baking, or
- loading the previously generated and stored lightmaps - at run time.

A Model with usedInBakedLighting set to true is considered to be part of the raytraced scene when baking lightmaps, meaning the model's geometry and material contribute to direct and indirect lighting. This on its own does not however enable generating, including full calculation of bounced indirect lighting, and finally saving a lightmap for the model. To do that, the model also needs to be associated with an enabled BakedLightmap object with a unique key set.

When running in normal mode, the same BakedLightmap object indicates that the Model has lightmap data, and that the engine should attempt to load this data (based on the unique key) and use it when rendering.

For more information on how to bake lightmaps, see the Lightmapper documentation.

Note: As of Qt 6.4, lightmap baking is in an early technical preview state. Changes to features, quality, and API are likely happen in future releases.

See also Lightmapper and Model::usedInBakedLighting.

## Property Documentation

enabled : bool

When false, the lightmap generated for the model is not stored during lightmap baking, even though key is set to a non-empty value.

The default value is true.

key : string

When non-empty and enabled is true, the lightmap generated for the model is stored persistently during lightmap baking. The value should be a unique string that is fit to be included in the name of a file in the filesystem. No other Model in the scene must use the same key.

The default value is empty.

See also loadPrefix.

loadPrefix : string

When non-empty, the value is prepended as a path to the value of key when loading the lightmap for the Model. This allows shipping the generated lightmaps in different location than they were written to, for example as embedded resources via the Qt resource system.

For example, the following enables lightmap generation for a static model, using a unique key for identifying the lightmap data between baking and real runs of the application. Once baking is performed, the generated file can be listed in the application's CMake project as a resource under the `/lightmaps` PREFIX, letting the build process pick up the file and include it in the executable.

     Model {
         source: "model.mesh"
         y: 10
         bakedLightmap: BakedLightmap {
             key: "model34156"
             loadPrefix: "qrc:/lightmaps"
             // will attempt to load from :/lightmaps/qlm_model34156.exr at run time
         }
     }

The default value is empty.

See also key.