HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pass.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef USDRENDER_GENERATED_PASS_H
25 #define USDRENDER_GENERATED_PASS_H
26 
27 /// \file usdRender/pass.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdRender/api.h"
31 #include "pxr/usd/usd/typed.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
35 
37 
38 #include "pxr/base/vt/value.h"
39 
40 #include "pxr/base/gf/vec3d.h"
41 #include "pxr/base/gf/vec3f.h"
42 #include "pxr/base/gf/matrix4d.h"
43 
44 #include "pxr/base/tf/token.h"
45 #include "pxr/base/tf/type.h"
46 
48 
49 class SdfAssetPath;
50 
51 // -------------------------------------------------------------------------- //
52 // RENDERPASS //
53 // -------------------------------------------------------------------------- //
54 
55 /// \class UsdRenderPass
56 ///
57 /// A RenderPass prim encapsulates the necessary information
58 /// to generate multipass renders. It houses properties for generating
59 /// dependencies and the necessary commands to run to generate renders, as
60 /// well as visibility controls for the scene. While RenderSettings
61 /// describes the information needed to generate images from a single
62 /// invocation of a renderer, RenderPass describes the additional information
63 /// needed to generate a time varying set of images.
64 ///
65 /// There are two consumers of RenderPass prims - a runtime executable that
66 /// generates images from usdRender prims, and pipeline specific code that
67 /// translates between usdRender prims and the pipeline's resource scheduling
68 /// software. We'll refer to the latter as 'job submission code'.
69 ///
70 /// \anchor usdRender_renderVisibility
71 /// The objects that are relevant to the render is specified via the
72 /// renderVisibility collection (UsdCollectionAPI) and can be accessed via
73 /// GetRenderVisibilityCollectionAPI(). This collection has includeRoot set to
74 /// true so that all objects participate in the render by default. To render
75 /// only a specific set of objects, there are two options. One is to modify the
76 /// collection paths to explicitly exclude objects that don't participate in
77 /// the render, assuming it is known; the other option is to set includeRoot to
78 /// false and explicitly include the desired objects. These are complementary
79 /// approaches that may each be preferable depending on the scenario.
80 ///
81 /// The name of the prim is used as the pass's name.
82 ///
83 ///
84 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
85 /// that are text/tokens, the actual token is published and defined in \ref UsdRenderTokens.
86 /// So to set an attribute to the value "rightHanded", use UsdRenderTokens->rightHanded
87 /// as the value.
88 ///
89 class UsdRenderPass : public UsdTyped
90 {
91 public:
92  /// Compile time constant representing what kind of schema this class is.
93  ///
94  /// \sa UsdSchemaKind
96 
97  /// Construct a UsdRenderPass on UsdPrim \p prim .
98  /// Equivalent to UsdRenderPass::Get(prim.GetStage(), prim.GetPath())
99  /// for a \em valid \p prim, but will not immediately throw an error for
100  /// an invalid \p prim
101  explicit UsdRenderPass(const UsdPrim& prim=UsdPrim())
102  : UsdTyped(prim)
103  {
104  }
105 
106  /// Construct a UsdRenderPass on the prim held by \p schemaObj .
107  /// Should be preferred over UsdRenderPass(schemaObj.GetPrim()),
108  /// as it preserves SchemaBase state.
109  explicit UsdRenderPass(const UsdSchemaBase& schemaObj)
110  : UsdTyped(schemaObj)
111  {
112  }
113 
114  /// Destructor.
116  virtual ~UsdRenderPass();
117 
118  /// Return a vector of names of all pre-declared attributes for this schema
119  /// class and all its ancestor classes. Does not include attributes that
120  /// may be authored by custom/extended methods of the schemas involved.
122  static const TfTokenVector &
123  GetSchemaAttributeNames(bool includeInherited=true);
124 
125  /// Return a UsdRenderPass holding the prim adhering to this
126  /// schema at \p path on \p stage. If no prim exists at \p path on
127  /// \p stage, or if the prim at that path does not adhere to this schema,
128  /// return an invalid schema object. This is shorthand for the following:
129  ///
130  /// \code
131  /// UsdRenderPass(stage->GetPrimAtPath(path));
132  /// \endcode
133  ///
135  static UsdRenderPass
136  Get(const UsdStagePtr &stage, const SdfPath &path);
137 
138  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
139  /// is defined (according to UsdPrim::IsDefined()) on this stage.
140  ///
141  /// If a prim adhering to this schema at \p path is already defined on this
142  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
143  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
144  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
145  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
146  /// current EditTarget for any nonexistent, or existing but not \a Defined
147  /// ancestors.
148  ///
149  /// The given \a path must be an absolute prim path that does not contain
150  /// any variant selections.
151  ///
152  /// If it is impossible to author any of the necessary PrimSpecs, (for
153  /// example, in case \a path cannot map to the current UsdEditTarget's
154  /// namespace) issue an error and return an invalid \a UsdPrim.
155  ///
156  /// Note that this method may return a defined prim whose typeName does not
157  /// specify this schema class, in case a stronger typeName opinion overrides
158  /// the opinion at the current EditTarget.
159  ///
161  static UsdRenderPass
162  Define(const UsdStagePtr &stage, const SdfPath &path);
163 
164 protected:
165  /// Returns the kind of schema this class belongs to.
166  ///
167  /// \sa UsdSchemaKind
169  UsdSchemaKind _GetSchemaKind() const override;
170 
171 private:
172  // needs to invoke _GetStaticTfType.
173  friend class UsdSchemaRegistry;
175  static const TfType &_GetStaticTfType();
176 
177  static bool _IsTypedSchema();
178 
179  // override SchemaBase virtuals.
181  const TfType &_GetTfType() const override;
182 
183 public:
184  // --------------------------------------------------------------------- //
185  // PASSTYPE
186  // --------------------------------------------------------------------- //
187  /// A string used to categorize differently structured
188  /// or executed types of passes within a customized pipeline.
189  ///
190  /// For example, when multiple DCC's (e.g. Houdini, Katana, Nuke)
191  /// each compute and contribute different Products to a final result,
192  /// it may be clearest and most flexible to create a separate
193  /// RenderPass for each.
194  ///
195  ///
196  /// | ||
197  /// | -- | -- |
198  /// | Declaration | `uniform token passType` |
199  /// | C++ Type | TfToken |
200  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
201  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
204 
205  /// See GetPassTypeAttr(), and also
206  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
207  /// If specified, author \p defaultValue as the attribute's default,
208  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
209  /// the default for \p writeSparsely is \c false.
211  UsdAttribute CreatePassTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
212 
213 public:
214  // --------------------------------------------------------------------- //
215  // COMMAND
216  // --------------------------------------------------------------------- //
217  /// The command to run in order to generate
218  /// renders for this pass. The job submission code can use
219  /// this to properly send tasks to the job scheduling software
220  /// that will generate products.
221  ///
222  /// The command can contain variables that will be substituted
223  /// appropriately during submission, as seen in the example below
224  /// with {fileName}.
225  ///
226  /// For example:
227  /// command[0] = "prman"
228  /// command[1] = "-progress"
229  /// command[2] = "-pixelvariance"
230  /// command[3] = "-0.15"
231  /// command[4] = "{fileName}" # the fileName property will be substituted
232  ///
233  ///
234  /// | ||
235  /// | -- | -- |
236  /// | Declaration | `uniform string[] command` |
237  /// | C++ Type | VtArray<std::string> |
238  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->StringArray |
239  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
242 
243  /// See GetCommandAttr(), and also
244  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
245  /// If specified, author \p defaultValue as the attribute's default,
246  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
247  /// the default for \p writeSparsely is \c false.
249  UsdAttribute CreateCommandAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
250 
251 public:
252  // --------------------------------------------------------------------- //
253  // FILENAME
254  // --------------------------------------------------------------------- //
255  /// The asset that contains the rendering prims or other
256  /// information needed to render this pass.
257  ///
258  ///
259  /// | ||
260  /// | -- | -- |
261  /// | Declaration | `uniform asset fileName` |
262  /// | C++ Type | SdfAssetPath |
263  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Asset |
264  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
267 
268  /// See GetFileNameAttr(), and also
269  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
270  /// If specified, author \p defaultValue as the attribute's default,
271  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
272  /// the default for \p writeSparsely is \c false.
274  UsdAttribute CreateFileNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
275 
276 public:
277  // --------------------------------------------------------------------- //
278  // DENOISEENABLE
279  // --------------------------------------------------------------------- //
280  /// When True, this Pass pass should be denoised.
281  ///
282  /// | ||
283  /// | -- | -- |
284  /// | Declaration | `uniform bool denoise:enable = 0` |
285  /// | C++ Type | bool |
286  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
287  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
290 
291  /// See GetDenoiseEnableAttr(), and also
292  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
293  /// If specified, author \p defaultValue as the attribute's default,
294  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
295  /// the default for \p writeSparsely is \c false.
297  UsdAttribute CreateDenoiseEnableAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
298 
299 public:
300  // --------------------------------------------------------------------- //
301  // RENDERSOURCE
302  // --------------------------------------------------------------------- //
303  /// The source prim to render from. If _fileName_ is not present,
304  /// the source is assumed to be a RenderSettings prim present in the current
305  /// Usd stage. If fileName is present, the source should be found in the
306  /// file there. This relationship might target a string attribute on this
307  /// or another prim that identifies the appropriate object in the external
308  /// container.
309  ///
310  /// For example, for a Usd-backed pass, this would point to a RenderSettings
311  /// prim. Houdini passes would point to a Rop. Nuke passes would point to
312  /// a write node.
313  ///
314  ///
317 
318  /// See GetRenderSourceRel(), and also
319  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
322 
323 public:
324  // --------------------------------------------------------------------- //
325  // INPUTPASSES
326  // --------------------------------------------------------------------- //
327  /// The set of other Passes that this Pass depends on
328  /// in order to be constructed properly. For example, a Pass A
329  /// may generate a texture, which is then used as an input to
330  /// Pass B.
331  ///
332  /// By default, usdRender makes some assumptions about the
333  /// relationship between this prim and the prims listed in inputPasses.
334  /// Namely, when per-frame tasks are generated from these pass prims,
335  /// usdRender will assume a one-to-one relationship between tasks
336  /// that share their frame number. Consider a pass named 'composite'
337  /// whose _inputPasses_ targets a Pass prim named 'beauty`.
338  /// By default, each frame for 'composite' will depend on the
339  /// same frame from 'beauty':
340  /// beauty.1 -> composite.1
341  /// beauty.2 -> composite.2
342  /// etc
343  ///
344  /// The consumer of this RenderPass graph of inputs will need to resolve
345  /// the transitive dependencies.
346  ///
347  ///
350 
351  /// See GetInputPassesRel(), and also
352  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
355 
356 public:
357  // --------------------------------------------------------------------- //
358  // DENOISEPASS
359  // --------------------------------------------------------------------- //
360  /// The The UsdRenderDenoisePass prim from which to
361  /// source denoise settings.
362  ///
363  ///
366 
367  /// See GetDenoisePassRel(), and also
368  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
371 
372 public:
373  // ===================================================================== //
374  // Feel free to add custom code below this line, it will be preserved by
375  // the code generator.
376  //
377  // Just remember to:
378  // - Close the class declaration with };
379  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
380  // - Close the include guard with #endif
381  // ===================================================================== //
382  // --(BEGIN CUSTOM CODE)--
383 
384  /// Return the UsdCollectionAPI interface used for examining and
385  /// modifying the render visibility of this prim.
386  // For more information, see
387  // \\ref usdRender_renderVisibility "Render Visibility"
390 };
391 
393 
394 #endif
static USDRENDER_API UsdRenderPass Define(const UsdStagePtr &stage, const SdfPath &path)
#define USDRENDER_API
Definition: api.h:40
USDRENDER_API UsdRelationship CreateDenoisePassRel() const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDRENDER_API UsdRenderPass Get(const UsdStagePtr &stage, const SdfPath &path)
UsdRenderPass(const UsdSchemaBase &schemaObj)
Definition: pass.h:109
USDRENDER_API UsdRelationship CreateInputPassesRel() const
USDRENDER_API UsdCollectionAPI GetRenderVisibilityCollectionAPI() const
USDRENDER_API UsdRelationship GetInputPassesRel() const
static USDRENDER_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Represents a concrete typed schema.
USDRENDER_API UsdAttribute GetFileNameAttr() const
USDRENDER_API UsdAttribute GetPassTypeAttr() const
USDRENDER_API UsdAttribute CreateCommandAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:133
Definition: typed.h:61
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457
USDRENDER_API UsdRelationship GetDenoisePassRel() const
Definition: path.h:290
USDRENDER_API UsdRelationship CreateRenderSourceRel() const
USDRENDER_API UsdRelationship GetRenderSourceRel() const
UsdSchemaKind
Definition: common.h:129
USDRENDER_API UsdSchemaKind _GetSchemaKind() const override
USDRENDER_API UsdAttribute GetCommandAttr() const
USDRENDER_API UsdAttribute CreateDenoiseEnableAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
static const UsdSchemaKind schemaKind
Definition: pass.h:95
USDRENDER_API UsdAttribute GetDenoiseEnableAttr() const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
USDRENDER_API UsdAttribute CreatePassTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: type.h:64
virtual USDRENDER_API ~UsdRenderPass()
Destructor.
USDRENDER_API UsdAttribute CreateFileNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: value.h:164
UsdRenderPass(const UsdPrim &prim=UsdPrim())
Definition: pass.h:101