Skip to content

Unable to set intensity and rotation of loaded IBL in desktop gltf_viewer #7971

Open

Description

⚠️ Issues not using this template will be systematically closed.

Describe the bug
There is a bug where the intensity and rotation of the loaded IBL cannot be set in the desktop gltf_viewer after using the drag and drop feature.

To Reproduce
Steps to reproduce the behavior:

  1. Load an IBL file using the drag and drop feature in the desktop gltf_viewer.
  2. Attempt to set the intensity and rotation of the loaded IBL.

Expected behavior
The intensity and rotation of the loaded IBL should be adjustable from the desktop gltf_viewer GUI.

Screenshots
Not applicable.

Logs
Not applicable.

Desktop (please complete the following information):

  • OS: Windows 11
  • GPU: NVIDIA GTX 3050 Laptop
  • Backend: Vulkan

Smartphone (please complete the following information):

  • Device: Not applicable.
  • OS: Not applicable.

Additional context
I have identified the issue and made some modifications to fix it. Here are the changes:

Proposed Fix

Here are the changes I made to fix the issue:

filamentApp.setDropHandler([&](std::string_view path) {
    utils::Path filename = getPathForGLTFAsset(path);
    if (!filename.isEmpty()) {
        if (checkGLTFAsset(filename)) {
            app.resourceLoader->asyncCancelLoad();
            app.resourceLoader->evictResourceData();
            app.viewer->removeAsset();
            app.assetLoader->destroyAsset(app.asset);
            loadAsset(filename);
            loadResources(filename);
            app.viewer->setAsset(app.asset, app.instance);
        }
        return;
    }

    filename = getPathForIBLAsset(path);
    if (!filename.isEmpty()) {
        FilamentApp::get().loadIBL(path);
        auto ibl = FilamentApp::get().getIBL();
        if (ibl) {
            app.viewer->setIndirectLight(ibl->getIndirectLight(), ibl->getSphericalHarmonics());
            app.viewer->getSettings().view.fogSettings.fogColorTexture = ibl->getFogTexture();
        }
        return;
    }
});

These changes ensure that the loaded IBL can have its intensity and rotation set in the desktop gltf_viewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't workinglow priorityLow priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions