tfg.rendering.barycentrics.differentiable_barycentrics
Computes differentiable barycentric coordinates from a Framebuffer.
tfg.rendering.barycentrics.differentiable_barycentrics(
framebuffer: tfg.rendering.framebuffer.Framebuffer
,
clip_space_vertices: type_alias.TensorLike,
triangles: type_alias.TensorLike,
use_vectorized_map: bool = True
) -> tfg.rendering.framebuffer.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.
Args |
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.
|
Returns |
a copy of framebuffer , but the differentiable barycentric coordinates will
replace any barycentric coordinates already in the framebuffer .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[null,null,["Last updated 2022-10-28 UTC."],[],[]]