pytorch3d.renderer.mesh.renderer

renderer

class pytorch3d.renderer.mesh.renderer.MeshRenderer(rasterizer, shader)[source]

Bases: Module

A class for rendering a batch of heterogeneous meshes. The class should be initialized with a rasterizer (a MeshRasterizer or a MeshRasterizerOpenGL) and shader class which each have a forward function.

to(device)[source]
forward(meshes_world: Meshes, **kwargs) Tensor[source]

Render a batch of images from a batch of meshes by rasterizing and then shading.

NOTE: If the blur radius for rasterization is > 0.0, some pixels can have one or more barycentric coordinates lying outside the range [0, 1]. For a pixel with out of bounds barycentric coordinates with respect to a face f, clipping is required before interpolating the texture uv coordinates and z buffer so that the colors and depths are limited to the range for the corresponding face. For this set rasterizer.raster_settings.clip_barycentric_coords=True

class pytorch3d.renderer.mesh.renderer.MeshRendererWithFragments(rasterizer, shader)[source]

Bases: Module

A class for rendering a batch of heterogeneous meshes. The class should be initialized with a rasterizer (a MeshRasterizer or a MeshRasterizerOpenGL) and shader class which each have a forward function.

In the forward pass this class returns the fragments from which intermediate values such as the depth map can be easily extracted e.g.

to(device)[source]
forward(meshes_world: Meshes, **kwargs) Tuple[Tensor, Tensor][source]

Render a batch of images from a batch of meshes by rasterizing and then shading.

NOTE: If the blur radius for rasterization is > 0.0, some pixels can have one or more barycentric coordinates lying outside the range [0, 1]. For a pixel with out of bounds barycentric coordinates with respect to a face f, clipping is required before interpolating the texture uv coordinates and z buffer so that the colors and depths are limited to the range for the corresponding face. For this set rasterizer.raster_settings.clip_barycentric_coords=True