1 rendering.pytorch3d_depth_renderer

rendering.pytorch3d_depth_renderer

PyTorch3D depth renderer used for oracle RRI simulations.

This module contains a configurable renderer that turns candidate poses (efm3d.aria.PoseTW) plus an ASE mesh into per-pixel depth maps. It follows the project’s config-as-factory pattern and keeps the public API torch-native so it can slot into the NBV training loop without intermediate numpy copies.

1.1 Classes

Name Description
Pytorch3DDepthRenderer Depth rendering backend based on PyTorch3D.
Pytorch3DDepthRendererConfig Configuration for Pytorch3DDepthRenderer.

1.1.1 Pytorch3DDepthRenderer

rendering.pytorch3d_depth_renderer.Pytorch3DDepthRenderer(config)

Depth rendering backend based on PyTorch3D.

1.1.1.1 Methods

Name Description
render Rasterize metric z-depth for world-from-camera candidate poses.
1.1.1.1.1 render
rendering.pytorch3d_depth_renderer.Pytorch3DDepthRenderer.render(
    poses,
    mesh,
    camera,
    *,
    frame_index=None,
)

Rasterize metric z-depth for world-from-camera candidate poses.

1.1.1.1.1.1 Parameters
Name Type Description Default
poses PoseTW Batched PoseTW world-from-camera transforms with logical shape (C, 12). required
mesh tuple[torch.Tensor, torch.Tensor] World-frame vertices Tensor["V 3", float] in metres and triangle indices Tensor["F 3", int64]. required
camera CameraTW EFM camera calibration supplying physical-image intrinsics. required
frame_index int | None Optional calibration row. When omitted, camera must already be singleton or aligned one-to-one with poses. None
1.1.1.1.1.2 Returns
Name Type Description
Tensor A tuple of raw z-buffer Tensor["C H W", float] in metres,
Tensor closest-face indices Tensor["C H W", int64] with negative
PerspectiveCameras values for raster misses, and aligned PyTorch3D cameras. The
tuple[Tensor, Tensor, PerspectiveCameras] caller combines face hits with near/far checks to form a mask.

1.1.2 Pytorch3DDepthRendererConfig

rendering.pytorch3d_depth_renderer.Pytorch3DDepthRendererConfig()

Configuration for Pytorch3DDepthRenderer.

1.1.2.1 Attributes

Name Description
target_type Return the batched PyTorch3D rasterizer constructed by this config.
device Geometry tensor device resolved under PYTORCH3D_BACKEND policy.
zfar Far clipping plane in metres used by downstream validity checks.
znear Near clipping plane (metres); triangles closer than this are clipped.
cull_backfaces If True drop triangles with normals pointing away from the camera.
blur_radius Soft rasterizer blur radius; keep 0 for hard z-buffer.
bin_size Rasterisation bin size in pixels.
max_faces_per_bin Performance knob mirroring RasterizationSettings.max_faces_per_bin.
max_views_per_batch Maximum cameras rasterized together, bounding replicated mesh memory.
dtype Computation dtype; use float16/bfloat16 on CUDA for speed
is_debug Enable debug logging on the renderer console.
verbosity Enable Console logging.

1.2 Functions

Name Description
camera_tw_to_pytorch3d Convert calibrated world-from-camera poses to the project’s PyTorch3D convention.

1.2.1 camera_tw_to_pytorch3d

rendering.pytorch3d_depth_renderer.camera_tw_to_pytorch3d(
    camera,
    pose_world_camera,
    *,
    device,
    dtype=torch.float32,
)

Convert calibrated world-from-camera poses to the project’s PyTorch3D convention.

This is the sole adapter for persisted linear CameraTW calibration and rendered camera_z depth. PyTorch3D uses row-vector world-to-view transforms, so its rotation is the original world-from-camera rotation. The inverse translation is evaluated with a fixed three-component reduction: CUDA matrix multiplication can otherwise round the same view differently when rendered alone or in a candidate batch. This keeps acquisition camera extrinsics independent of the surrounding proposal count.

Back to top