Description
The RenderToVideoAsync
method is an asynchronous extension method for rendering a scene from a specified camera to a video file using a VideoWriter
. This method is part of the SandboxToolExtensions
class and is designed to be used with the SceneCamera
and VideoWriter
classes. It allows for the optional specification of a duration for the video rendering process.
Usage
To use the RenderToVideoAsync
method, ensure you have a valid SceneCamera
and VideoWriter
instance. Optionally, specify a TimeSpan
to determine the duration of the video. This method returns a Task<bool>
indicating the success of the operation.
Example usage:
SceneCamera camera = new SceneCamera();
VideoWriter videoWriter = new VideoWriter("output.mp4");
TimeSpan? duration = TimeSpan.FromSeconds(10);
bool success = await SandboxToolExtensions.RenderToVideoAsync(camera, videoWriter, duration);
if (success)
{
// Video rendering was successful
}
else
{
// Handle failure
}
Example
SceneCamera camera = new SceneCamera();
VideoWriter videoWriter = new VideoWriter("output.mp4");
TimeSpan? duration = TimeSpan.FromSeconds(10);
bool success = await SandboxToolExtensions.RenderToVideoAsync(camera, videoWriter, duration);
if (success)
{
// Video rendering was successful
}
else
{
// Handle failure
}