-
Notifications
You must be signed in to change notification settings - Fork 201
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
EMSUSD-77 - Newly created USD Lights can't cast shadows #3233
Conversation
lib/mayaUsd/ufe/UsdLight.cpp
Outdated
@@ -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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
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