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

EMSUSD-77 - Newly created USD Lights can't cast shadows #3233

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

samuelliu-adsk
Copy link
Collaborator

@samuelliu-adsk samuelliu-adsk commented Jul 17, 2023

Create USD light from USD will cause the bug. The root cause is that those shadow attributes are never added to the USD created lights. So create Shadow attributes at first query if the attribute is not created

@samuelliu-adsk samuelliu-adsk added the adsk Related to Autodesk plugin label Jul 20, 2023
@samuelliu-adsk samuelliu-adsk marked this pull request as ready for review July 20, 2023 18:28
@@ -175,6 +175,11 @@ bool getLightShadowEnable(const UsdPrim& prim)
const UsdLuxShadowAPI shadowAPI(prim);
const PXR_NS::UsdAttribute lightAttribute = shadowAPI.GetShadowEnableAttr();

if (!lightAttribute) {
// If the shadow enable attribute is not created yet, create one here
shadowAPI.CreateShadowEnableAttr(VtValue(true));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we default to true here? Does HdStorm render shadows when the attribute doesn't exist?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you don't seem to set lightAttribute inside this if, so I'm not sure how the further code works in this case

Copy link
Collaborator Author

@samuelliu-adsk samuelliu-adsk Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for the default value, I set it as true because I think its natural for a light to cast shadows? I see that's the behavior in Maya (if user created a maya light and duplicated as USD light, it casts shadows as default) so I assume we should do the same for USD light as well... Just dont want the user to be confused.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sounds good. So just make sure to set the lightAttribute, and we'll be good to go.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please do it here and below for the shadow color attribute

Copy link
Collaborator

@vlasovi vlasovi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@samuelliu-adsk samuelliu-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jul 24, 2023
@seando-adsk seando-adsk added ufe-usd Related to UFE-USD plugin in Maya-Usd and removed adsk Related to Autodesk plugin labels Jul 24, 2023
@seando-adsk seando-adsk merged commit 281bf2a into dev Jul 25, 2023
12 checks passed
@seando-adsk seando-adsk deleted the samuelliu-adsk/EMSUSD-77/USD_light_cant_cast_shadow branch July 25, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants