diff options
author | Kristoffer Skau <[email protected]> | 2025-03-13 14:06:50 +0100 |
---|---|---|
committer | Jonas Karlsson <[email protected]> | 2025-05-28 16:48:35 +0200 |
commit | edaef10f41074b0616c3ec42d379cf4bd9cc9278 (patch) | |
tree | 6dbfd400667102863f8e7efcab7bd6a394058dd5 /tests/manual/instance-picking | |
parent | 75c66953ee2fc9c9a532690b7ab0250d67fc1730 (diff) |
With the new file format in place we only need a single file where we
store everything that's baking related. This includes both the per model
lightmaps and the meshes. An advantage of this is that we no longer need
to expose any functionality for lightmap UV generation. We instead do
this everytime for all the models internally when baking, storing the
ones that has a key in the final lightmaps file. This keeps the lightmap
images in sync with the mesh files at all times, which has been an issue
as any changes to the mesh, models or other scene modifications will be
out of sync. A rebake is required in that case anyways.
Removed lightmap UV generation from ever happening at runtime, as this
is no longer needed. The mesh path override is also removed, as we
instead use the generated lightmap compatible mesh generated instead.
There's now a single source path in Lightmapper, and loadPrefix set per
model is deprecated. This points to where to both save the baking result
and where to load it. Set to 'lightmaps.bin' by default, meaning cwd.
This makes sure that when baking by default the user actually see the
final result immediately. Afterwards it's then a simple operation to
manually copy the file to the source directory and add it to resources,
then declaring a Lightmapper property and setting the source to that
path, e.g. "qrc:/lightmaps/lightmaps.bin". On next run the Lightmapper
will load from that path instead of cwd, but note that any subsequent
bakes will fail, as the resource system is not a writable location.
If the file is not explicitly set up to point to resources, it will
still fall back and look there if the file is not found on disk.
So in practice the following happens when baking for the first time
directly via QtQuick3D and using DebugView:
1. Setup lights for baking and usedInBakedLighting: true on
models.
2. Add BakedLightmap to each Model that wants to store their lightmap.
Set a unique key and set enabled: true.
Note that there's no need to add an explicit Lightmapper to
SceneEnvironment at this point. Only if other properties are to be
modified, like sample count or number of bounces.
4. Run the application. A warning will be given that no lightmap file is
found.
5. Open DebugView and bake. When complete the result will instantly
appear. There will be a generated file in cwd called lightmaps.bin.
Now this file can be put into resources and a Lightmapper be declared
with source pointing to the lightmaps file.
Note that old scenes prior to this change will have to be baked again,
as we no longer support the old structure.
[ChangeLog] Add source property to Lightmapper.
Deprecated BakedLightmap::loadPrefix.
Change-Id: Ie60dd48d6e6dc7587e2cd5267d74f7528bce76a8
Reviewed-by: Andy Nichols <[email protected]>
Diffstat (limited to 'tests/manual/instance-picking')
0 files changed, 0 insertions, 0 deletions