# tfg.rendering.texture.texture_map.map_texture

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/rendering/texture/texture_map.py#L31-L143) |

Maps the texture texture_image using uv_map.

    tfg.rendering.texture.texture_map.map_texture(
        uv_map: tfg_type.TensorLike,
        texture_image: tfg_type.TensorLike,
        tiling: bool = False,
        interpolation_method: Text = 'bilinear',
        name: Text = 'map_texture'
    ) -> tf.Tensor

The convention we use is that the origin in the uv-space is at (0, 0), u
corresponds to the x-axis, v corresponds to the y-axis, and the color for each
pixel is associated with the center of the corresponding pixel. E.g. if we
have a texture \[\[1, 2\], \[3, 4\]\], then the uv-coordinates that correspond to
the values 1, 2, 3, and 4 are (0.25, 0.75), (0.75, 0.75), (0.25, 0.25),
(0.75, 0.25), respectively. You can see that the v-axis starts from the bottom
of the texture image as would be in cartesian coordinates and that by
multiplying the uv-coordinates with the length of the texture image, 2, you
can recover the pixel centers in this case, e.g. (0.25, 0.25) \* 2 = (0.5, 0.5)
corresponds to the bottom-left pixel color that is 3.

When a uv-coordinate corresponds to a point on the texture image that does
not coincide with any of the pixel centers, bilinear interpolation is applied
to compute the color value.

If the aspect ratio of the texture is not 1, the texture is compressed to fit
into a square.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `uv_map` | A tensor of shape `[A1, ..., An, H, W, 2]` containing the uv coordinates with range \[0, 1\], height H and width W. |
| `texture_image` | A tensor of shape `[H', W', C]` containing the texture to be mapped with height H', width W', and number of channels C of the texture image. |
| `tiling` | If enabled, the texture is tiled so that any uv value outside the range \[0, 1\] will be mapped to the tiled texture. E.g. if uv-coordinate is (0, 1.5), it is mapped to (0, 0.5). When tiling, the aspect ratio of the texture image should be 1. |
| `interpolation_method` | A string specifying which interplolation method to use. It can be 'bilinear' or 'nearest' for bilinear or nearest neighbor interpolation, respectively. |
| `name` | A name for this op that defaults to "map_texture". |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor of shape `[A1, ..., An, H, W, C]` containing the interpolated values. ||

<br />