Skip to content

Commit bc46eb7

Browse files
blevinpixar-oss
authored andcommitted
UsdRender/UsdRi: Move the matte and cameraVisibility collections
from UsdRiRenderPassAPI to UsdRenderPass, and remove UsdRiRenderPassAPI. There are several motivations here: 1. These two collections were an exception to the principle that all RenderMan concepts represented as USD attributes use the "ri:" namespace; and that API schemas broadly should use namespaces to avoid domain collisions. 2. UsdRiRenderPassAPI, being an auto-applied API schema in the core USD distribution, was contributing these collections to render passes even when RenderMan was not in use. This proved awkward in environments where a different renderer was in use that also supported these same concepts of matte and cameraVisibility. 3. This recognizes that matte objects and camera visibility are broadly supported and useful notions in CG production rendering. It also recognizes that these collections are not inherently implemented in a renderer, but instead are implemented in the scene-generation side of the rendering system (e.g. Hydra), by being mapped to renderer-specific concepts (ri:Matte and ri:visibility:camera in the case of RenderMan). 4. This change requires no asset updates and is simply rationalizing existing schemas, informed by experience. (Internal change: 2361095)
1 parent 16533d4 commit bc46eb7

17 files changed

+58
-582
lines changed

pxr/usd/usdRender/generatedSchema.usda

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ class RenderProduct "RenderProduct" (
400400
}
401401

402402
class RenderPass "RenderPass" (
403-
apiSchemas = ["CollectionAPI:renderVisibility", "CollectionAPI:prune"]
403+
apiSchemas = ["CollectionAPI:renderVisibility", "CollectionAPI:cameraVisibility", "CollectionAPI:prune", "CollectionAPI:matte"]
404404
customData = {
405-
token[] apiSchemaOverridePropertyNames = ["collection:renderVisibility:includeRoot"]
405+
token[] apiSchemaOverridePropertyNames = ["collection:cameraVisibility:includeRoot", "collection:renderVisibility:includeRoot"]
406406
}
407407
doc = """A RenderPass prim encapsulates necessary information
408408
to generate multi-pass renders. In a multi-pass render, multiple
@@ -454,6 +454,20 @@ class RenderPass "RenderPass" (
454454
to objects associated with the render settings, such as image
455455
post-processing filters, even when UsdGeomVisibilityAPI may apply.
456456

457+
\\anchor usdRi_cameraVisibility
458+
The cameraVisibility collection defines which scene objects should
459+
be directly visible in camera. Objects that are not in this
460+
collection should still participate in other light paths such
461+
as shadowing, reflections, and refraction. By default everything in
462+
the scene should be visible to camera, so this collection sets
463+
includeRoot to 1.
464+
465+
\\anchor usdRi_matte
466+
The matte collection defines scene objects that should act as
467+
matte objects. Matte objects render with zero alpha. By
468+
default, everything in the scene should render normally, so
469+
this collection sets includeRoot to 0.
470+
457471
\\anchor usdRender_pruning
458472
The prune collection specifies a collection of objects to be removed
459473
(\"pruned\") from the scene prior to rendering. Whereas visibility
@@ -470,6 +484,7 @@ class RenderPass "RenderPass" (
470484
"""
471485
)
472486
{
487+
uniform bool collection:cameraVisibility:includeRoot = 1
473488
uniform bool collection:renderVisibility:includeRoot = 1
474489
uniform string[] command (
475490
doc = '''The command to run in order to generate

pxr/usd/usdRender/pass.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ class SdfAssetPath;
8787
/// to objects associated with the render settings, such as image
8888
/// post-processing filters, even when UsdGeomVisibilityAPI may apply.
8989
///
90+
/// \anchor usdRi_cameraVisibility
91+
/// The cameraVisibility collection defines which scene objects should
92+
/// be directly visible in camera. Objects that are not in this
93+
/// collection should still participate in other light paths such
94+
/// as shadowing, reflections, and refraction. By default everything in
95+
/// the scene should be visible to camera, so this collection sets
96+
/// includeRoot to 1.
97+
///
98+
/// \anchor usdRi_matte
99+
/// The matte collection defines scene objects that should act as
100+
/// matte objects. Matte objects render with zero alpha. By
101+
/// default, everything in the scene should render normally, so
102+
/// this collection sets includeRoot to 0.
103+
///
90104
/// \anchor usdRender_pruning
91105
/// The prune collection specifies a collection of objects to be removed
92106
/// ("pruned") from the scene prior to rendering. Whereas visibility

pxr/usd/usdRender/schema.usda

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ class RenderPass "RenderPass" (
315315
to objects associated with the render settings, such as image
316316
post-processing filters, even when UsdGeomVisibilityAPI may apply.
317317

318+
\\anchor usdRi_cameraVisibility
319+
The cameraVisibility collection defines which scene objects should
320+
be directly visible in camera. Objects that are not in this
321+
collection should still participate in other light paths such
322+
as shadowing, reflections, and refraction. By default everything in
323+
the scene should be visible to camera, so this collection sets
324+
includeRoot to 1.
325+
326+
\\anchor usdRi_matte
327+
The matte collection defines scene objects that should act as
328+
matte objects. Matte objects render with zero alpha. By
329+
default, everything in the scene should render normally, so
330+
this collection sets includeRoot to 0.
331+
318332
\\anchor usdRender_pruning
319333
The prune collection specifies a collection of objects to be removed
320334
("pruned") from the scene prior to rendering. Whereas visibility
@@ -334,7 +348,7 @@ class RenderPass "RenderPass" (
334348
string extraIncludes = """
335349
#include "pxr/usd/usd/collectionAPI.h" """
336350
}
337-
prepend apiSchemas = ["CollectionAPI:renderVisibility", "CollectionAPI:prune"]
351+
prepend apiSchemas = ["CollectionAPI:renderVisibility", "CollectionAPI:cameraVisibility", "CollectionAPI:prune", "CollectionAPI:matte"]
338352
) {
339353
uniform token passType (
340354
doc = """A string used to categorize differently structured
@@ -414,4 +428,9 @@ class RenderPass "RenderPass" (
414428
bool apiSchemaOverride = true
415429
}
416430
)
431+
uniform bool collection:cameraVisibility:includeRoot = 1 (
432+
customData = {
433+
bool apiSchemaOverride = true
434+
}
435+
)
417436
}

pxr/usd/usdRender/tokens.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ UsdRenderTokensType::UsdRenderTokensType() :
1414
adjustPixelAspectRatio("adjustPixelAspectRatio", TfToken::Immortal),
1515
aspectRatioConformPolicy("aspectRatioConformPolicy", TfToken::Immortal),
1616
camera("camera", TfToken::Immortal),
17+
collectionCameraVisibilityIncludeRoot("collection:cameraVisibility:includeRoot", TfToken::Immortal),
1718
collectionRenderVisibilityIncludeRoot("collection:renderVisibility:includeRoot", TfToken::Immortal),
1819
color3f("color3f", TfToken::Immortal),
1920
command("command", TfToken::Immortal),
@@ -60,6 +61,7 @@ UsdRenderTokensType::UsdRenderTokensType() :
6061
adjustPixelAspectRatio,
6162
aspectRatioConformPolicy,
6263
camera,
64+
collectionCameraVisibilityIncludeRoot,
6365
collectionRenderVisibilityIncludeRoot,
6466
color3f,
6567
command,

pxr/usd/usdRender/tokens.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ struct UsdRenderTokensType {
6565
///
6666
/// UsdRenderSettingsBase
6767
const TfToken camera;
68+
/// \brief "collection:cameraVisibility:includeRoot"
69+
///
70+
/// UsdRenderPass
71+
const TfToken collectionCameraVisibilityIncludeRoot;
6872
/// \brief "collection:renderVisibility:includeRoot"
6973
///
7074
/// UsdRenderPass

pxr/usd/usdRender/wrapTokens.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ void wrapUsdRenderTokens()
2222
_ADD_TOKEN(cls, adjustPixelAspectRatio);
2323
_ADD_TOKEN(cls, aspectRatioConformPolicy);
2424
_ADD_TOKEN(cls, camera);
25+
_ADD_TOKEN(cls, collectionCameraVisibilityIncludeRoot);
2526
_ADD_TOKEN(cls, collectionRenderVisibilityIncludeRoot);
2627
_ADD_TOKEN(cls, color3f);
2728
_ADD_TOKEN(cls, command);

pxr/usd/usdRi/generatedSchema.classes.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
# Public Classes
44
materialAPI
5-
renderPassAPI
65
splineAPI
76
statementsAPI
87
tokens
98

109
# Python Module Files
1110
module.cpp
1211
wrapMaterialAPI.cpp
13-
wrapRenderPassAPI.cpp
1412
wrapSplineAPI.cpp
1513
wrapStatementsAPI.cpp
1614
wrapTokens.cpp

pxr/usd/usdRi/generatedSchema.module.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
TF_WRAP(UsdRiStatementsAPI);
1010
TF_WRAP(UsdRiMaterialAPI);
1111
TF_WRAP(UsdRiSplineAPI);
12-
TF_WRAP(UsdRiRenderPassAPI);
1312
TF_WRAP(UsdRiTokens);

pxr/usd/usdRi/generatedSchema.usda

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,3 @@ class "RiSplineAPI" (
6363
{
6464
}
6565

66-
class "RiRenderPassAPI" (
67-
apiSchemas = ["CollectionAPI:matte", "CollectionAPI:cameraVisibility"]
68-
customData = {
69-
token[] apiSchemaOverridePropertyNames = ["collection:cameraVisibility:includeRoot"]
70-
}
71-
doc = """
72-
RiRenderPassAPI is an API schema that provides a mechanism
73-
to set certain Ri statements on each prim in a collection,
74-
for a given RenderPass prim.
75-
76-
\\anchor usdRi_cameraVisibility
77-
The objects that are relevant to the render is specified via the
78-
cameraVisibility collection (UsdCollectionAPI) and can be accessed via
79-
GetCameraVisibilityCollectionAPI(). Each prim in the collection will have
80-
ri:visible:camera set to 1. By default everything in the scene should be
81-
visible to camera, so this collection sets includeRoot to 1.
82-
83-
\\anchor usdRi_matte
84-
The objects that are relevant to the render is specified via the
85-
matte collection (UsdCollectionAPI) and can be accessed via
86-
GetMatteCollectionAPI(). Each prim in the collection will have
87-
ri:matte set to 1. By default everything in the scene should render
88-
normally, so this collection sets includeRoot to 0.
89-
"""
90-
)
91-
{
92-
uniform bool collection:cameraVisibility:includeRoot = 1
93-
}
94-

pxr/usd/usdRi/plugInfo.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@
1717
"schemaIdentifier": "RiMaterialAPI",
1818
"schemaKind": "singleApplyAPI"
1919
},
20-
"UsdRiRenderPassAPI": {
21-
"alias": {
22-
"UsdSchemaBase": "RiRenderPassAPI"
23-
},
24-
"apiSchemaAutoApplyTo": [
25-
"RenderPass"
26-
],
27-
"apiSchemaCanOnlyApplyTo": [
28-
"RenderPass"
29-
],
30-
"autoGenerated": true,
31-
"bases": [
32-
"UsdAPISchemaBase"
33-
],
34-
"schemaIdentifier": "RiRenderPassAPI",
35-
"schemaKind": "singleApplyAPI"
36-
},
3720
"UsdRiSplineAPI": {
3821
"alias": {
3922
"UsdSchemaBase": "RiSplineAPI"

0 commit comments

Comments
 (0)