Loading...
Searching...
No Matches
UsdAppUtilsFrameRecorder Class Reference

A utility class for recording images of USD stages. More...

#include <frameRecorder.h>

Public Member Functions

USDAPPUTILS_API UsdAppUtilsFrameRecorder (const TfToken &rendererPluginId=TfToken(), bool gpuEnabled=true, const SdfPath &renderSettingsPrimPath=SdfPath())
 The rendererPluginId argument indicates the renderer plugin that Hyrda should use.
 
TfToken GetCurrentRendererId () const
 Gets the ID of the Hydra renderer plugin that will be used for recording.
 
bool SetRendererPlugin (const TfToken &id)
 Sets the Hydra renderer plugin to be used for recording.
 
void SetImageWidth (const size_t imageWidth)
 Sets the width of the recorded image.
 
void SetComplexity (const float complexity)
 Sets the level of refinement complexity.
 
USDAPPUTILS_API void SetColorCorrectionMode (const TfToken &colorCorrectionMode)
 Sets the color correction mode to be used for recording.
 
USDAPPUTILS_API void SetCameraLightEnabled (bool cameraLightEnabled)
 Turns the built-in camera light on or off.
 
USDAPPUTILS_API void SetIncludedPurposes (const TfTokenVector &purposes)
 Sets the UsdGeomImageable purposes to be used for rendering.
 
USDAPPUTILS_API bool Record (const UsdStagePtr &stage, const UsdGeomCamera &usdCamera, const UsdTimeCode timeCode, const std::string &outputImagePath)
 Records an image and writes the result to outputImagePath.
 

Detailed Description

A utility class for recording images of USD stages.

UsdAppUtilsFrameRecorder uses Hydra to produce recorded images of a USD stage looking through a particular UsdGeomCamera on that stage at a particular UsdTimeCode. The images generated will be effectively the same as what you would see in the viewer in usdview.

Note that it is assumed that an OpenGL context has already been setup for the UsdAppUtilsFrameRecorder if OpenGL is being used as the underlying HGI device. This is not required for Metal or Vulkan.

Definition at line 57 of file frameRecorder.h.

Constructor & Destructor Documentation

◆ UsdAppUtilsFrameRecorder()

USDAPPUTILS_API UsdAppUtilsFrameRecorder ( const TfToken rendererPluginId = TfToken(),
bool  gpuEnabled = true,
const SdfPath renderSettingsPrimPath = SdfPath() 
)

The rendererPluginId argument indicates the renderer plugin that Hyrda should use.

If the empty token is passed in, a default renderer plugin will be chosen depending on the value of gpuEnabled. The gpuEnabled argument determines if the UsdAppUtilsFrameRecorder instance will allow Hydra to use the GPU to produce images. The renderSettingsPrimPath argument is used to set the active render settings prim path in Hydra. The defaultLights argument determines if the UsdAppUtilsFrameRecorder will add a default set of lights, in addition to any present in the scene.

Member Function Documentation

◆ GetCurrentRendererId()

TfToken GetCurrentRendererId ( ) const
inline

Gets the ID of the Hydra renderer plugin that will be used for recording.

Definition at line 78 of file frameRecorder.h.

◆ Record()

USDAPPUTILS_API bool Record ( const UsdStagePtr &  stage,
const UsdGeomCamera usdCamera,
const UsdTimeCode  timeCode,
const std::string &  outputImagePath 
)

Records an image and writes the result to outputImagePath.

The recorded image will represent the view from usdCamera looking at the imageable prims on USD stage stage at time timeCode.

If usdCamera is not a valid camera, a camera will be computed to automatically frame the stage geometry.

When we are using a RenderSettings prim, the generated image will be written to the file indicated on the connected RenderProducts, instead of the given outputImagePath. Note that in this case the given usdCamera will later be overridden by the one authored on the RenderSettings Prim.

Returns true if the image was generated and written successfully, or false otherwise.

◆ SetCameraLightEnabled()

USDAPPUTILS_API void SetCameraLightEnabled ( bool  cameraLightEnabled)

Turns the built-in camera light on or off.

When on, this will add a light at the camera's origin. This is sometimes called a "headlight".

◆ SetColorCorrectionMode()

USDAPPUTILS_API void SetColorCorrectionMode ( const TfToken colorCorrectionMode)

Sets the color correction mode to be used for recording.

By default, color correction is disabled.

◆ SetComplexity()

void SetComplexity ( const float  complexity)
inline

Sets the level of refinement complexity.

The default complexity is "low" (1.0).

Definition at line 112 of file frameRecorder.h.

◆ SetImageWidth()

void SetImageWidth ( const size_t  imageWidth)
inline

Sets the width of the recorded image.

The height of the recorded image will be computed using this value and the aspect ratio of the camera used for recording.

The default image width is 960 pixels.

Definition at line 101 of file frameRecorder.h.

◆ SetIncludedPurposes()

USDAPPUTILS_API void SetIncludedPurposes ( const TfTokenVector purposes)

Sets the UsdGeomImageable purposes to be used for rendering.

We will always include "default" purpose, and by default, we will also include UsdGeomTokens->proxy. Use this method to explicitly enumerate an alternate set of purposes to be included along with "default".

◆ SetRendererPlugin()

bool SetRendererPlugin ( const TfToken id)
inline

Sets the Hydra renderer plugin to be used for recording.

This also resets the presentation flag on the HdxPresentTask to false, to avoid the need for an OpenGL context.

Note that the renderer plugins that may be set will be restricted if this UsdAppUtilsFrameRecorder instance has disabled the GPU.

Definition at line 88 of file frameRecorder.h.


The documentation for this class was generated from the following file: