Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-5091

Being able to bake lightmaps from the UI

    XMLWordPrintable

Details

    Description

      Qt DS shall be able to create lightmaps from the 3D scene with tooling. Lightmap baking is a feature related to global illumination (Qt 6.5)

      An update on the state of things, and an approximate plan for introducing support in DS:

      The limited approach we had in 6.4, where one launches an application with a special command line argument which then triggers lightmap baking with whatever is in the scene after starting up, is complemented by an alternative in 6.5 where one has a Bake button on the built-in interactive DebugView application can add to their Qt Quick scene.

      (the docs in https://doc-snapshots.qt.io/qt6-dev/quick3d-lightmap.html are not yet updated regarding this at the time of writing)

      I have attached a video demonstrating this process, based on work in progress 6.5 patches, so it is not entirely final, but demos the concept well. (this is using a modified example, i.e. so that it uses plain files, and when starting up it won't find the lightmap at first, thus falling back to realtime rendering)

      This is significantly nicer than the initial approach since one can choose to trigger baking at any time, which then captures what is in the scene at that point in time.

      Now, this is relevant mainly because this workflow already matches what a designer tool's "Bake lightmaps" button would do.

      • The Design Studio integration is expected to be built on the same infrastructure, meaning the internal void bakeLightmap(QSSGLightmapper::OutputCallback outputCallback) function in QQuick3DViewport (View3D).
      • When it comes the UI, a single button is sufficient to start with.
      • The bake request would need to be channeled to the Puppet process, which then triggers the - potentially very long - baking process by calling the function on the View3D.
      • When it comes to reporting progress, there are some small challenges potentially, since the function will not return for a long time, and report progress via the callback. (the possibility of cancellation is currently being investigated, remains to be seen if we get that)
      • Now, if the Puppet is single threaded, that means it will need to be careful with the callback. I suppose it needs to send the progress cross-process back to the Designer app. If this can be done from the callback before returning I am not sure. (once the callback returns, the baking goes on, blocking the whole process until the next progress report)
      • Note that the window that pops up on the video is not part of the DS-facing infrastructure, that's only for internal use. DS/Puppet should only use the mentioned View3D API. DS can open its own window or process the progress strings in any way it feels like.
      • When baking completes successfully, meaning that the generated qlm_*.exr (and potentially .mesh) files get written (overwritten) successfully, there is one more step: the denoising of the lightmap images.
      • In the Qt docs we currently point to https://git.qt.io/laagocs/qlmdenoiser and recommend it as a potential build-it-yourself solution to get a command-line tool that can denoise a .exr file and replace it with the denoised version.
      • This is not ideal, but we have no solution on the framework level since building OpenImageDenoise is quite involved with other dependencies, and we cannot bundle it with Qt.
      • Design Studio however could ship the qlmdenoiser executable and launch it as part of the baking process. In the video this is missing of course, hence you can see that the lightmaps that get reloaded after baking completes are full of noise.
      • The command-line tool can currently be built on Windows (x64), Linux (x64), and  macOS x64 and MacOS ARM64. Other platforms are not relevant for this tool.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              javihria Jarko Vihriälä
              javihria Jarko Vihriälä
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes