Stay organized with collections Save and categorize content based on your preferences.

Computes differentiable barycentric coordinates from a Framebuffer.

The barycentric coordinates will be differentiable w.r.t. the input vertices. Later, we may support derivatives w.r.t. pixel position for mip-mapping.

framebuffer a multi-layer Framebuffer containing triangle ids and a foreground mask with shape [batch, num_layers, height, width, 1]
clip_space_vertices a 2-D float32 tensor with shape [vertex_count, 4] or a 3-D tensor with shape [batch, vertex_count, 4] containing homogenous vertex positions (xyzw).
triangles a 2-D int32 tensor with shape [triangle_count, 3] or a 3-D tensor with shape [batch, triangle_count, 3] containing per-triangle vertex indices in counter-clockwise order.
use_vectorized_map If true uses vectorized_map otherwise uses map_fn.

a copy of framebuffer, but the differentiable barycentric coordinates will replace any barycentric coordinates already in the framebuffer.