newton.utils.normalize_texture#

newton.utils.normalize_texture(texture_image, *, flip_vertical=False, require_channels=False, scale_unit_range=True)[source]#

Normalize a texture array for rendering.

Parameters:
  • texture_image (ndarray[Any, dtype[Any]] | None) – Texture image array (H, W, C) or None.

  • flip_vertical (bool) – Whether to flip the image vertically.

  • require_channels (bool) – Whether to enforce 3/4-channel images and expand grayscale.

  • scale_unit_range (bool) – Whether to scale unit-range floats to 0-255.

Returns:

Normalized uint8 image array or None if unavailable.

Return type:

np.ndarray | None