Transforms points from model to screen coordinates.
tfg.rendering.opengl.math.model_to_screen(
point_model_space, model_to_eye_matrix, perspective_matrix, screen_dimensions,
lower_left_corner=(0.0, 0.0), name=None
)
Note:
Please refer to http://www.songho.ca/opengl/gl_transform.html for an
in-depth review of this pipeline.
Note:
In the following, A1 to An are optional batch dimensions which must be
broadcast compatible.
Args |
point_model_space
|
A tensor of shape [A1, ..., An, 3] , where the last
dimension represents the 3D points in model space.
|
model_to_eye_matrix
|
A tensor of shape [A1, ..., An, 4, 4] , where the last
two dimension represent matrices to transform points from model to eye
coordinates.
|
perspective_matrix
|
A tensor of shape [A1, ..., An, 4, 4] , where the last
two dimension represent matrices to transform points from eye to clip
coordinates.
|
screen_dimensions
|
A tensor of shape [A1, ..., An, 2] , where the last
dimension is expressed in pixels and captures the width and the height (in
pixels) of the screen.
|
lower_left_corner
|
A tensor of shape [A1, ..., An, 2] , where the last
dimension captures the position (in pixels) of the lower left corner of
the screen.
|
name
|
A name for this op. Defaults to 'model_to_screen'.
|
Raises |
InvalidArgumentError
|
if any input contains data not in the specified range
of valid values.
|
ValueError
|
If any input is of an unsupported shape.
|
Returns |
A tuple of two tensors, respectively of shape [A1, ..., An, 3] and
[A1, ..., An, 1] , where the first tensor containing the projection of
point_model_space in screen coordinates, and the second represents the 'w'
component of point_model_space in clip space.
|