- Qt 6.12
- Qt Quick 3D
- qt_add_lightprobe_images
- Qt Quick 3D | Commercial or GPLv3

# qt_add_lightprobe_images

Bakes HDRI map files to KTX files, adding them as Qt resouces.

Note: This command is in technology preview and may change in future releases.

The command is defined in the `Quick3D` component of the `Qt6` package, which can be loaded like this:

     find_package(Qt6 REQUIRED COMPONENTS Quick3D)

This command was introduced in Qt 6.2.

## Synopsis

     qt_add_lightprobe_images(target resource_name
                         [PREFIX prefix]
                         [BASE base]
                         FILES file1.hdr, file2.hdr ..
                         [OUTPUTS file1.ktx, file2.ktx ..]
     )

If versionless commands are disabled, use `qt6_add_lightprobe_images()` instead. It supports the same set of arguments as this command.

## Description

Use the command to bake `.hdr` files listed under `FILES` to `.ktx` files. The files will be included under in the binary or library `target`.

`FILES` should list paths to local HDRI map files. Each file must have either the suffix `.hdr`, or `.exr`. These files will be converted at build time to `.ktx` files, using the Balsam Asset Import Tool.

By default, the `.ktx` files will show up in embedded Qt resources of the target binary under the same base name and relative path. Use `BASE` to remove a common directory from the relative paths at runtime. That is, if all the file paths under `FILES` point to a common directory `maps/`, then you can use `BASE maps/` to hide the directory in the Qt resource system. In a similar vein, you can use `PREFIX` to add a common prefix directory in the Qt resource system.

While `BASE` and `PREFIX` allow you to change the comon relative paths of the `.ktx` files in the Qt resource system, `OUTPUTS` allow you to control the full path of the `.ktx` files, including the file name. If you use `OUTPUTS`, the number of paths have to match the number of paths to `FILES`.

## Example

The following autogenerates the lightprobe map at build time and includes it in the executable under `:/maps/OpenfootageNET_garage-1024.ktx`:

     qt_add_lightprobe_images(principledmaterial "ibl_assets"
         PREFIX
              "/"
         FILES
             "maps/OpenfootageNET_garage-1024.hdr"
     )

## Caveats

When adding multiple resources, `resource_name` must be unique across all resources linked into the final target.

This especially affects static builds. There, the same resource name in different static libraries conflict in the consuming target.

See also Pre-generating IBL cubemap.