Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
haneulkimdev opened this issue Jul 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working low priority Low priority issue

Comments

@haneulkimdev
Copy link
Contributor

⚠️ 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.

@pixelflinger pixelflinger added bug Something isn't working low priority Low priority issue labels Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority Low priority issue
Projects
None yet
Development

No branches or pull requests

3 participants