tfg.rendering.triangle_rasterizer.rasterize

Rasterizes the scene.

In the following, A1 to An are optional batch dimensions.

vertices A tensor of shape [A1, ..., An, V, 3] containing batches of V vertices, each defined by a 3D point.
triangles A tensor of shape [T, 3] containing T triangles, each associated with 3 vertices from vertices.
attributes A dictionary of tensors, each of shape [A1, ..., An, V, K] containing batches of V vertices, each associated with K-dimensional attributes. K may vary by attribute.
view_projection_matrix A tensor of shape [A1, ..., An, 4, 4] containing batches of matrices used to transform vertices from model to clip coordinates.
image_size A tuple (height, width) containing the dimensions in pixels of the rasterized image.
enable_cull_face Enables BACK face culling when True, and no culling when False.
use_vectorized_map If true uses vectorized_map for barycentrics computations otherwise uses map_fn.
backend A rasterization_backend.RasterizationBackends enum containing the backend method to use for rasterization.
name A name for this op. Defaults to "triangle_rasterizer_rasterize".

A dictionary. The key "mask" is of shape [A1, ..., An, height, width, 1] and stores a value of 0 of the pixel is assciated with the background, and 1 with the foreground. The key "barycentrics" is of shape [A1, ..., An, height, width, 3] and stores barycentric weights. Finally, the dictionary contains perspective correct interpolated attributes of shape [A1, ..., An, height, width, K] per entry in the attributes dictionary.