Commit 87bd62d
committed
USDScene : Support round-tripping of non-UsdLux lights
In Cortex/Gaffer, a light is a location which has a `light` or `*:light` attribute containing a suitable ShaderNetwork and which also appears in the `__lights` set. When round-tripping a non-UsdLux light through USD we were losing the membership of the set because on loading we were synthesizing the set from all locations with `UsdLuxLightAPI` applied, rather than loading the `__lights` set that had been written explicitly. By loading both `UsdLuxLightAPI` locations _and_ members of the `__lights` collection, we can support both UsdLuxLights from other DCCs (where the `__lights` collection won't have been written) and UsdLux and non-UsdLux lights from Gaffer (where the `__lights` collection will have been written).
There are a couple of elephants in the room here :
1. We are still not writing the light's material in a USD-conformant way. It ends up being written as a material assignment just because that's what it is in Cortex/Gaffer, but really it should be written as an ArnoldDistantLight prim.
But doing that wouldn't have helped with the `__lights` set : ArnoldDistantLight is not a UsdLuxLight, so it _still_ wouldn't have been found by the old set reading code.
2. We arguably should be writing the `__lights` set not as a regular collection, but via UsdLuxLightList, for maximum compatibility with other USD consumers. But then we'd be including non-UsdLux lights in the light list (see 1) which isn't ideal either - they wouldn't be included by `UsdLuxLightListAPI::ComputeLightList()`, which is the canonical way of generating such a list.
For now we're just making the simplest possible change to unlock a short term Gaffer->Gaffer workflow involving Arnold-specific lights.
> Note : As a byproduct we are also doing the same merging of the predicate-based and collection based sets for the `__cameras` and `usd:pointInstancers` sets. Is this something we should be concerned about?1 parent ca90f15 commit 87bd62d
File tree
3 files changed
+34
-2
lines changed- contrib/IECoreUSD
- src/IECoreUSD
- test/IECoreUSD
3 files changed
+34
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3973 | 3973 | | |
3974 | 3974 | | |
3975 | 3975 | | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
3976 | 4004 | | |
3977 | 4005 | | |
0 commit comments