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

Dome light texture is ignored #1708

Closed
gbottesi opened this issue Dec 8, 2021 · 4 comments
Closed

Dome light texture is ignored #1708

gbottesi opened this issue Dec 8, 2021 · 4 comments

Comments

@gbottesi
Copy link

gbottesi commented Dec 8, 2021

Description of Issue

I am using Storm renderer with a HdxTaskController with a UsdImagingDelegate.
If I create a dome light and set it an environment texture, calling setDomeLightTextureFile, the parameter is simply ignored by task controller which always read the default value.

In taskController.cpp, the following code seems to be responsible:

if (light.IsDomeLight()) {
    _delegate.SetParameter(_lightIds[i], 
                        HdLightTokens->textureResource, 
                        _defaultDomeLightTextureResource);
    _delegate.SetParameter(
        _lightIds[i], HdLightTokens->textureFile,
        SdfAssetPath(
            HdxPackageDefaultDomeLightTexture(),
            HdxPackageDefaultDomeLightTexture()));
}

System Information (OS, Hardware)

Windows, OpenGL renderer

@jilliene
Copy link

jilliene commented Dec 8, 2021

Filed as internal issue #USD-7060

@florianhecht
Copy link

I've run into the same issue and fixed it in my clone of the repo. I had to fix two locations:

  1. In HdxTaskController::_SetParameters
  2. In HdxTaskController::_SetBuiltInLightingState

After fixing those two locations I ran into another issue. After the dome light has been created, changes to its transformation are ignored (unless the light is removed and then added back). I traced the bug to HdxTaskController::_SetBuiltInLightingState where in the loop over lights to check for updates the transformation is not extracted again and the transformation of the SPrim is not marked dirty.

https://github.com/PixarAnimationStudios/USD/blob/release/pxr/imaging/hdx/taskController.cpp#L794

I fixed it by inserting this at the top

_delegate.SetParameter(_lightIds[i], 
                       HdTokens->transform,
                       lights[i].GetTransform());

and then marking the transform dirty as well.

GetRenderIndex()->GetChangeTracker().MarkSprimDirty(
        _lightIds[i], HdLight::DirtyTransform | HdLight::DirtyParams);

I hope this helps fix two issues in one go.

Cheers, Florian

@spiffmon
Copy link
Member

Hey Howdy Hey, @florianhecht ! We don't seem to have a CLA from Adobe yet, but if that can be surmounted, we'd love a PR of your work, here.

Happy Holidays!

@florianhecht
Copy link

Hi @spiffmon . I'll check with my folks on that, but nothing is most likely to happen before end of January, due to travels.

Have a great Holiday break.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants