tfg.rendering.triangle_rasterizer.rasterize
Stay organized with collections
Save and categorize content based on your preferences.
Rasterizes the scene.
tfg.rendering.triangle_rasterizer.rasterize(
vertices: type_alias.TensorLike,
triangles: type_alias.TensorLike,
attributes: Dict[str, type_alias.TensorLike],
view_projection_matrix: type_alias.TensorLike,
image_size: Tuple[int, int],
enable_cull_face: bool = True,
use_vectorized_map: bool = True,
backend: enum.Enum = tfg.rendering.rasterization_backend.RasterizationBackends.OPENGL
,
name: str = 'triangle_rasterizer_rasterize'
) -> Dict[str, type_alias.TensorLike]
Note |
In the following, A1 to An are optional batch dimensions.
|
Args |
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".
|
Returns |
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.
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-10-28 UTC."],[],[]]