1#usda 1.0 2( 3 "This file describes the USD Geometric schemata for code generation." 4 subLayers = [ 5 @usd/schema.usda@ 6 ] 7) 8 9over "GLOBAL" ( 10 customData = { 11 string libraryName = "usdGeom" 12 string libraryPath = "pxr/usd/usdGeom" 13 # string libraryPrefix = "UsdGeom" 14 # string tokensPrefix = "UsdGeom" 15 dictionary libraryTokens = { 16 dictionary interpolation = { 17 string doc = """UsdGeomPrimvar - How a Primvar interpolates 18 across a primitive; equivalent to RenderMan's \\ref Usd_InterpolationVals "class specifier" """ 19 } 20 dictionary elementSize = { 21 string doc = """UsdGeomPrimvar - The number of values in the 22 value array that must be aggregated for each element on the 23 primitive.""" 24 } 25 dictionary unauthoredValuesIndex = { 26 string doc = """UsdGeomPrimvar - The index that represents 27 unauthored values in the indices array of an indexed primvar.""" 28 } 29 dictionary constant ={ 30 string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. 31 Default value for UsdGeomPrimvar::GetInterpolation. One value 32 remains constant over the entire surface primitive.""" 33 } 34 dictionary uniform = { 35 string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. 36 One value remains constant for each uv patch segment of the 37 surface primitive (which is a \\em face for meshes).""" 38 } 39 dictionary varying = { 40 string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. 41 Four values are interpolated over each uv patch segment of the 42 surface. Bilinear interpolation is used for interpolation 43 between the four values.""" 44 } 45 dictionary vertex = { 46 string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. 47 Values are interpolated between each vertex in the surface 48 primitive. The basis function of the surface is used for 49 interpolation between vertices.""" 50 } 51 dictionary faceVarying = { 52 string doc = """Possible value for UsdGeomPrimvar::SetInterpolation. 53 For polygons and subdivision surfaces, four values are 54 interpolated over each face of the mesh. Bilinear interpolation 55 is used for interpolation between the four values.""" 56 } 57 dictionary upAxis = { 58 string doc = """Stage-level metadata that encodes a scene's 59 orientation as a token whose value can be "Y" or "Z".""" 60 } 61 dictionary metersPerUnit = { 62 string doc = """Stage-level metadata that encodes a scene's 63 linear unit of measure as meters per encoded unit.""" 64 } 65 dictionary partition = { 66 string doc = """A type of family of GeomSubsets. It implies 67 that every element appears exacly once in only one of the 68 subsets in the family.""" 69 } 70 dictionary nonOverlapping = { 71 string doc = """A type of family of GeomSubsets. It implies that 72 the elements in the various subsets belonging to the family are 73 mutually exclusive, i.e., an element that appears in one 74 subset may not belong to any other subset in the family.""" 75 } 76 dictionary unrestricted = { 77 string doc = """A type of family of GeomSubsets. It implies that 78 there are no restrictions w.r.t. the membership of elements in 79 the subsets. There could be overlapping members in subsets 80 belonging to the family and the union of all subsets in the 81 family may not contain all the elements.""" 82 } 83 dictionary hermite = { 84 string doc = """A deprecated basis token for 85 UsdGeomBasisCurves. Consumers of USD should transition 86 to using the UsdGeomHermiteCurves schema.""" 87 } 88 dictionary power = { 89 string doc = """A deprecated basis token for 90 UsdGeomBasisCurves.""" 91 } 92 } 93 } 94) 95{ 96} 97 98class "Imageable" ( 99 inherits = </Typed> 100 doc = """Base class for all prims that may require rendering or 101 visualization of some sort. The primary attributes of Imageable 102 are \\em visibility and \\em purpose, which each provide instructions for 103 what geometry should be included for processing by rendering and other 104 computations. 105 106 \\deprecated Imageable also provides API for accessing primvars, which 107 has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now 108 be applied on non-Imageable prim types. This API is planned 109 to be removed, UsdGeomPrimvarsAPI should be used directly instead.""" 110 customData = { 111 string extraIncludes = """ 112#include "pxr/base/gf/bbox3d.h" 113#include "pxr/usd/usdGeom/primvar.h" """ 114 } 115) { 116 token visibility = "inherited" ( 117 allowedTokens = ["inherited", "invisible"] 118 doc = """Visibility is meant to be the simplest form of "pruning" 119 visibility that is supported by most DCC apps. Visibility is 120 animatable, allowing a sub-tree of geometry to be present for some 121 segment of a shot, and absent from others; unlike the action of 122 deactivating geometry prims, invisible geometry is still 123 available for inspection, for positioning, for defining volumes, etc.""" 124 ) 125 126 uniform token purpose = "default" ( 127 allowedTokens = ["default", "render", "proxy", "guide"] 128 doc = """Purpose is a classification of geometry into categories that 129 can each be independently included or excluded from traversals of prims 130 on a stage, such as rendering or bounding-box computation traversals. 131 132 See \\ref UsdGeom_ImageablePurpose for more detail about how 133 \\em purpose is computed and used.""" 134 ) 135 rel proxyPrim ( 136 doc = """The \\em proxyPrim relationship allows us to link a 137 prim whose \\em purpose is "render" to its (single target) 138 purpose="proxy" prim. This is entirely optional, but can be 139 useful in several scenarios: 140 141 \\li In a pipeline that does pruning (for complexity management) 142 by deactivating prims composed from asset references, when we 143 deactivate a purpose="render" prim, we will be able to discover 144 and additionally deactivate its associated purpose="proxy" prim, 145 so that preview renders reflect the pruning accurately. 146 147 \\li DCC importers may be able to make more aggressive optimizations 148 for interactive processing and display if they can discover the proxy 149 for a given render prim. 150 151 \\li With a little more work, a Hydra-based application will be able 152 to map a picked proxy prim back to its render geometry for selection. 153 154 \\note It is only valid to author the proxyPrim relationship on 155 prims whose purpose is "render".""" 156 ) 157} 158 159class "VisibilityAPI" 160( 161 inherits = </APISchemaBase> 162 customData = { 163 token[] apiSchemaCanOnlyApplyTo = [ 164 "Imageable" 165 ] 166 } 167 doc = """ 168 UsdGeomVisibilityAPI introduces properties that can be used to author 169 visibility opinions. 170 171 \\note 172 Currently, this schema only introduces the attributes that are used to 173 control purpose visibility. Later, this schema will define _all_ 174 visibility-related properties and UsdGeomImageable will no longer define 175 those properties. 176 177 The purpose visibility attributes added by this schema, 178 _guideVisibility_, _proxyVisibility_, and _renderVisibility_ can each be 179 used to control visibility for geometry of the corresponding purpose 180 values, with the overall _visibility_ attribute acting as an 181 override. I.e., if _visibility_ evaluates to "invisible", purpose 182 visibility is invisible; otherwise, purpose visibility is determined by 183 the corresponding purpose visibility attribute. 184 185 Note that the behavior of _guideVisibility_ is subtly different from the 186 _proxyVisibility_ and _renderVisibility_ attributes, in that "guide" 187 purpose visibility always evaluates to either "invisible" or "visible", 188 whereas the other attributes may yield computed values of "inherited" if 189 there is no authored opinion on the attribute or inherited from an 190 ancestor. This is motivated by the fact that, in Pixar"s user workflows, 191 we have never found a need to have all guides visible in a scene by 192 default, whereas we do find that flexibility useful for "proxy" and 193 "render" geometry. 194 195 This schema can only be applied to UsdGeomImageable prims. The 196 UseGeomImageable schema provides API for computing the purpose visibility 197 values that result from the attributes introduced by this schema. 198 """ 199) 200{ 201 uniform token guideVisibility = "invisible" ( 202 allowedTokens = ["inherited", "invisible", "visible"] 203 doc = """ 204 This attribute controls visibility for geometry with purpose "guide". 205 206 Unlike overall _visibility_, _guideVisibility_ is uniform, and 207 therefore cannot be animated. 208 209 Also unlike overall _visibility_, _guideVisibility_ is tri-state, in 210 that a descendant with an opinion of "visible" overrides an ancestor 211 opinion of "invisible". 212 213 The _guideVisibility_ attribute works in concert with the overall 214 _visibility_ attribute: The visibility of a prim with purpose "guide" 215 is determined by the inherited values it receives for the _visibility_ 216 and _guideVisibility_ attributes. If _visibility_ evaluates to 217 "invisible", the prim is invisible. If _visibility_ evaluates to 218 "inherited" and _guideVisibility_ evaluates to "visible", then the 219 prim is visible. __Otherwise, it is invisible.__ 220 """ 221 ) 222 223 uniform token proxyVisibility = "inherited" ( 224 allowedTokens = ["inherited", "invisible", "visible"] 225 doc = """ 226 This attribute controls visibility for geometry with purpose "proxy". 227 228 Unlike overall _visibility_, _proxyVisibility_ is uniform, and 229 therefore cannot be animated. 230 231 Also unlike overall _visibility_, _proxyVisibility_ is tri-state, in 232 that a descendant with an opinion of "visible" overrides an ancestor 233 opinion of "invisible". 234 235 The _proxyVisibility_ attribute works in concert with the overall 236 _visibility_ attribute: The visibility of a prim with purpose "proxy" 237 is determined by the inherited values it receives for the _visibility_ 238 and _proxyVisibility_ attributes. If _visibility_ evaluates to 239 "invisible", the prim is invisible. If _visibility_ evaluates to 240 "inherited" then: If _proxyVisibility_ evaluates to "visible", then 241 the prim is visible; if _proxyVisibility_ evaluates to "invisible", 242 then the prim is invisible; if _proxyVisibility_ evaluates to 243 "inherited", then the prim may either be visible or invisible, 244 depending on a fallback value determined by the calling context. 245 """ 246 ) 247 248 uniform token renderVisibility = "inherited" ( 249 allowedTokens = ["inherited", "invisible", "visible"] 250 doc = """ 251 This attribute controls visibility for geometry with purpose 252 "render". 253 254 Unlike overall _visibility_, _renderVisibility_ is uniform, and 255 therefore cannot be animated. 256 257 Also unlike overall _visibility_, _renderVisibility_ is tri-state, in 258 that a descendant with an opinion of "visible" overrides an ancestor 259 opinion of "invisible". 260 261 The _renderVisibility_ attribute works in concert with the overall 262 _visibility_ attribute: The visibility of a prim with purpose "render" 263 is determined by the inherited values it receives for the _visibility_ 264 and _renderVisibility_ attributes. If _visibility_ evaluates to 265 "invisible", the prim is invisible. If _visibility_ evaluates to 266 "inherited" then: If _renderVisibility_ evaluates to "visible", then 267 the prim is visible; if _renderVisibility_ evaluates to "invisible", 268 then the prim is invisible; if _renderVisibility_ evaluates to 269 "inherited", then the prim may either be visible or invisible, 270 depending on a fallback value determined by the calling context. 271 """ 272 ) 273} 274 275class "PrimvarsAPI" ( 276 inherits = </APISchemaBase> 277 doc = """UsdGeomPrimvarsAPI encodes geometric "primitive variables", 278 as UsdGeomPrimvar, which interpolate across a primitive's topology, 279 can override shader inputs, and inherit down namespace. 280 281 \\section usdGeom_PrimvarFetchingAPI Which Method to Use to Retrieve Primvars 282 283 While creating primvars is unambiguous (CreatePrimvar()), there are quite 284 a few methods available for retrieving primvars, making it potentially 285 confusing knowing which one to use. Here are some guidelines: 286 287 \\li If you are populating a GUI with the primvars already available for 288 authoring values on a prim, use GetPrimvars(). 289 \\li If you want all of the "useful" (e.g. to a renderer) primvars 290 available at a prim, including those inherited from ancestor prims, use 291 FindPrimvarsWithInheritance(). Note that doing so individually for many 292 prims will be inefficient. 293 \\li To find a particular primvar defined directly on a prim, which may 294 or may not provide a value, use GetPrimvar(). 295 \\li To find a particular primvar defined on a prim or inherited from 296 ancestors, which may or may not provide a value, use 297 FindPrimvarWithInheritance(). 298 \\li To *efficiently* query for primvars using the overloads of 299 FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one 300 must first cache the results of FindIncrementallyInheritablePrimvars() for 301 each non-leaf prim on the stage. """ 302 customData = { 303 token apiSchemaType = "nonApplied" 304 string extraIncludes = """ 305#include "pxr/usd/usdGeom/primvar.h" """ 306 } 307) { 308} 309 310class "Xformable" ( 311 inherits = </Imageable> 312 customData = { 313 string extraIncludes = """ 314#include "pxr/usd/usdGeom/xformOp.h" 315#include <vector> """ 316 } 317 doc = """Base class for all transformable prims, which allows arbitrary 318 sequences of component affine transformations to be encoded. 319 320 \\note 321 You may find it useful to review \\ref UsdGeom_LinAlgBasics while reading 322 this class description. 323 324 <b>Supported Component Transformation Operations</b> 325 326 UsdGeomXformable currently supports arbitrary sequences of the following 327 operations, each of which can be encoded in an attribute of the proper 328 shape in any supported precision: 329 \\li translate - 3D 330 \\li scale - 3D 331 \\li rotateX - 1D angle in degrees 332 \\li rotateY - 1D angle in degrees 333 \\li rotateZ - 1D angle in degrees 334 \\li rotateABC - 3D where ABC can be any combination of the six principle 335 Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See 336 \\ref usdGeom_rotationPackingOrder "note on rotation packing order" 337 \\li orient - 4D (quaternion) 338 \\li transform - 4x4D 339 340 <b>Creating a Component Transformation</b> 341 342 To add components to a UsdGeomXformable prim, simply call AddXformOp() 343 with the desired op type, as enumerated in \\ref UsdGeomXformOp::Type, 344 and the desired precision, which is one of \\ref UsdGeomXformOp::Precision. 345 Optionally, you can also provide an "op suffix" for the operator that 346 disambiguates it from other components of the same type on the same prim. 347 Application-specific transform schemas can use the suffixes to fill a role 348 similar to that played by AbcGeom::XformOp's "Hint" enums for their own 349 round-tripping logic. 350 351 We also provide specific "Add" API for each type, for clarity and 352 conciseness, e.g. AddTranslateOp(), AddRotateXYZOp() etc. 353 354 AddXformOp() will return a UsdGeomXformOp object, which is a schema on a 355 newly created UsdAttribute that provides convenience API for authoring 356 and computing the component transformations. The UsdGeomXformOp can then 357 be used to author any number of timesamples and default for the op. 358 359 Each successive call to AddXformOp() adds an operator that will be applied 360 "more locally" than the preceding operator, just as if we were pushing 361 transforms onto a transformation stack - which is precisely what should 362 happen when the operators are consumed by a reader. 363 364 \\note 365 If you can, please try to use the UsdGeomXformCommonAPI, which wraps 366 the UsdGeomXformable with an interface in which Op creation is taken 367 care of for you, and there is a much higher chance that the data you 368 author will be importable without flattening into other DCC's, as it 369 conforms to a fixed set of Scale-Rotate-Translate Ops. 370 371 \\sa \\ref usdGeom_xformableExamples "Using the Authoring API" 372 373 <b>Data Encoding and Op Ordering</b> 374 375 Because there is no "fixed schema" of operations, all of the attributes 376 that encode transform operations are dynamic, and are scoped in 377 the namespace "xformOp". The second component of an attribute's name provides 378 the \\em type of operation, as listed above. An "xformOp" attribute can 379 have additional namespace components derived from the \\em opSuffix argument 380 to the AddXformOp() suite of methods, which provides a preferred way of 381 naming the ops such that we can have multiple "translate" ops with unique 382 attribute names. For example, in the attribute named 383 "xformOp:translate:maya:pivot", "translate" is the type of operation and 384 "maya:pivot" is the suffix. 385 386 The following ordered list of attribute declarations in usda 387 define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the 388 translation is double-precision, and the remainder of the ops are single, 389 in which we will: 390 391 <ol> 392 <li> Scale by 2.0 in each dimension 393 <li> Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively 394 <li> Translate by 100 units in the Y direction 395 </ol> 396 397 \\code 398 float3 xformOp:rotateXYZ = (30, 60, 90) 399 float3 xformOp:scale = (2, 2, 2) 400 double3 xformOp:translate = (0, 100, 0) 401 uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale" ] 402 \\endcode 403 404 The attributes appear in the dictionary order in which USD, by default, 405 sorts them. To ensure the ops are recovered and evaluated in the correct 406 order, the schema introduces the **xformOpOrder** attribute, which 407 contains the names of the op attributes, in the precise sequence in which 408 they should be pushed onto a transform stack. **Note** that the order is 409 opposite to what you might expect, given the matrix algebra described in 410 \\ref UsdGeom_LinAlgBasics. This also dictates order of op creation, 411 since each call to AddXformOp() adds a new op to the end of the 412 \\b xformOpOrder array, as a new "most-local" operation. See 413 \\ref usdGeom_xformableExamples "Example 2 below" for C++ code that could 414 have produced this USD. 415 416 If it were important for the prim's rotations to be independently 417 overridable, we could equivalently (at some performance cost) encode 418 the transformation also like so: 419 \\code 420 float xformOp:rotateX = 30 421 float xformOp:rotateY = 60 422 float xformOp:rotateZ = 90 423 float3 xformOp:scale = (2, 2, 2) 424 double3 xformOp:translate = (0, 100, 0) 425 uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateZ", "xformOp:rotateY", "xformOp:rotateX", "xformOp:scale" ] 426 \\endcode 427 428 Again, note that although we are encoding an XYZ rotation, the three 429 rotations appear in the **xformOpOrder** in the opposite order, with Z, 430 followed, by Y, followed by X. 431 432 Were we to add a Maya-style scalePivot to the above example, it might 433 look like the following: 434 \\code 435 float3 xformOp:rotateXYZ = (30, 60, 90) 436 float3 xformOp:scale = (2, 2, 2) 437 double3 xformOp:translate = (0, 100, 0) 438 double3 xformOp:translate:scalePivot 439 uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale" ] 440 \\endcode 441 442 <b>Paired "Inverted" Ops</b> 443 444 We have been claiming that the ordered list of ops serves as a set 445 of instructions to a transform stack, but you may have noticed in the last 446 example that there is a missing operation - the pivot for the scale op 447 needs to be applied in its inverse-form as a final (most local) op! In the 448 AbcGeom::Xform schema, we would have encoded an actual "final" translation 449 op whose value was authored by the exporter as the negation of the pivot's 450 value. However, doing so would be brittle in USD, given that each op can 451 be independently overridden, and the constraint that one attribute must be 452 maintained as the negation of the other in order for successful 453 re-importation of the schema cannot be expressed in USD. 454 455 Our solution leverages the **xformOpOrder** member of the schema, which, 456 in addition to ordering the ops, may also contain one of two special 457 tokens that address the paired op and "stack resetting" behavior. 458 459 The "paired op" behavior is encoded as an "!invert!" prefix in 460 \\b xformOpOrder, as the result of an AddXformOp(isInverseOp=True) call. 461 The \\b xformOpOrder for the last example would look like: 462 \\code 463 uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale", "!invert!xformOp:translate:scalePivot" ] 464 \\endcode 465 466 When asked for its value via UsdGeomXformOp::GetOpTransform(), an 467 "inverted" Op (i.e. the "inverted" half of a set of paired Ops) will fetch 468 the value of its paired attribute and return its negation. This works for 469 all op types - an error will be issued if a "transform" type op is singular 470 and cannot be inverted. When getting the authored value of an inverted op 471 via UsdGeomXformOp::Get(), the raw, uninverted value of the associated 472 attribute is returned. 473 474 For the sake of robustness, <b>setting a value on an inverted op is disallowed.</b> 475 Attempting to set a value on an inverted op will result in a coding error 476 and no value being set. 477 478 <b>Resetting the Transform Stack</b> 479 480 The other special op/token that can appear in \\em xformOpOrder is 481 \\em "!resetXformStack!", which, appearing as the first element of 482 \\em xformOpOrder, indicates this prim should not inherit the transformation 483 of its namespace parent. See SetResetXformStack() 484 485 <b>Expected Behavior for "Missing" Ops</b> 486 487 If an importer expects Scale-Rotate-Translate operations, but a prim 488 has only translate and rotate ops authored, the importer should assume 489 an identity scale. This allows us to optimize the data a bit, if only 490 a few components of a very rich schema (like Maya's) are authored in the 491 app. 492 493 \\anchor usdGeom_xformableExamples 494 <b>Using the C++ API</b> 495 496 #1. Creating a simple transform matrix encoding 497 \\snippet examples.cpp CreateMatrixWithDefault 498 499 #2. Creating the simple SRT from the example above 500 \\snippet examples.cpp CreateExampleSRT 501 502 #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI 503 \\snippet examples.cpp CreateSRTWithDefaults 504 505 #4. Creating a rotate-only pivot transform with animated 506 rotation and translation 507 \\snippet examples.cpp CreateAnimatedTransform 508 509""" 510) { 511 512 uniform token[] xformOpOrder ( 513 doc = """Encodes the sequence of transformation operations in the 514 order in which they should be pushed onto a transform stack while 515 visiting a UsdStage's prims in a graph traversal that will effect 516 the desired positioning for this prim and its descendant prims. 517 518 You should rarely, if ever, need to manipulate this attribute directly. 519 It is managed by the AddXformOp(), SetResetXformStack(), and 520 SetXformOpOrder(), and consulted by GetOrderedXformOps() and 521 GetLocalTransformation().""" 522 ) 523} 524 525class Scope "Scope" ( 526 inherits = </Imageable> 527 doc = """Scope is the simplest grouping primitive, and does not carry the 528 baggage of transformability. Note that transforms should inherit down 529 through a Scope successfully - it is just a guaranteed no-op from a 530 transformability perspective.""" 531) { 532} 533 534class Xform "Xform" ( 535 inherits = </Xformable> 536 doc = """Concrete prim schema for a transform, which implements Xformable """ 537) { 538} 539 540class "Boundable" ( 541 inherits = </Xformable> 542 doc = """Boundable introduces the ability for a prim to persistently 543 cache a rectilinear, local-space, extent. 544 545 \\section UsdGeom_Boundable_Extent Why Extent and not Bounds ? 546 Boundable introduces the notion of "extent", which is a cached computation 547 of a prim's local-space 3D range for its resolved attributes <b>at the 548 layer and time in which extent is authored</b>. We have found that with 549 composed scene description, attempting to cache pre-computed bounds at 550 interior prims in a scene graph is very fragile, given the ease with which 551 one can author a single attribute in a stronger layer that can invalidate 552 many authored caches - or with which a re-published, referenced asset can 553 do the same. 554 555 Therefore, we limit to precomputing (generally) leaf-prim extent, which 556 avoids the need to read in large point arrays to compute bounds, and 557 provides UsdGeomBBoxCache the means to efficiently compute and 558 (session-only) cache intermediate bounds. You are free to compute and 559 author intermediate bounds into your scenes, of course, which may work 560 well if you have sufficient locks on your pipeline to guarantee that once 561 authored, the geometry and transforms upon which they are based will 562 remain unchanged, or if accuracy of the bounds is not an ironclad 563 requisite. 564 565 When intermediate bounds are authored on Boundable parents, the child prims 566 will be pruned from BBox computation; the authored extent is expected to 567 incorporate all child bounds.""" 568) 569{ 570 # XXX: Note this is really a GfRange3f, which is not fully supported 571 # in Vt I/O. 572 float3[] extent ( 573 doc = """Extent is a three dimensional range measuring the geometric 574 extent of the authored gprim in its own local space (i.e. its own 575 transform not applied), \\em without accounting for any shader-induced 576 displacement. Whenever any geometry-affecting attribute is authored 577 for any gprim in a layer, extent must also be authored at the same 578 timesample; failure to do so will result in incorrect bounds-computation. 579 \\sa \\ref UsdGeom_Boundable_Extent. 580 581 An authored extent on a prim which has children is expected to include 582 the extent of all children, as they will be pruned from BBox computation 583 during traversal.""" 584 ) 585} 586 587class "Gprim" ( 588 inherits = </Boundable> 589 doc = """Base class for all geometric primitives. 590 591 Gprim encodes basic graphical properties such as \\em doubleSided and 592 \\em orientation, and provides primvars for "display color" and "display 593 opacity" that travel with geometry to be used as shader overrides. """ 594 595) { 596 color3f[] primvars:displayColor ( 597 customData = { 598 string apiName = "displayColor" 599 } 600 doc = """It is useful to have an "official" colorSet that can be used 601 as a display or modeling color, even in the absence of any specified 602 shader for a gprim. DisplayColor serves this role; because it is a 603 UsdGeomPrimvar, it can also be used as a gprim override for any shader 604 that consumes a \\em displayColor parameter.""" 605 ) 606 607 float[] primvars:displayOpacity ( 608 customData = { 609 string apiName = "displayOpacity" 610 } 611 doc = """Companion to \\em displayColor that specifies opacity, broken 612 out as an independent attribute rather than an rgba color, both so that 613 each can be independently overridden, and because shaders rarely consume 614 rgba parameters.""" 615 ) 616 617 uniform bool doubleSided = false ( 618 doc = """Although some renderers treat all parametric or polygonal 619 surfaces as if they were effectively laminae with outward-facing 620 normals on both sides, some renderers derive significant optimizations 621 by considering these surfaces to have only a single outward side, 622 typically determined by control-point winding order and/or 623 \\em orientation. By doing so they can perform "backface culling" to 624 avoid drawing the many polygons of most closed surfaces that face away 625 from the viewer. 626 627 However, it is often advantageous to model thin objects such as paper 628 and cloth as single, open surfaces that must be viewable from both 629 sides, always. Setting a gprim's \\em doubleSided attribute to 630 \\c true instructs all renderers to disable optimizations such as 631 backface culling for the gprim, and attempt (not all renderers are able 632 to do so, but the USD reference GL renderer always will) to provide 633 forward-facing normals on each side of the surface for lighting 634 calculations.""" 635 ) 636 637 uniform token orientation = "rightHanded" ( 638 allowedTokens = ["rightHanded", "leftHanded"] 639 doc = """Orientation specifies whether the gprim's surface normal 640 should be computed using the right hand rule, or the left hand rule. 641 Please see \\ref UsdGeom_WindingOrder for a deeper explanation and 642 generalization of orientation to composed scenes with transformation 643 hierarchies.""" 644 ) 645} 646 647class Cube "Cube" ( 648 inherits = </Gprim> 649 doc = """Defines a primitive rectilinear cube centered at the origin. 650 651 The fallback values for Cube, Sphere, Cone, and Cylinder are set so that 652 they all pack into the same volume/bounds.""" 653 customData = { 654 dictionary extraPlugInfo = { 655 bool implementsComputeExtent = true 656 } 657 } 658) { 659 double size = 2.0 ( 660 doc = """Indicates the length of each edge of the cube. If you 661 author \\em size you must also author \\em extent. 662 663 \\sa GetExtentAttr()""" 664 ) 665 666 float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( 667 doc = """Extent is re-defined on Cube only to provide a fallback value. 668 \\sa UsdGeomGprim::GetExtentAttr().""" 669 ) 670 671} 672 673class Sphere "Sphere" ( 674 inherits = </Gprim> 675 doc = """Defines a primitive sphere centered at the origin. 676 677 The fallback values for Cube, Sphere, Cone, and Cylinder are set so that 678 they all pack into the same volume/bounds.""" 679 customData = { 680 dictionary extraPlugInfo = { 681 bool implementsComputeExtent = true 682 } 683 } 684) { 685 double radius = 1.0 ( 686 doc = """Indicates the sphere's radius. If you 687 author \\em radius you must also author \\em extent. 688 689 \\sa GetExtentAttr()""" 690 ) 691 692 float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( 693 doc = """Extent is re-defined on Sphere only to provide a fallback 694 value. \\sa UsdGeomGprim::GetExtentAttr().""" 695 ) 696} 697 698class Cylinder "Cylinder" ( 699 inherits = </Gprim> 700 doc = """Defines a primitive cylinder with closed ends, centered at the 701 origin, whose spine is along the specified \\em axis. 702 703 The fallback values for Cube, Sphere, Cone, and Cylinder are set so that 704 they all pack into the same volume/bounds.""" 705 customData = { 706 dictionary extraPlugInfo = { 707 bool implementsComputeExtent = true 708 } 709 } 710) { 711 double height = 2 ( 712 doc = """The size of the cylinder's spine along the specified 713 \\em axis. If you author \\em height you must also author \\em extent. 714 715 \\sa GetExtentAttr()""" 716 ) 717 double radius = 1.0 ( 718 doc = """The radius of the cylinder. If you author \\em radius 719 you must also author \\em extent. 720 721 \\sa GetExtentAttr()""" 722 ) 723 uniform token axis = "Z" ( 724 allowedTokens = ["X", "Y", "Z"] 725 doc = """The axis along which the spine of the cylinder is aligned""" 726 ) 727 728 float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( 729 doc = """Extent is re-defined on Cylinder only to provide a fallback 730 value. \\sa UsdGeomGprim::GetExtentAttr().""" 731 ) 732} 733 734class Capsule "Capsule" ( 735 inherits = </Gprim> 736 doc = """Defines a primitive capsule, i.e. a cylinder capped by two half 737 spheres, centered at the origin, whose spine is along the specified 738 \\em axis.""" 739 customData = { 740 dictionary extraPlugInfo = { 741 bool implementsComputeExtent = true 742 } 743 } 744) { 745 double height = 1.0 ( 746 doc = """The size of the capsule's spine along the specified 747 \\em axis excluding the size of the two half spheres, i.e. 748 the size of the cylinder portion of the capsule. 749 If you author \\em height you must also author \\em extent. 750 \\sa GetExtentAttr()""" 751 ) 752 double radius = 0.5 ( 753 doc = """The radius of the capsule. If you 754 author \\em radius you must also author \\em extent. 755 756 \\sa GetExtentAttr()""" 757 ) 758 uniform token axis = "Z" ( 759 allowedTokens = ["X", "Y", "Z"] 760 doc = """The axis along which the spine of the capsule is aligned""" 761 ) 762 763 float3[] extent = [(-0.5, -0.5, -1.0), (0.5, 0.5, 1.0)] ( 764 doc = """Extent is re-defined on Capsule only to provide a fallback 765 value. \\sa UsdGeomGprim::GetExtentAttr().""" 766 ) 767} 768 769class Cone "Cone" ( 770 inherits = </Gprim> 771 doc = """Defines a primitive cone, centered at the origin, whose spine 772 is along the specified \\em axis, with the apex of the cone pointing 773 in the direction of the positive axis. 774 775 The fallback values for Cube, Sphere, Cone, and Cylinder are set so that 776 they all pack into the same volume/bounds.""" 777 customData = { 778 dictionary extraPlugInfo = { 779 bool implementsComputeExtent = true 780 } 781 } 782) { 783 double height = 2.0 ( 784 doc = """The size of the cone's spine along the specified 785 \\em axis. If you author \\em height you must also author \\em extent. 786 787 \\sa GetExtentAttr()""" 788 ) 789 double radius = 1.0 ( 790 doc = """The radius of the cone. If you 791 author \\em radius you must also author \\em extent. 792 793 \\sa GetExtentAttr()""" 794 ) 795 uniform token axis = "Z" ( 796 allowedTokens = ["X", "Y", "Z"] 797 doc = """The axis along which the spine of the cone is aligned""" 798 ) 799 800 float3[] extent = [(-1.0, -1.0, -1.0), (1.0, 1.0, 1.0)] ( 801 doc = """Extent is re-defined on Cone only to provide a fallback 802 value. \\sa UsdGeomGprim::GetExtentAttr().""" 803 ) 804} 805 806class "PointBased" ( 807 doc = """Base class for all UsdGeomGprims that possess points, 808 providing common attributes such as normals and velocities.""" 809 810 inherits = </Gprim> 811 customData = { 812 dictionary extraPlugInfo = { 813 bool implementsComputeExtent = true 814 } 815 } 816) { 817 # positional 818 point3f[] points ( 819 doc = """The primary geometry attribute for all PointBased 820 primitives, describes points in (local) space.""" 821 ) 822 823 vector3f[] velocities ( 824 doc = """If provided, 'velocities' should be used by renderers to 825 826 compute positions between samples for the 'points' attribute, rather 827 than interpolating between neighboring 'points' samples. This is the 828 only reasonable means of computing motion blur for topologically 829 varying PointBased primitives. It follows that the length of each 830 'velocities' sample must match the length of the corresponding 831 'points' sample. Velocity is measured in position units per second, 832 as per most simulation software. To convert to position units per 833 UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). 834 835 See also \\ref UsdGeom_VelocityInterpolation .""" 836 ) 837 838 vector3f[] accelerations ( 839 doc = """If provided, 'accelerations' should be used with 840 velocities to compute positions between samples for the 'points' 841 attribute rather than interpolating between neighboring 'points' 842 samples. Acceleration is measured in position units per second-squared. 843 To convert to position units per squared UsdTimeCode, divide by the 844 square of UsdStage::GetTimeCodesPerSecond().""" 845 ) 846 847 # shaping 848 normal3f[] normals ( 849 doc = """Provide an object-space orientation for individual points, 850 which, depending on subclass, may define a surface, curve, or free 851 points. Note that 'normals' should not be authored on any Mesh that 852 is subdivided, since the subdivision algorithm will define its own 853 normals. 'normals' is not a generic primvar, but the number of elements 854 in this attribute will be determined by its 'interpolation'. See 855 \\ref SetNormalsInterpolation() . If 'normals' and 'primvars:normals' 856 are both specified, the latter has precedence.""" 857 ) 858} 859 860class Mesh "Mesh" ( 861 inherits = </PointBased> 862 customData = { 863 string extraIncludes = """ 864#include "pxr/usd/usd/timeCode.h" """ 865 } 866 doc="""Encodes a mesh with optional subdivision properties and features. 867 868 As a point-based primitive, meshes are defined in terms of points that 869 are connected into edges and faces. Many references to meshes use the 870 term 'vertex' in place of or interchangeably with 'points', while some 871 use 'vertex' to refer to the 'face-vertices' that define a face. To 872 avoid confusion, the term 'vertex' is intentionally avoided in favor of 873 'points' or 'face-vertices'. 874 875 The connectivity between points, edges and faces is encoded using a 876 common minimal topological description of the faces of the mesh. Each 877 face is defined by a set of face-vertices using indices into the Mesh's 878 _points_ array (inherited from UsdGeomPointBased) and laid out in a 879 single linear _faceVertexIndices_ array for efficiency. A companion 880 _faceVertexCounts_ array provides, for each face, the number of 881 consecutive face-vertices in _faceVertexIndices_ that define the face. 882 No additional connectivity information is required or constructed, so 883 no adjacency or neighborhood queries are available. 884 885 A key property of this mesh schema is that it encodes both subdivision 886 surfaces and simpler polygonal meshes. This is achieved by varying the 887 _subdivisionScheme_ attribute, which is set to specify Catmull-Clark 888 subdivision by default, so polygonal meshes must always be explicitly 889 declared. The available subdivision schemes and additional subdivision 890 features encoded in optional attributes conform to the feature set of 891 OpenSubdiv 892 (https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html). 893 894 \\anchor UsdGeom_Mesh_Primvars 895 __A Note About Primvars__ 896 897 The following list clarifies the number of elements for and the 898 interpolation behavior of the different primvar interpolation types 899 for meshes: 900 901 - __constant__: One element for the entire mesh; no interpolation. 902 - __uniform__: One element for each face of the mesh; elements are 903 typically not interpolated but are inherited by other faces derived 904 from a given face (via subdivision, tessellation, etc.). 905 - __varying__: One element for each point of the mesh; 906 interpolation of point data is always linear. 907 - __vertex__: One element for each point of the mesh; 908 interpolation of point data is applied according to the 909 _subdivisionScheme_ attribute. 910 - __faceVarying__: One element for each of the face-vertices that 911 define the mesh topology; interpolation of face-vertex data may 912 be smooth or linear, according to the _subdivisionScheme_ and 913 _faceVaryingLinearInterpolation_ attributes. 914 915 Primvar interpolation types and related utilities are described more 916 generally in \\ref Usd_InterpolationVals. 917 918 \\anchor UsdGeom_Mesh_Normals 919 __A Note About Normals__ 920 921 Normals should not be authored on a subdivision mesh, since subdivision 922 algorithms define their own normals. They should only be authored for 923 polygonal meshes (_subdivisionScheme_ = "none"). 924 925 The _normals_ attribute inherited from UsdGeomPointBased is not a generic 926 primvar, but the number of elements in this attribute will be determined by 927 its _interpolation_. See \\ref UsdGeomPointBased::GetNormalsInterpolation() . 928 If _normals_ and _primvars:normals_ are both specified, the latter has 929 precedence. If a polygonal mesh specifies __neither__ _normals_ nor 930 _primvars:normals_, then it should be treated and rendered as faceted, 931 with no attempt to compute smooth normals. 932 933 The normals generated for smooth subdivision schemes, e.g. Catmull-Clark 934 and Loop, will likewise be smooth, but others, e.g. Bilinear, may be 935 discontinuous between faces and/or within non-planar irregular faces.""" 936) { 937 # 938 # Common Properties 939 # 940 int[] faceVertexIndices ( 941 doc = """Flat list of the index (into the _points_ attribute) of each 942 vertex of each face in the mesh. If this attribute has more than 943 one timeSample, the mesh is considered to be topologically varying.""" 944 ) 945 946 int[] faceVertexCounts ( 947 doc = """Provides the number of vertices in each face of the mesh, 948 which is also the number of consecutive indices in _faceVertexIndices_ 949 that define the face. The length of this attribute is the number of 950 faces in the mesh. If this attribute has more than 951 one timeSample, the mesh is considered to be topologically varying.""" 952 ) 953 954 # 955 # Subdiv Properties 956 # 957 958 uniform token subdivisionScheme = "catmullClark" ( 959 allowedTokens = ["catmullClark", "loop", "bilinear", "none"] 960 doc = """The subdivision scheme to be applied to the surface. 961 Valid values are: 962 963 - __catmullClark__: The default, Catmull-Clark subdivision; preferred 964 for quad-dominant meshes (generalizes B-splines); interpolation 965 of point data is smooth (non-linear) 966 - __loop__: Loop subdivision; preferred for purely triangular meshes; 967 interpolation of point data is smooth (non-linear) 968 - __bilinear__: Subdivision reduces all faces to quads (topologically 969 similar to "catmullClark"); interpolation of point data is bilinear 970 - __none__: No subdivision, i.e. a simple polygonal mesh; interpolation 971 of point data is linear 972 973 Polygonal meshes are typically lighter weight and faster to render, 974 depending on renderer and render mode. Use of "bilinear" will produce 975 a similar shape to a polygonal mesh and may offer additional guarantees 976 of watertightness and additional subdivision features (e.g. holes) but 977 may also not respect authored normals.""") 978 979 token interpolateBoundary = "edgeAndCorner" ( 980 allowedTokens = ["none", "edgeOnly", "edgeAndCorner"] 981 doc = """Specifies how subdivision is applied for faces adjacent to 982 boundary edges and boundary points. Valid values correspond to choices 983 available in OpenSubdiv: 984 985 - __none__: No boundary interpolation is applied and boundary faces are 986 effectively treated as holes 987 - __edgeOnly__: A sequence of boundary edges defines a smooth curve to 988 which the edges of subdivided boundary faces converge 989 - __edgeAndCorner__: The default, similar to "edgeOnly" but the smooth 990 boundary curve is made sharp at corner points 991 992 These are illustrated and described in more detail in the OpenSubdiv 993 documentation: 994 https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#boundary-interpolation-rules""") 995 996 token faceVaryingLinearInterpolation = "cornersPlus1" ( 997 allowedTokens = ["none", "cornersOnly", "cornersPlus1", 998 "cornersPlus2", "boundaries", "all"] 999 doc = """Specifies how elements of a primvar of interpolation type 1000 "faceVarying" are interpolated for subdivision surfaces. Interpolation 1001 can be as smooth as a "vertex" primvar or constrained to be linear at 1002 features specified by several options. Valid values correspond to 1003 choices available in OpenSubdiv: 1004 1005 - __none__: No linear constraints or sharpening, smooth everywhere 1006 - __cornersOnly__: Sharpen corners of discontinuous boundaries only, 1007 smooth everywhere else 1008 - __cornersPlus1__: The default, same as "cornersOnly" plus additional 1009 sharpening at points where three or more distinct face-varying 1010 values occur 1011 - __cornersPlus2__: Same as "cornersPlus1" plus additional sharpening 1012 at points with at least one discontinuous boundary corner or 1013 only one discontinuous boundary edge (a dart) 1014 - __boundaries__: Piecewise linear along discontinuous boundaries, 1015 smooth interior 1016 - __all__: Piecewise linear everywhere 1017 1018 These are illustrated and described in more detail in the OpenSubdiv 1019 documentation: 1020 https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules""") 1021 1022 token triangleSubdivisionRule = "catmullClark" ( 1023 allowedTokens = ["catmullClark", "smooth"] 1024 doc = """Specifies an option to the subdivision rules for the 1025 Catmull-Clark scheme to try and improve undesirable artifacts when 1026 subdividing triangles. Valid values are "catmullClark" for the 1027 standard rules (the default) and "smooth" for the improvement. 1028 1029 See https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle-subdivision-rule""") 1030 1031 int[] holeIndices = [] ( 1032 doc = """The indices of all faces that should be treated as holes, 1033 i.e. made invisible. This is traditionally a feature of subdivision 1034 surfaces and not generally applied to polygonal meshes.""") 1035 1036 int[] cornerIndices = [] ( 1037 doc = """The indices of points for which a corresponding sharpness 1038 value is specified in _cornerSharpnesses_ (so the size of this array 1039 must match that of _cornerSharpnesses_).""") 1040 1041 float[] cornerSharpnesses = [] ( 1042 doc = """The sharpness values associated with a corresponding set of 1043 points specified in _cornerIndices_ (so the size of this array must 1044 match that of _cornerIndices_). Use the constant `SHARPNESS_INFINITE` 1045 for a perfectly sharp corner.""") 1046 1047 int[] creaseIndices = [] ( 1048 doc = """The indices of points grouped into sets of successive pairs 1049 that identify edges to be creased. The size of this array must be 1050 equal to the sum of all elements of the _creaseLengths_ attribute.""") 1051 1052 int[] creaseLengths = [] ( 1053 doc = """The length of this array specifies the number of creases 1054 (sets of adjacent sharpened edges) on the mesh. Each element gives 1055 the number of points of each crease, whose indices are successively 1056 laid out in the _creaseIndices_ attribute. Since each crease must 1057 be at least one edge long, each element of this array must be at 1058 least two.""") 1059 1060 float[] creaseSharpnesses = [] ( 1061 doc = """The per-crease or per-edge sharpness values for all creases. 1062 Since _creaseLengths_ encodes the number of points in each crease, 1063 the number of elements in this array will be either len(creaseLengths) 1064 or the sum over all X of (creaseLengths[X] - 1). Note that while 1065 the RI spec allows each crease to have either a single sharpness 1066 or a value per-edge, USD will encode either a single sharpness 1067 per crease on a mesh, or sharpnesses for all edges making up 1068 the creases on a mesh. Use the constant `SHARPNESS_INFINITE` for a 1069 perfectly sharp crease.""") 1070} 1071 1072class GeomSubset "GeomSubset" ( 1073 inherits = </Typed> 1074 doc = """Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) 1075 as a set of indices. Currently only supports encoding of face-subsets, but 1076 could be extended in the future to support subsets representing edges, 1077 segments, points etc. 1078 1079 To apply to a geometric prim, a GeomSubset prim must be defined as a 1080 child of it in namespace. This restriction makes it easy and efficient 1081 to discover subsets of a prim. We might want to relax this restriction if 1082 it's common to have multiple <b>families</b> of subsets on a gprim and if 1083 it's useful to be able to organize subsets belonging to a </b>family</b> 1084 under a common scope. See 'familyName' attribute for more info on defining 1085 a family of subsets. 1086 1087 Note that a GeomSubset isn't an imageable (i.e. doesn't derive from 1088 UsdGeomImageable). So, you can't author <b>visibility</b> for it or 1089 override its <b>purpose</b>. 1090 1091 Materials are bound to GeomSubsets just as they are for regular 1092 geometry using API available in UsdShade (UsdShadeMaterial::Bind). 1093""" 1094 customData = { 1095 string className = "Subset" 1096 string extraIncludes = """ 1097#include "pxr/base/tf/token.h" 1098#include "pxr/usd/usdGeom/imageable.h" 1099""" 1100 } 1101) 1102{ 1103 uniform token elementType = "face" ( 1104 allowedTokens = ["face"] 1105 doc = """The type of element that the indices target. Currently only 1106 allows "face" and defaults to it.""" 1107 ) 1108 int[] indices = [] ( 1109 doc = """The set of indices included in this subset. The indices need not 1110 be sorted, but the same index should not appear more than once.""" 1111 ) 1112 uniform token familyName = "" ( 1113 doc = """The name of the family of subsets that this subset belongs to. 1114 This is optional and is primarily useful when there are multiple 1115 families of subsets under a geometric prim. In some cases, this could 1116 also be used for achieving proper roundtripping of subset data between 1117 DCC apps. 1118 When multiple subsets belonging to a prim have the same familyName, they 1119 are said to belong to the family. A <i>familyType</i> value can be 1120 encoded on the owner of a family of subsets as a token using the static 1121 method UsdGeomSubset::SetFamilyType(). "familyType" can have one of the 1122 following values: 1123 <ul><li><b>UsdGeomTokens->partition</b>: implies that every element of 1124 the whole geometry appears exactly once in only one of the subsets 1125 belonging to the family.</li> 1126 <li><b>UsdGeomTokens->nonOverlapping</b>: an element that appears in one 1127 subset may not appear in any other subset belonging to the family.</li> 1128 <li><b>UsdGeomTokens->unrestricted</b>: implies that there are no 1129 restrictions w.r.t. the membership of elements in the subsets. They 1130 could be overlapping and the union of all subsets in the family may 1131 not represent the whole.</li> 1132 </ul> 1133 \\note The validity of subset data is not enforced by the authoring 1134 APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). 1135 """ 1136 ) 1137} 1138 1139class NurbsPatch "NurbsPatch" ( 1140 inherits = </PointBased> 1141 doc = """Encodes a rational or polynomial non-uniform B-spline 1142 surface, with optional trim curves. 1143 1144 The encoding mostly follows that of RiNuPatch and RiTrimCurve: 1145 https://renderman.pixar.com/resources/current/RenderMan/geometricPrimitives.html#rinupatch , with some minor renaming and coalescing for clarity. 1146 1147 The layout of control vertices in the \\em points attribute inherited 1148 from UsdGeomPointBased is row-major with U considered rows, and V columns. 1149 1150 \\anchor UsdGeom_NurbsPatch_Form 1151 <b>NurbsPatch Form</b> 1152 1153 The authored points, orders, knots, weights, and ranges are all that is 1154 required to render the nurbs patch. However, the only way to model closed 1155 surfaces with nurbs is to ensure that the first and last control points 1156 along the given axis are coincident. Similarly, to ensure the surface is 1157 not only closed but also C2 continuous, the last \\em order - 1 control 1158 points must be (correspondingly) coincident with the first \\em order - 1 1159 control points, and also the spacing of the last corresponding knots 1160 must be the same as the first corresponding knots. 1161 1162 <b>Form</b> is provided as an aid to interchange between modeling and 1163 animation applications so that they can robustly identify the intent with 1164 which the surface was modelled, and take measures (if they are able) to 1165 preserve the continuity/concidence constraints as the surface may be rigged 1166 or deformed. 1167 \\li An \\em open-form NurbsPatch has no continuity constraints. 1168 \\li A \\em closed-form NurbsPatch expects the first and last control points 1169 to overlap 1170 \\li A \\em periodic-form NurbsPatch expects the first and last 1171 \\em order - 1 control points to overlap. 1172 1173 <b>Nurbs vs Subdivision Surfaces</b> 1174 1175 Nurbs are an important modeling primitive in CAD/CAM tools and early 1176 computer graphics DCC's. Because they have a natural UV parameterization 1177 they easily support "trim curves", which allow smooth shapes to be 1178 carved out of the surface. 1179 1180 However, the topology of the patch is always rectangular, and joining two 1181 nurbs patches together (especially when they have differing numbers of 1182 spans) is difficult to do smoothly. Also, nurbs are not supported by 1183 the Ptex texturing technology (http://ptex.us). 1184 1185 Neither of these limitations are shared by subdivision surfaces; therefore, 1186 although they do not subscribe to trim-curve-based shaping, subdivs are 1187 often considered a more flexible modeling primitive. 1188 """ 1189) { 1190 int uVertexCount ( 1191 doc = """Number of vertices in the U direction. Should be at least as 1192 large as uOrder.""" 1193 ) 1194 1195 int vVertexCount ( 1196 doc = """Number of vertices in the V direction. Should be at least as 1197 large as vOrder.""" 1198 ) 1199 1200 int uOrder ( 1201 doc = """Order in the U direction. Order must be positive and is 1202 equal to the degree of the polynomial basis to be evaluated, plus 1.""" 1203 ) 1204 1205 int vOrder ( 1206 doc = """Order in the V direction. Order must be positive and is 1207 equal to the degree of the polynomial basis to be evaluated, plus 1.""" 1208 ) 1209 1210 double[] uKnots ( 1211 doc = """Knot vector for U direction providing U parameterization. 1212 The length of this array must be ( uVertexCount + uOrder ), and its 1213 entries must take on monotonically increasing values.""" 1214 ) 1215 1216 double[] vKnots ( 1217 doc = """Knot vector for V direction providing U parameterization. 1218 The length of this array must be ( vVertexCount + vOrder ), and its 1219 entries must take on monotonically increasing values.""" 1220 ) 1221 1222 uniform token uForm = "open" ( 1223 allowedTokens = ["open", "closed", "periodic"] 1224 doc = """Interpret the control grid and knot vectors as representing 1225 an open, geometrically closed, or geometrically closed and C2 continuous 1226 surface along the U dimension. 1227 \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ 1228 ) 1229 1230 uniform token vForm = "open" ( 1231 allowedTokens = ["open", "closed", "periodic"] 1232 doc = """Interpret the control grid and knot vectors as representing 1233 an open, geometrically closed, or geometrically closed and C2 continuous 1234 surface along the V dimension. 1235 \\sa \\ref UsdGeom_NurbsPatch_Form "NurbsPatch Form" """ 1236 ) 1237 1238 # Alembic's NuPatch does not encode these... wonder how they 1239 # get away with that? Just assume it's the full range, presumably. 1240 double2 uRange ( 1241 doc = """Provides the minimum and maximum parametric values (as defined 1242 by uKnots) over which the surface is actually defined. The minimum 1243 must be less than the maximum, and greater than or equal to the 1244 value of uKnots[uOrder-1]. The maxium must be less than or equal 1245 to the last element's value in uKnots.""" 1246 ) 1247 1248 double2 vRange ( 1249 doc = """Provides the minimum and maximum parametric values (as defined 1250 by vKnots) over which the surface is actually defined. The minimum 1251 must be less than the maximum, and greater than or equal to the 1252 value of vKnots[vOrder-1]. The maxium must be less than or equal 1253 to the last element's value in vKnots.""" 1254 ) 1255 1256 double[] pointWeights ( 1257 doc = """Optionally provides "w" components for each control point, 1258 thus must be the same length as the points attribute. If authored, 1259 the patch will be rational. If unauthored, the patch will be 1260 polynomial, i.e. weight for all points is 1.0. 1261 \\note Some DCC's pre-weight the \\em points, but in this schema, 1262 \\em points are not pre-weighted.""" 1263 ) 1264 1265 int[] trimCurve:counts ( 1266 doc = """Each element specifies how many curves are present in each 1267 "loop" of the trimCurve, and the length of the array determines how 1268 many loops the trimCurve contains. The sum of all elements is the 1269 total nuber of curves in the trim, to which we will refer as 1270 \\em nCurves in describing the other trim attributes.""" 1271 ) 1272 1273 int[] trimCurve:orders ( 1274 doc = """Flat list of orders for each of the \\em nCurves curves.""" 1275 ) 1276 1277 int[] trimCurve:vertexCounts ( 1278 doc = """Flat list of number of vertices for each of the 1279 \\em nCurves curves.""" 1280 ) 1281 1282 double[] trimCurve:knots ( 1283 doc = """Flat list of parametric values for each of the 1284 \\em nCurves curves. There will be as many knots as the sum over 1285 all elements of \\em vertexCounts plus the sum over all elements of 1286 \\em orders.""" 1287 ) 1288 1289 double2[] trimCurve:ranges ( 1290 doc = """Flat list of minimum and maximum parametric values 1291 (as defined by \\em knots) for each of the \\em nCurves curves.""" 1292 ) 1293 1294 double3[] trimCurve:points ( 1295 doc = """Flat list of homogeneous 2D points (u, v, w) that comprise 1296 the \\em nCurves curves. The number of points should be equal to the 1297 um over all elements of \\em vertexCounts.""" 1298 ) 1299 1300} 1301 1302class "Curves" ( 1303 customData = { 1304 dictionary extraPlugInfo = { 1305 bool implementsComputeExtent = true 1306 } 1307 } 1308 inherits = </PointBased> 1309 doc = """Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and 1310 UsdGeomHermiteCurves. The BasisCurves schema is designed to be 1311 analagous to offline renderers' notion of batched curves (such as 1312 the classical RIB definition via Basis and Curves statements), 1313 while the NurbsCurve schema is designed to be analgous to the 1314 NURBS curves found in packages like Maya and Houdini while 1315 retaining their consistency with the RenderMan specification for 1316 NURBS Patches. HermiteCurves are useful for the 1317 interchange of animation guides and paths. 1318 1319 It is safe to use the length of the curve vertex count to derive 1320 the number of curves and the number and layout of curve vertices, 1321 but this schema should NOT be used to derive the number of curve 1322 points. While vertex indices are implicit in all shipped 1323 descendent types of this schema, one should not assume that all 1324 internal or future shipped schemas will follow this pattern. Be 1325 sure to key any indexing behavior off the concrete type, not this 1326 abstract type. 1327 """ 1328) { 1329 # topology attributes 1330 int[] curveVertexCounts ( 1331 doc = """Curves-derived primitives can represent multiple distinct, 1332 potentially disconnected curves. The length of 'curveVertexCounts' 1333 gives the number of such curves, and each element describes the 1334 number of vertices in the corresponding curve""" 1335 ) 1336 1337 # shaping attributes 1338 float[] widths ( 1339 doc = """Provides width specification for the curves, whose application 1340 will depend on whether the curve is oriented (normals are defined for 1341 it), in which case widths are "ribbon width", or unoriented, in which 1342 case widths are cylinder width. 'widths' is not a generic Primvar, 1343 but the number of elements in this attribute will be determined by 1344 its 'interpolation'. See \\ref SetWidthsInterpolation() . If 'widths' 1345 and 'primvars:widths' are both specified, the latter has precedence.""" 1346 ) 1347} 1348 1349class BasisCurves "BasisCurves" ( 1350 inherits = </Curves> 1351 doc = """BasisCurves are a batched curve representation analogous to the 1352 classic RIB definition via Basis and Curves statements. BasisCurves are 1353 often used to render dense aggregate geometry like hair or grass. 1354 1355 A 'matrix' and 'vstep' associated with the \\em basis are used to 1356 interpolate the vertices of a cubic BasisCurves. (The basis attribute 1357 is unused for linear BasisCurves.) 1358 1359 A single prim may have many curves whose count is determined implicitly by 1360 the length of the \\em curveVertexCounts vector. Each individual curve is 1361 composed of one or more segments. Each segment is defined by four vertices 1362 for cubic curves and two vertices for linear curves. See the next section 1363 for more information on how to map curve vertex counts to segment counts. 1364 1365 \\section UsdGeomBasisCurves_Segment Segment Indexing 1366 Interpolating a curve requires knowing how to decompose it into its 1367 individual segments. 1368 1369 The segments of a cubic curve are determined by the vertex count, 1370 the \\em wrap (periodicity), and the vstep of the basis. For linear 1371 curves, the basis token is ignored and only the vertex count and 1372 wrap are needed. 1373 1374 cubic basis | vstep 1375 ------------- | ------ 1376 bezier | 3 1377 catmullRom | 1 1378 bspline | 1 1379 1380 The first segment of a cubic (nonperiodic) curve is always defined by its 1381 first four points. The vstep is the increment used to determine what 1382 vertex indices define the next segment. For a two segment (nonperiodic) 1383 bspline basis curve (vstep = 1), the first segment will be defined by 1384 interpolating vertices [0, 1, 2, 3] and the second segment will be defined 1385 by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the 1386 first segment will be defined by interpolating vertices [0, 1, 2, 3] and 1387 the second segment will be defined by [3, 4, 5, 6]. If the vstep is not 1388 one, then you must take special care to make sure that the number of cvs 1389 properly divides by your vstep. (The indices described are relative to 1390 the initial vertex index for a batched curve.) 1391 1392 For periodic curves, at least one of the curve's initial vertices are 1393 repeated to close the curve. For cubic curves, the number of vertices 1394 repeated is '4 - vstep'. For linear curves, only one vertex is repeated 1395 to close the loop. 1396 1397 Pinned curves are a special case of nonperiodic curves that only affects 1398 the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render 1399 pinned curves, a client must effectively add 'phantom points' at the 1400 beginning and end of every curve in a batch. These phantom points 1401 are injected to ensure that the interpolated curve begins at P[0] and 1402 ends at P[n-1]. 1403 1404 For a curve with initial point P[0] and last point P[n-1], the phantom 1405 points are defined as. 1406 P[-1] = 2 * P[0] - P[1] 1407 P[n] = 2 * P[n-1] - P[n-2] 1408 1409 Pinned cubic curves will (usually) have to be unpacked into the standard 1410 nonperiodic representation before rendering. This unpacking can add some 1411 additional overhead. However, using pinned curves reduces the amount of 1412 data recorded in a scene and (more importantly) better records the 1413 authors' intent for interchange. 1414 1415 \\note The additional phantom points mean that the minimum curve vertex 1416 count for cubic bspline and catmullRom curves is 2. 1417 1418 Linear curve segments are defined by two vertices. 1419 A two segment linear curve's first segment would be defined by 1420 interpolating vertices [0, 1]. The second segment would be defined by 1421 vertices [1, 2]. (Again, for a batched curve, indices are relative to 1422 the initial vertex index.) 1423 1424 When validating curve topology, each renderable entry in the 1425 curveVertexCounts vector must pass this check. 1426 1427 type | wrap | validitity 1428 ------- | --------------------------- | ---------------- 1429 linear | nonperiodic | curveVertexCounts[i] > 2 1430 linear | periodic | curveVertexCounts[i] > 3 1431 cubic | nonperiodic | (curveVertexCounts[i] - 4) % vstep == 0 1432 cubic | periodic | (curveVertexCounts[i]) % vstep == 0 1433 cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) >= 0 1434 1435 \\section UsdGeomBasisCurves_BasisMatrix Cubic Vertex Interpolation 1436 1437 \\image html USDCurveBasisMatrix.png width=750 1438 1439 \\section UsdGeomBasisCurves_Linear Linear Vertex Interpolation 1440 1441 Linear interpolation is always used on curves of type linear. 1442 't' with domain [0, 1], the curve is defined by the equation 1443 P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes 1444 the end point. 1445 1446 \\section UsdGeomBasisCurves_PrimvarInterpolation Primvar Interpolation 1447 1448 For cubic curves, primvar data can be either interpolated cubically between 1449 vertices or linearly across segments. The corresponding token 1450 for cubic interpolation is 'vertex' and for linear interpolation is 1451 'varying'. Per vertex data should be the same size as the number 1452 of vertices in your curve. Segment varying data is dependent on the 1453 wrap (periodicity) and number of segments in your curve. For linear curves, 1454 varying and vertex data would be interpolated the same way. By convention 1455 varying is the preferred interpolation because of the association of 1456 varying with linear interpolation. 1457 1458 \\image html USDCurvePrimvars.png 1459 1460 To convert an entry in the curveVertexCounts vector into a segment count 1461 for an individual curve, apply these rules. Sum up all the results in 1462 order to compute how many total segments all curves have. 1463 1464 The following tables describe the expected segment count for the 'i'th 1465 curve in a curve batch as well as the entire batch. Python syntax 1466 like '[:]' (to describe all members of an array) and 'len(...)' 1467 (to describe the length of an array) are used. 1468 1469 type | wrap | curve segment count | batch segment count 1470 ------- | --------------------------- | -------------------------------------- | -------------------------- 1471 linear | nonperiodic | curveVertexCounts[i] - 1 | sum(curveVertexCounts[:]) - len(curveVertexCounts) 1472 linear | periodic | curveVertexCounts[i] | sum(curveVertexCounts[:]) 1473 cubic | nonperiodic | (curveVertexCounts[i] - 4) / vstep + 1 | sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) 1474 cubic | periodic | curveVertexCounts[i] / vstep | sum(curveVertexCounts[:]) / vstep 1475 cubic | pinned (catmullRom/bspline) | (curveVertexCounts[i] - 2) + 1 | sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) 1476 1477 The following table descrives the expected size of varying 1478 (linearly interpolated) data, derived from the segment counts computed 1479 above. 1480 1481 wrap | curve varying count | batch varying count 1482 ------------------- | ---------------------------- | ------------------------------------------------ 1483 nonperiodic/pinned | segmentCounts[i] + 1 | sum(segmentCounts[:]) + len(curveVertexCounts) 1484 periodic | segmentCounts[i] | sum(segmentCounts[:]) 1485 1486 Both curve types additionally define 'constant' interpolation for the 1487 entire prim and 'uniform' interpolation as per curve data. 1488 1489 1490 \\note Take care when providing support for linearly interpolated data for 1491 cubic curves. Its shape doesn't provide a one to one mapping with either 1492 the number of curves (like 'uniform') or the number of vertices (like 1493 'vertex') and so it is often overlooked. This is the only primitive in 1494 UsdGeom (as of this writing) where this is true. For meshes, while they 1495 use different interpolation methods, 'varying' and 'vertex' are both 1496 specified per point. It's common to assume that curves follow a similar 1497 pattern and build in structures and language for per primitive, per 1498 element, and per point data only to come upon these arrays that don't 1499 quite fit into either of those categories. It is 1500 also common to conflate 'varying' with being per segment data and use the 1501 segmentCount rules table instead of its neighboring varying data table 1502 rules. We suspect that this is because for the common case of 1503 nonperiodic cubic curves, both the provided segment count and varying data 1504 size formula end with '+ 1'. While debugging, users may look at the double 1505 '+ 1' as a mistake and try to remove it. We take this time to enumerate 1506 these issues because we've fallen into them before and hope that we save 1507 others time in their own implementations. 1508 1509 As an example of deriving per curve segment and varying primvar data counts from 1510 the wrap, type, basis, and curveVertexCount, the following table is provided. 1511 1512 wrap | type | basis | curveVertexCount | curveSegmentCount | varyingDataCount 1513 ------------- | ------- | ------- | ----------------- | ------------------ | ------------------------- 1514 nonperiodic | linear | N/A | [2 3 2 5] | [1 2 1 4] | [2 3 2 5] 1515 nonperiodic | cubic | bezier | [4 7 10 4 7] | [1 2 3 1 2] | [2 3 4 2 3] 1516 nonperiodic | cubic | bspline | [5 4 6 7] | [2 1 3 4] | [3 2 4 5] 1517 periodic | cubic | bezier | [6 9 6] | [2 3 2] | [2 3 2] 1518 periodic | linear | N/A | [3 7] | [3 7] | [3 7] 1519 1520 \\section UsdGeomBasisCurves_TubesAndRibbons Tubes and Ribbons 1521 1522 The strictest definition of a curve as an infinitely thin wire is not 1523 particularly useful for describing production scenes. The additional 1524 \\em widths and \\em normals attributes can be used to describe cylindrical 1525 tubes and or flat oriented ribbons. 1526 1527 Curves with only widths defined are imaged as tubes with radius 1528 'width / 2'. Curves with both widths and normals are imaged as ribbons 1529 oriented in the direction of the interpolated normal vectors. 1530 1531 While not technically UsdGeomPrimvars, widths and normals 1532 also have interpolation metadata. It's common for authored widths to have 1533 constant, varying, or vertex interpolation 1534 (see UsdGeomCurves::GetWidthsInterpolation()). It's common for 1535 authored normals to have varying interpolation 1536 (see UsdGeomPointBased::GetNormalsInterpolation()). 1537 1538 \\image html USDCurveHydra.png 1539 1540 The file used to generate these curves can be found in 1541 pxr/extras/examples/usdGeomExamples/basisCurves.usda. It's provided 1542 as a reference on how to properly image both tubes and ribbons. The first 1543 row of curves are linear; the second are cubic bezier. (We aim in future 1544 releases of HdSt to fix the discontinuity seen with broken tangents to 1545 better match offline renderers like RenderMan.) The yellow and violet 1546 cubic curves represent cubic vertex width interpolation for which there is 1547 no equivalent for linear curves. 1548 1549 \\note How did this prim type get its name? This prim is a portmanteau of 1550 two different statements in the original RenderMan specification: 1551 'Basis' and 'Curves'. 1552""" 1553) { 1554 # interpolation attributes 1555 uniform token type = "cubic" ( 1556 allowedTokens = ["linear", "cubic"] 1557 doc = """Linear curves interpolate linearly between two vertices. 1558 Cubic curves use a basis matrix with four vertices to interpolate a segment.""") 1559 1560 uniform token basis = "bezier" ( 1561 allowedTokens = ["bezier", "bspline", "catmullRom"] 1562 doc = """The basis specifies the vstep and matrix used for cubic 1563 interpolation. \\note The 'hermite' and 'power' tokens have been 1564 removed. We've provided UsdGeomHermiteCurves 1565 as an alternative for the 'hermite' basis.""") 1566 1567 uniform token wrap = "nonperiodic" ( 1568 allowedTokens = ["nonperiodic", "periodic", "pinned"] 1569 doc = """If wrap is set to periodic, the curve when rendered will 1570 repeat the initial vertices (dependent on the vstep) to close the 1571 curve. If wrap is set to 'pinned', phantom points may be created 1572 to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. 1573 """) 1574} 1575 1576class NurbsCurves "NurbsCurves" ( 1577 inherits = </Curves> 1578 doc = """This schema is analagous to NURBS Curves in packages like Maya 1579 and Houdini, often used for interchange of rigging and modeling curves. 1580 Unlike Maya, this curve spec supports batching of multiple curves into a 1581 single prim, widths, and normals in the schema. Additionally, we require 1582 'numSegments + 2 * degree + 1' knots (2 more than maya does). This is to 1583 be more consistent with RenderMan's NURBS patch specification. 1584 1585 To express a periodic curve: 1586 - knot[0] = knot[1] - (knots[-2] - knots[-3]; 1587 - knot[-1] = knot[-2] + (knot[2] - knots[1]); 1588 1589 To express a nonperiodic curve: 1590 - knot[0] = knot[1]; 1591 - knot[-1] = knot[-2]; 1592 1593 In spite of these slight differences in the spec, curves generated in Maya 1594 should be preserved when roundtripping. 1595 1596 \\em order and \\em range, when representing a batched NurbsCurve should be 1597 authored one value per curve. \\em knots should be the concatentation of 1598 all batched curves.""" 1599) { 1600 # topology attributes 1601 int[] order = [] ( 1602 doc = """Order of the curve. Order must be positive and is 1603 equal to the degree of the polynomial basis to be evaluated, plus 1. 1604 Its value for the 'i'th curve must be less than or equal to 1605 curveVertexCount[i]""") 1606 1607 # interpolation attributes 1608 double[] knots ( 1609 doc = """Knot vector providing curve parameterization. 1610 The length of the slice of the array for the ith curve 1611 must be ( curveVertexCount[i] + order[i] ), and its 1612 entries must take on monotonically increasing values.""") 1613 1614 double2[] ranges ( 1615 doc = """Provides the minimum and maximum parametric values (as defined 1616 by knots) over which the curve is actually defined. The minimum must 1617 be less than the maximum, and greater than or equal to the value of the 1618 knots['i'th curve slice][order[i]-1]. The maxium must be less 1619 than or equal to the last element's value in knots['i'th curve slice]. 1620 Range maps to (vmin, vmax) in the RenderMan spec.""") 1621} 1622 1623class Points "Points" ( 1624 customData = { 1625 dictionary extraPlugInfo = { 1626 bool implementsComputeExtent = true 1627 } 1628 } 1629 inherits = </PointBased> 1630 doc = """Points are analogous to the <A HREF="https://renderman.pixar.com/resources/current/RenderMan/appnote.18.html">RiPoints spec</A>. 1631 1632 Points can be an efficient means of storing and rendering particle 1633 effects comprised of thousands or millions of small particles. Points 1634 generally receive a single shading sample each, which should take 1635 \\em normals into account, if present. 1636 1637 While not technically UsdGeomPrimvars, the widths and normals also 1638 have interpolation metadata. It's common for authored widths and normals 1639 to have constant or varying interpolation.""" 1640 1641) { 1642 # shaping attributes 1643 float[] widths ( 1644 doc = """Widths are defined as the \\em diameter of the points, in 1645 object space. 'widths' is not a generic Primvar, but 1646 the number of elements in this attribute will be determined by 1647 its 'interpolation'. See \\ref SetWidthsInterpolation() . If 1648 'widths' and 'primvars:widths' are both specified, the latter 1649 has precedence.""" 1650 ) 1651 1652 int64[] ids ( 1653 doc = """Ids are optional; if authored, the ids array should be the same 1654 length as the points array, specifying (at each timesample if 1655 point identities are changing) the id of each point. The 1656 type is signed intentionally, so that clients can encode some 1657 binary state on Id'd points without adding a separate 1658 primvar.""" 1659 ) 1660} 1661 1662class PointInstancer "PointInstancer" ( 1663 doc = """Encodes vectorized instancing of multiple, potentially 1664 animated, prototypes (object/instance masters), which can be arbitrary 1665 prims/subtrees on a UsdStage. 1666 1667 PointInstancer is a "multi instancer", as it allows multiple prototypes 1668 to be scattered among its "points". We use a UsdRelationship 1669 \\em prototypes to identify and order all of the possible prototypes, by 1670 targeting the root prim of each prototype. The ordering imparted by 1671 relationships associates a zero-based integer with each prototype, and 1672 it is these integers we use to identify the prototype of each instance, 1673 compactly, and allowing prototypes to be swapped out without needing to 1674 reauthor all of the per-instance data. 1675 1676 The PointInstancer schema is designed to scale to billions of instances, 1677 which motivates the choice to split the per-instance transformation into 1678 position, (quaternion) orientation, and scales, rather than a 1679 4x4 matrix per-instance. In addition to requiring fewer bytes even if 1680 all elements are authored (32 bytes vs 64 for a single-precision 4x4 1681 matrix), we can also be selective about which attributes need to animate 1682 over time, for substantial data reduction in many cases. 1683 1684 Note that PointInstancer is \\em not a Gprim, since it is not a graphical 1685 primitive by any stretch of the imagination. It \\em is, however, 1686 Boundable, since we will sometimes want to treat the entire PointInstancer 1687 similarly to a procedural, from the perspective of inclusion or framing. 1688 1689 \\section UsdGeomPointInstancer_varyingTopo Varying Instance Identity over Time 1690 1691 PointInstancers originating from simulations often have the characteristic 1692 that points/instances are "born", move around for some time period, and then 1693 die (or leave the area of interest). In such cases, billions of instances 1694 may be birthed over time, while at any \\em specific time, only a much 1695 smaller number are actually alive. To encode this situation efficiently, 1696 the simulator may re-use indices in the instance arrays, when a particle 1697 dies, its index will be taken over by a new particle that may be birthed in 1698 a much different location. This presents challenges both for 1699 identity-tracking, and for motion-blur. 1700 1701 We facilitate identity tracking by providing an optional, animatable 1702 \\em ids attribute, that specifies the 64 bit integer ID of the particle 1703 at each index, at each point in time. If the simulator keeps monotonically 1704 increasing a particle-count each time a new particle is birthed, it will 1705 serve perfectly as particle \\em ids. 1706 1707 We facilitate motion blur for varying-topology particle streams by 1708 optionally allowing per-instance \\em velocities and \\em angularVelocities 1709 to be authored. If instance transforms are requested at a time between 1710 samples and either of the velocity attributes is authored, then we will 1711 not attempt to interpolate samples of \\em positions or \\em orientations. 1712 If not authored, and the bracketing samples have the same length, then we 1713 will interpolate. 1714 1715 \\section UsdGeomPointInstancer_transform Computing an Instance Transform 1716 1717 Each instance's transformation is a combination of the SRT affine transform 1718 described by its scale, orientation, and position, applied \\em after 1719 (i.e. less locally) than the transformation computed at the root of the 1720 prototype it is instancing. In other words, to put an instance of a 1721 PointInstancer into the space of the PointInstancer's parent prim: 1722 1723 1. Apply (most locally) the authored transformation for 1724 <em>prototypes[protoIndices[i]]</em> 1725 2. If *scales* is authored, next apply the scaling matrix from *scales[i]* 1726 3. If *orientations* is authored: **if *angularVelocities* is authored**, 1727 first multiply *orientations[i]* by the unit quaternion derived by scaling 1728 *angularVelocities[i]* by the \\ref UsdGeom_PITimeScaling "time differential" 1729 from the left-bracketing timeSample for *orientation* to the requested 1730 evaluation time *t*, storing the result in *R*, **else** assign *R* 1731 directly from *orientations[i]*. Apply the rotation matrix derived 1732 from *R*. 1733 4. Apply the translation derived from *positions[i]*. If *velocities* is 1734 authored, apply the translation deriving from *velocities[i]* scaled by 1735 the time differential from the left-bracketing timeSample for *positions* 1736 to the requested evaluation time *t*. 1737 5. Least locally, apply the transformation authored on the PointInstancer 1738 prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the 1739 PointInstancer to put the instance directly into world space) 1740 1741 If neither *velocities* nor *angularVelocities* are authored, we fallback to 1742 standard position and orientation computation logic (using linear 1743 interpolation between timeSamples) as described by 1744 \\ref UsdGeom_VelocityInterpolation . 1745 1746 \\anchor UsdGeom_PITimeScaling 1747 <b>Scaling Velocities for Interpolation</b> 1748 1749 When computing time-differentials by which to apply velocity or 1750 angularVelocity to positions or orientations, we must scale by 1751 ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded 1752 in units/second, while we are interpolating in UsdTimeCode ordinates. 1753 1754 Additionally, if *motion:velocityScale* is authored or inherited (see 1755 UsdGeomMotionAPI::ComputeVelocityScale()), it is used to scale both the 1756 velocity and angular velocity by a constant value during computation. The 1757 *motion:velocityScale* attribute is encoded by UsdGeomMotionAPI. 1758 1759 We provide both high and low-level API's for dealing with the 1760 transformation as a matrix, both will compute the instance matrices using 1761 multiple threads; the low-level API allows the client to cache unvarying 1762 inputs so that they need not be read duplicately when computing over 1763 time. 1764 1765 See also \\ref UsdGeom_VelocityInterpolation . 1766 1767 \\section UsdGeomPointInstancer_primvars Primvars on PointInstancer 1768 1769 \\ref UsdGeomPrimvar "Primvars" authored on a PointInstancer prim should 1770 always be applied to each instance with \\em constant interpolation at 1771 the root of the instance. When you are authoring primvars on a 1772 PointInstancer, think about it as if you were authoring them on a 1773 point-cloud (e.g. a UsdGeomPoints gprim). The same 1774 <A HREF="http://renderman.pixar.com/resources/current/rps/appnote.22.html#classSpecifiers">interpolation rules for points</A> apply here, substituting 1775 "instance" for "point". 1776 1777 In other words, the (constant) value extracted for each instance 1778 from the authored primvar value depends on the authored \\em interpolation 1779 and \\em elementSize of the primvar, as follows: 1780 \\li <b>constant</b> or <b>uniform</b> : the entire authored value of the 1781 primvar should be applied exactly to each instance. 1782 \\li <b>varying</b>, <b>vertex</b>, or <b>faceVarying</b>: the first 1783 \\em elementSize elements of the authored primvar array should be assigned to 1784 instance zero, the second \\em elementSize elements should be assigned to 1785 instance one, and so forth. 1786 1787 1788 \\section UsdGeomPointInstancer_masking Masking Instances: "Deactivating" and Invising 1789 1790 Often a PointInstancer is created "upstream" in a graphics pipeline, and 1791 the needs of "downstream" clients necessitate eliminating some of the 1792 instances from further consideration. Accomplishing this pruning by 1793 re-authoring all of the per-instance attributes is not very attractive, 1794 since it may mean destructively editing a large quantity of data. We 1795 therefore provide means of "masking" instances by ID, such that the 1796 instance data is unmolested, but per-instance transform and primvar data 1797 can be retrieved with the no-longer-desired instances eliminated from the 1798 (smaller) arrays. PointInstancer allows two independent means of masking 1799 instances by ID, each with different features that meet the needs of 1800 various clients in a pipeline. Both pruning features' lists of ID's are 1801 combined to produce the mask returned by ComputeMaskAtTime(). 1802 1803 \\note If a PointInstancer has no authored \\em ids attribute, the masking 1804 features will still be available, with the integers specifying element 1805 position in the \\em protoIndices array rather than ID. 1806 1807 \\subsection UsdGeomPointInstancer_inactiveIds InactiveIds: List-edited, Unvarying Masking 1808 1809 The first masking feature encodes a list of IDs in a list-editable metadatum 1810 called \\em inactiveIds, which, although it does not have any similar 1811 impact to stage population as \\ref UsdPrim::SetActive() "prim activation", 1812 it shares with that feature that its application is uniform over all time. 1813 Because it is list-editable, we can \\em sparsely add and remove instances 1814 from it in many layers. 1815 1816 This sparse application pattern makes \\em inactiveIds a good choice when 1817 further downstream clients may need to reverse masking decisions made 1818 upstream, in a manner that is robust to many kinds of future changes to 1819 the upstream data. 1820 1821 See ActivateId(), ActivateIds(), DeactivateId(), DeactivateIds(), 1822 ActivateAllIds() 1823 1824 \\subsection UsdGeomPointInstancer_invisibleIds invisibleIds: Animatable Masking 1825 1826 The second masking feature encodes a list of IDs in a time-varying 1827 Int64Array-valued UsdAttribute called \\em invisibleIds , since it shares 1828 with \\ref UsdGeomImageable::GetVisibilityAttr() "Imageable visibility" 1829 the ability to animate object visibility. 1830 1831 Unlike \\em inactiveIds, overriding a set of opinions for \\em invisibleIds 1832 is not at all straightforward, because one will, in general need to 1833 reauthor (in the overriding layer) **all** timeSamples for the attribute 1834 just to change one Id's visibility state, so it cannot be authored 1835 sparsely. But it can be a very useful tool for situations like encoding 1836 pre-computed camera-frustum culling of geometry when either or both of 1837 the instances or the camera is animated. 1838 1839 See VisId(), VisIds(), InvisId(), InvisIds(), VisAllIds() 1840 1841 \\section UsdGeomPointInstancer_protoProcessing Processing and Not Processing Prototypes 1842 1843 Any prim in the scenegraph can be targeted as a prototype by the 1844 \\em prototypes relationship. We do not, however, provide a specific 1845 mechanism for identifying prototypes as geometry that should not be drawn 1846 (or processed) in their own, local spaces in the scenegraph. We 1847 encourage organizing all prototypes as children of the PointInstancer 1848 prim that consumes them, and pruning "raw" processing and drawing 1849 traversals when they encounter a PointInstancer prim; this is what the 1850 UsdGeomBBoxCache and UsdImaging engines do. 1851 1852 There \\em is a pattern one can deploy for organizing the prototypes 1853 such that they will automatically be skipped by basic UsdPrim::GetChildren() 1854 or UsdPrimRange traversals. Usd prims each have a 1855 \\ref Usd_PrimSpecifiers "specifier" of "def", "over", or "class". The 1856 default traversals skip over prims that are "pure overs" or classes. So 1857 to protect prototypes from all generic traversals and processing, place 1858 them under a prim that is just an "over". For example, 1859 \\code 1860 01 def PointInstancer "Crowd_Mid" 1861 02 { 1862 03 rel prototypes = [ </Crowd_Mid/Prototypes/MaleThin_Business>, </Crowd_Mid/Prototypes/MaleTine_Casual> ] 1863 04 1864 05 over "Prototypes" 1865 06 { 1866 07 def "MaleThin_Business" ( 1867 08 references = [@MaleGroupA/usd/MaleGroupA.usd@</MaleGroupA>] 1868 09 variants = { 1869 10 string modelingVariant = "Thin" 1870 11 string costumeVariant = "BusinessAttire" 1871 12 } 1872 13 ) 1873 14 { ... } 1874 15 1875 16 def "MaleThin_Casual" 1876 17 ... 1877 18 } 1878 19 } 1879 \\endcode 1880 """ 1881 1882 inherits = </Boundable> 1883 customData = { 1884 dictionary extraPlugInfo = { 1885 bool implementsComputeExtent = true 1886 } 1887 dictionary schemaTokens = { 1888 dictionary inactiveIds = { 1889 string doc = """int64listop prim metadata that specifies 1890 the PointInstancer ids that should be masked (unrenderable) 1891 over all time.""" 1892 } 1893 } 1894 } 1895) { 1896 rel prototypes ( 1897 doc = """<b>Required property</b>. Orders and targets the prototype root 1898 prims, which can be located anywhere in the scenegraph that is convenient, 1899 although we promote organizing prototypes as children of the 1900 PointInstancer. The position of a prototype in this relationship defines 1901 the value an instance would specify in the \\em protoIndices attribute to 1902 instance that prototype. Since relationships are uniform, this property 1903 cannot be animated.""" 1904 ) 1905 1906 int[] protoIndices ( 1907 doc = """<b>Required property</b>. Per-instance index into 1908 \\em prototypes relationship that identifies what geometry should be 1909 drawn for each instance. <b>Topology attribute</b> - can be animated, 1910 but at a potential performance impact for streaming.""" 1911 ) 1912 1913 int64[] ids ( 1914 doc = """Ids are optional; if authored, the ids array should be the same 1915 length as the \\em protoIndices array, specifying (at each timeSample if 1916 instance identities are changing) the id of each instance. The 1917 type is signed intentionally, so that clients can encode some 1918 binary state on Id'd instances without adding a separate primvar. 1919 See also \\ref UsdGeomPointInstancer_varyingTopo""" 1920 ) 1921 1922 point3f[] positions ( 1923 doc = """<b>Required property</b>. Per-instance position. See also 1924 \\ref UsdGeomPointInstancer_transform .""" 1925 ) 1926 1927 quath[] orientations ( 1928 doc="""If authored, per-instance orientation of each instance about its 1929 prototype's origin, represented as a unit length quaternion, which 1930 allows us to encode it with sufficient precision in a compact GfQuath. 1931 1932 It is client's responsibility to ensure that authored quaternions are 1933 unit length; the convenience API below for authoring orientations from 1934 rotation matrices will ensure that quaternions are unit length, though 1935 it will not make any attempt to select the "better (for interpolation 1936 with respect to neighboring samples)" of the two possible quaternions 1937 that encode the rotation. 1938 1939 See also \\ref UsdGeomPointInstancer_transform .""" ) 1940 1941 float3[] scales ( 1942 doc="""If authored, per-instance scale to be applied to 1943 each instance, before any rotation is applied. 1944 1945 See also \\ref UsdGeomPointInstancer_transform .""" 1946 ) 1947 1948 vector3f[] velocities ( 1949 doc = """If provided, per-instance 'velocities' will be used to 1950 compute positions between samples for the 'positions' attribute, 1951 rather than interpolating between neighboring 'positions' samples. 1952 Velocities should be considered mandatory if both \\em protoIndices 1953 and \\em positions are animated. Velocity is measured in position 1954 units per second, as per most simulation software. To convert to 1955 position units per UsdTimeCode, divide by 1956 UsdStage::GetTimeCodesPerSecond(). 1957 1958 See also \\ref UsdGeomPointInstancer_transform, 1959 \\ref UsdGeom_VelocityInterpolation .""" 1960 ) 1961 1962 vector3f[] accelerations ( 1963 doc = """If authored, per-instance 'accelerations' will be used with 1964 velocities to compute positions between samples for the 'positions' 1965 attribute rather than interpolating between neighboring 'positions' 1966 samples. Acceleration is measured in position units per second-squared. 1967 To convert to position units per squared UsdTimeCode, divide by the 1968 square of UsdStage::GetTimeCodesPerSecond().""" 1969 ) 1970 1971 vector3f[] angularVelocities ( 1972 doc="""If authored, per-instance angular velocity vector to be used for 1973 interoplating orientations. Angular velocities should be considered 1974 mandatory if both \\em protoIndices and \\em orientations are animated. 1975 Angular velocity is measured in <b>degrees</b> per second. To convert 1976 to degrees per UsdTimeCode, divide by 1977 UsdStage::GetTimeCodesPerSecond(). 1978 1979 See also \\ref UsdGeomPointInstancer_transform .""" 1980 ) 1981 1982 int64[] invisibleIds = [] ( 1983 doc="""A list of id's to make invisible at the evaluation time. 1984 See \\ref UsdGeomPointInstancer_invisibleIds .""" 1985 ) 1986} 1987 1988 1989class Camera "Camera" ( 1990 doc = """Transformable camera. 1991 1992 Describes optical properties of a camera via a common set of attributes 1993 that provide control over the camera's frustum as well as its depth of 1994 field. For stereo, the left and right camera are individual prims tagged 1995 through the \\ref UsdGeomCamera::GetStereoRoleAttr() "stereoRole attribute". 1996 1997 There is a corresponding class GfCamera, which can hold the state of a 1998 camera (at a particular time). \\ref UsdGeomCamera::GetCamera() and 1999 \\ref UsdGeomCamera::SetFromCamera() convert between a USD camera prim and 2000 a GfCamera. 2001 2002 To obtain the camera's location in world space, call the following on a 2003 UsdGeomCamera 'camera': 2004 \\code 2005 GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); 2006 \\endcode 2007 \\note 2008 <b>Cameras in USD are always "Y up", regardless of the stage's orientation 2009 (i.e. UsdGeomGetStageUpAxis()).</b> This means that the inverse of 2010 'camXform' (the VIEW half of the <A HREF="http://www.glprogramming.com/red/chapter03.html#name2">MODELVIEW transform in OpenGL parlance</A>) 2011 will transform the world such that the camera is at the origin, looking 2012 down the -Z axis, with +Y as the up axis, and +X pointing to the right. 2013 This describes a __right handed coordinate system__. 2014 2015 \\sa \\ref UsdGeom_LinAlgBasics 2016 """ 2017 inherits = </Xformable> 2018 customData = { 2019 string extraIncludes = """ 2020#include "pxr/base/gf/camera.h" """ 2021 } 2022) { 2023 # viewing frustum 2024 token projection = "perspective" ( 2025 allowedTokens = ["perspective", "orthographic"]) 2026 float horizontalAperture = 20.9550 ( 2027 doc = """Horizontal aperture in millimeters (or, more general, tenths 2028 of a world unit). 2029 Defaults to the standard 35mm spherical projector aperture.""") 2030 float verticalAperture = 15.2908 ( 2031 doc = """Vertical aperture in millimeters (or, more general, tenths of 2032 a world unit). 2033 Defaults to the standard 35mm spherical projector aperture.""") 2034 float horizontalApertureOffset = 0.0 ( 2035 doc = """Horizontal aperture offset in the same units as 2036 horizontalAperture. Defaults to 0.""") 2037 float verticalApertureOffset = 0.0 ( 2038 doc = """Vertical aperture offset in the same units as 2039 verticalAperture. Defaults to 0.""") 2040 float focalLength = 50.0 ( 2041 doc = """Perspective focal length in millimeters (or, more general, 2042 tenths of a world unit).""") 2043 float2 clippingRange = (1, 1000000) ( 2044 doc = """Near and far clipping distances in centimeters (or, more 2045 general, world units).""") 2046 float4[] clippingPlanes = [] ( 2047 doc = """Additional, arbitrarily oriented clipping planes. 2048 A vector (a,b,c,d) encodes a clipping plane that cuts off 2049 (x,y,z) with a * x + b * y + c * z + d * 1 < 0 where (x,y,z) 2050 are the coordinates in the camera's space.""") 2051 2052 # depth of field 2053 float fStop = 0.0 ( 2054 doc = """Lens aperture. Defaults to 0.0, which turns off focusing.""") 2055 float focusDistance = 0.0 ( 2056 doc = """Distance from the camera to the focus plane in centimeters (or 2057 more general, world units).""") 2058 2059 # stereoscopic 3D 2060 uniform token stereoRole = "mono" ( 2061 allowedTokens = ["mono", "left", "right"] 2062 doc = """If different from mono, the camera is intended to be the left 2063 or right camera of a stereo setup.""") 2064 2065 # Parameters for motion blur 2066 double shutter:open = 0.0 ( 2067 doc = """Frame relative shutter open time in UsdTimeCode units (negative 2068 value indicates that the shutter opens before the current 2069 frame time). Used for motion blur.""" 2070 ) 2071 double shutter:close = 0.0 ( 2072 doc = """Frame relative shutter close time, analogous comments from 2073 shutter:open apply. A value greater or equal to shutter:open 2074 should be authored, otherwise there is no exposure and a 2075 renderer should produce a black image.""" 2076 ) 2077 2078 # exposure adjustment 2079 float exposure = 0.0 ( 2080 doc = """Exposure adjustment, as a log base-2 value. The default 2081 of 0.0 has no effect. A value of 1.0 will double the 2082 image-plane intensities in a rendered image; a value of 2083 -1.0 will halve them.""" 2084 ) 2085} 2086 2087class "GeomModelAPI" 2088( 2089 inherits = </APISchemaBase> 2090 customData = { 2091 string className = "ModelAPI" 2092 string extraIncludes = """ 2093#include "pxr/usd/usdGeom/bboxCache.h" 2094#include "pxr/usd/usdGeom/constraintTarget.h" 2095#include "pxr/usd/usdGeom/imageable.h" """ 2096 dictionary schemaTokens = { 2097 dictionary extentsHint = { 2098 string doc = """Name of the attribute used to author extents 2099 hints at the root of leaf models. Extents hints are stored by purpose 2100 as a vector of GfVec3f values. They are ordered based on the order 2101 of purpose tokens returned by 2102 UsdGeomImageable::GetOrderedPurposeTokens.""" 2103 } 2104 } 2105 } 2106 doc = """UsdGeomModelAPI extends the generic UsdModelAPI schema with 2107 geometry specific concepts such as cached extents for the entire model, 2108 constraint targets, and geometry-inspired extensions to the payload 2109 lofting process. 2110 2111 As described in GetExtentsHint() below, it is useful to cache extents 2112 at the model level. UsdGeomModelAPI provides schema for computing and 2113 storing these cached extents, which can be consumed by UsdGeomBBoxCache to 2114 provide fast access to precomputed extents that will be used as the model's 2115 bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). 2116 2117 \\section UsdGeomModelAPI_drawMode Draw Modes 2118 2119 Draw modes provide optional alternate imaging behavior for USD subtrees with 2120 kind model. \\em model:drawMode (which is inheritable) and 2121 \\em model:applyDrawMode (which is not) are resolved into a decision to stop 2122 traversing the scene graph at a certain point, and replace a USD subtree 2123 with proxy geometry. 2124 2125 The value of \\em model:drawMode determines the type of proxy geometry: 2126 - \\em origin - Draw the model-space basis vectors of the replaced prim. 2127 - \\em bounds - Draw the model-space bounding box of the replaced prim. 2128 - \\em cards - Draw textured quads as a placeholder for the replaced prim. 2129 - \\em default - An explicit opinion to draw the USD subtree as normal. 2130 - \\em inherited - Defer to the parent opinion. 2131 2132 \\em model:drawMode falls back to _inherited_ so that a whole scene, 2133 a large group, or all prototypes of a model hierarchy PointInstancer can 2134 be assigned a draw mode with a single attribute edit. If no draw mode is 2135 explicitly set in a hierarchy, the resolved value is _default_. 2136 2137 \\em model:applyDrawMode is meant to be written when an asset is authored, 2138 and provides flexibility for different asset types. For example, 2139 a character assembly (composed of character, clothes, etc) might have 2140 \\em model:applyDrawMode set at the top of the subtree so the whole group 2141 can be drawn as a single card object. An effects subtree might have 2142 \\em model:applyDrawMode set at a lower level so each particle 2143 group draws individually. 2144 2145 Models of kind component are treated as if \\em model:applyDrawMode 2146 were true. This means a prim is drawn with proxy geometry when: the 2147 prim has kind component, and/or \\em model:applyDrawMode is set; and 2148 the prim's resolved value for \\em model:drawMode is not _default_. 2149 2150 \\section UsdGeomModelAPI_cardGeometry Cards Geometry 2151 2152 The specific geometry used in cards mode is controlled by the 2153 \\em model:cardGeometry attribute: 2154 - \\em cross - Generate a quad normal to each basis direction and negative. 2155 Locate each quad so that it bisects the model extents. 2156 - \\em box - Generate a quad normal to each basis direction and negative. 2157 Locate each quad on a face of the model extents, facing out. 2158 - \\em fromTexture - Generate a quad for each supplied texture from 2159 attributes stored in that texture's metadata. 2160 2161 For \\em cross and \\em box mode, the extents are calculated for purposes 2162 \\em default, \\em proxy, and \\em render, at their earliest authored time. 2163 If the model has no textures, all six card faces are rendered using 2164 \\em model:drawModeColor. If one or more textures are present, only axes 2165 with one or more textures assigned are drawn. For each axis, if both 2166 textures (positive and negative) are specified, they'll be used on the 2167 corresponding card faces; if only one texture is specified, it will be 2168 mapped to the opposite card face after being flipped on the texture's 2169 s-axis. Any card faces with invalid asset paths will be drawn with 2170 \\em model:drawModeColor. 2171 2172 Both \\em model:cardGeometry and \\em model:drawModeColor should be 2173 authored on the prim where the draw mode takes effect, since these 2174 attributes are not inherited. 2175 2176 For \\em fromTexture mode, only card faces with valid textures assigned 2177 are drawn. The geometry is generated by pulling the \\em worldtoscreen 2178 attribute out of texture metadata. This is expected to be a 4x4 matrix 2179 mapping the model-space position of the card quad to the clip-space quad 2180 with corners (-1,-1,0) and (1,1,0). The card vertices are generated by 2181 transforming the clip-space corners by the inverse of \\em worldtoscreen. 2182 Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. 2183 If the metadata cannot be read in the right format, or the matrix can't 2184 be inverted, the card face is not drawn. 2185 2186 All card faces are drawn and textured as single-sided. 2187 2188 \\todo CreatePayload() """ 2189) 2190{ 2191 uniform token model:drawMode = "inherited" ( 2192 allowedTokens = ["origin", "bounds", "cards", "default", "inherited"] 2193 doc = """Alternate imaging mode; applied to this prim or child prims 2194 where \\em model:applyDrawMode is true, or where the prim 2195 has kind \\em component. See \\ref UsdGeomModelAPI_drawMode 2196 for mode descriptions.""" 2197 ) 2198 uniform bool model:applyDrawMode = false ( 2199 doc = """If true, and the resolved value of \\em model:drawMode is 2200 non-default, apply an alternate imaging mode to this prim. See 2201 \\ref UsdGeomModelAPI_drawMode.""" 2202 ) 2203 uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ( 2204 doc = """The base color of imaging prims inserted for alternate 2205 imaging modes. For \\em origin and \\em bounds modes, this 2206 controls line color; for \\em cards mode, this controls the 2207 fallback quad color.""" 2208 ) 2209 uniform token model:cardGeometry = "cross" ( 2210 allowedTokens = ["cross", "box", "fromTexture"] 2211 doc = """The geometry to generate for imaging prims inserted for \\em 2212 cards imaging mode. See \\ref UsdGeomModelAPI_cardGeometry for 2213 geometry descriptions.""" 2214 ) 2215 asset model:cardTextureXPos ( 2216 doc = """In \\em cards imaging mode, the texture applied to the X+ quad. 2217 The texture axes (s,t) are mapped to model-space axes (-y, -z).""" 2218 ) 2219 asset model:cardTextureYPos ( 2220 doc = """In \\em cards imaging mode, the texture applied to the Y+ quad. 2221 The texture axes (s,t) are mapped to model-space axes (x, -z).""" 2222 ) 2223 asset model:cardTextureZPos ( 2224 doc = """In \\em cards imaging mode, the texture applied to the Z+ quad. 2225 The texture axes (s,t) are mapped to model-space axes (x, -y).""" 2226 ) 2227 asset model:cardTextureXNeg ( 2228 doc = """In \\em cards imaging mode, the texture applied to the X- quad. 2229 The texture axes (s,t) are mapped to model-space axes (y, -z).""" 2230 ) 2231 asset model:cardTextureYNeg ( 2232 doc = """In \\em cards imaging mode, the texture applied to the Y- quad. 2233 The texture axes (s,t) are mapped to model-space axes (-x, -z).""" 2234 ) 2235 asset model:cardTextureZNeg ( 2236 doc = """In \\em cards imaging mode, the texture applied to the Z- quad. 2237 The texture axes (s,t) are mapped to model-space axes (-x, -y).""" 2238 ) 2239} 2240 2241class "MotionAPI" 2242( 2243 inherits = </APISchemaBase> 2244 doc = """UsdGeomMotionAPI encodes data that can live on any prim that 2245 may affect computations involving: 2246 - computed motion for motion blur 2247 - sampling for motion blur 2248 2249 For example, UsdGeomMotionAPI provides *velocityScale* 2250 (GetVelocityScaleAttr()) for controlling how motion-blur samples should 2251 be computed by velocity-consuming schemas.""" 2252) 2253{ 2254 float motion:velocityScale = 1.0 ( 2255 customData = { 2256 string apiName = "velocityScale" 2257 } 2258 doc = """VelocityScale is an **inherited** float attribute that 2259 velocity-based schemas (e.g. PointBased, PointInstancer) can consume 2260 to compute interpolated positions and orientations by applying 2261 velocity and angularVelocity, which is required for interpolating 2262 between samples when topology is varying over time. Although these 2263 quantities are generally physically computed by a simulator, sometimes 2264 we require more or less motion-blur to achieve the desired look. 2265 VelocityScale allows artists to dial-in, as a post-sim correction, 2266 a scale factor to be applied to the velocity prior to computing 2267 interpolated positions from it. 2268 2269 See also ComputeVelocityScale()""" 2270 ) 2271} 2272 2273class "XformCommonAPI" 2274( 2275 inherits = </APISchemaBase> 2276 doc = """This class provides API for authoring and retrieving a standard set 2277 of component transformations which include a scale, a rotation, a 2278 scale-rotate pivot and a translation. The goal of the API is to enhance 2279 component-wise interchange. It achieves this by limiting the set of allowed 2280 basic ops and by specifying the order in which they are applied. In addition 2281 to the basic set of ops, the 'resetXformStack' bit can also be set to 2282 indicate whether the underlying xformable resets the parent transformation 2283 (i.e. does not inherit it's parent's transformation). 2284 2285 \\sa UsdGeomXformCommonAPI::GetResetXformStack() 2286 \\sa UsdGeomXformCommonAPI::SetResetXformStack() 2287 2288 The operator-bool for the class will inform you whether an existing 2289 xformable is compatible with this API. 2290 2291 The scale-rotate pivot is represented by a pair of (translate, 2292 inverse-translate) xformOps around the scale and rotate operations. 2293 The rotation operation can be any of the six allowed Euler angle sets. 2294 \\sa UsdGeomXformOp::Type. 2295 2296 The xformOpOrder of an xformable that has all of the supported basic ops 2297 is as follows: 2298 ["xformOp:translate", "xformOp:translate:pivot", "xformOp:rotateXYZ", 2299 "xformOp:scale", "!invert!xformOp:translate:pivot"]. 2300 2301 It is worth noting that all of the ops are optional. For example, an 2302 xformable may have only a translate or a rotate. It would still be 2303 considered as compatible with this API. Individual SetTranslate(), 2304 SetRotate(), SetScale() and SetPivot() methods are provided by this API 2305 to allow such sparse authoring.""" 2306 customData = { 2307 string apiSchemaType = "nonApplied" 2308 string extraIncludes = """ 2309#include "pxr/usd/usdGeom/xformable.h" 2310#include "pxr/usd/usdGeom/xformOp.h" """ 2311 dictionary schemaTokens = { 2312 dictionary pivot = { 2313 string doc = """Op suffix for the standard scale-rotate pivot 2314 on a UsdGeomXformCommonAPI-compatible prim. 2315 """ 2316 } 2317 } 2318 } 2319) 2320{ 2321} 2322 2323class HermiteCurves "HermiteCurves" ( 2324 inherits = </Curves> 2325 doc = """This schema specifies a cubic hermite interpolated curve batch as 2326 sometimes used for defining guides for animation. While hermite curves can 2327 be useful because they interpolate through their control points, they are 2328 not well supported by high-end renderers for imaging. Therefore, while we 2329 include this schema for interchange, we strongly recommend the use of 2330 UsdGeomBasisCurves as the representation of curves intended to be rendered 2331 (ie. hair or grass). Hermite curves can be converted to a Bezier 2332 representation (though not from Bezier back to Hermite in general). 2333 2334 \\section UsdGeomHermiteCurves_Interpolation Point Interpolation 2335 2336 The initial cubic curve segment is defined by the first two points and 2337 first two tangents. Additional segments are defined by additional 2338 point / tangent pairs. The number of segments for each non-batched hermite 2339 curve would be len(curve.points) - 1. The total number of segments 2340 for the batched UsdGeomHermiteCurves representation is 2341 len(points) - len(curveVertexCounts). 2342 2343 \\section UsdGeomHermiteCurves_Primvars Primvar, Width, and Normal Interpolation 2344 2345 Primvar interpolation is not well specified for this type as it is not 2346 intended as a rendering representation. We suggest that per point 2347 primvars would be linearly interpolated across each segment and should 2348 be tagged as 'varying'. 2349 2350 It is not immediately clear how to specify cubic or 'vertex' interpolation 2351 for this type, as we lack a specification for primvar tangents. This 2352 also means that width and normal interpolation should be restricted to 2353 varying (linear), uniform (per curve element), or constant (per prim). 2354 """ 2355) { 2356 vector3f[] tangents = [] ( 2357 doc = """Defines the outgoing trajectory tangent for each point. 2358 Tangents should be the same size as the points attribute.""") 2359} 2360