Texture mapping adds detail, surface texture, or color to the surfaces of 3D objects. It helps achieve a higher degree of visual realism in 3D graphics without the need for complex geometric models.
Texture mapping might seem difficult at first but the process is very simple. Given below are the complete details on how the texture mapping works.
Select a texture: The first step is to select a 2D image, which will be used as a texture for the 3D model. The image can be a pattern of bricks if you plan to give a wall-like appearance to your 3D model.
UV mapping: It assigns UV coordinates to each vertex of the 3D model. "U" represents the horizontal axis, and "V" represents the vertical axs of the 2D texture.
Create a UV map: A UV map is created by using the assigned coordinates to the vertices of the 3D models. The map stores information on how each point on the 3D object corresponds to a point on the 2D texture. If you flatten the UV map, it will look like a 2D representation of your 3D model. It should contain a mapping of each coordinate on the texture to your 3D model.
Texture application: After creating a UV map, the texture can easily be applied to the 3D object. The 3D image renderer uses the UV map to determine which part of the 2D image should be displayed on exactly which part of the 3D model. Each pixel on the 3D object's surface is matched to a pixel on the 2D texture image based on its UV coordinates.
Rendering: The texture appears on the surface when the 3D object is rendered according to the UV map. It gives the 3D object the appearance of having a detailed surface. Thus, texture mapping creates an illusion of the detailed surfaces of the 3D models, making them visually appealing.
Overall, texture mapping works by taking a 2D image and stretching it over the surface of a 3D object. The process is controlled by a UV map which ensures that each part of the texture image is at the right place on the 3D object's surface.
The result is a 3D object that looks completely realistic.
Mapping textures onto the surface works like mapping on individual polygons, associating each vertex of the polygon mesh with a vertex coordinate.
UV mapping becomes much more challenging when dealing with more complex 3D shapes. It is due to the need to account for curvatures and maintain texture aspect ratios.
Texture mapping of a cylinder involves wrapping a 2D image around the surface of a 3D cylindrical object.
We use the parameters
Here,
When mapping texture onto a cylindrical shape, we use the above parameters as given below.
Where,
By dividing the current segment by the total segments, we normalize the
As
When
The parameter
Where,
Note: Since the parameter
in the 2D texture wraps around the cylinder, texture on the cylinder repeats around its circumference.
Thus, every point on the cylinder can be mapped to a corresponding point in the 2D texture space by using the above approach.
Longitudes and latitudes are the most common ways to parameterize a sphere.
For a sphere,
Assign
Assign
The parameters
These surface parameters are then mapped onto the texture parameters.
Here,
By dividing the current segment by the total segments, we normalize the
Here,
We normalize the latitude value (
It corresponds to the vertical position (
Using these mappings, every point on the surface of the sphere can be linked to a corresponding point in the 2D texture space. It allows us to apply textures onto the sphere to achieve realistic visual effects.
In conclusion, texture mapping, specifically UV mapping, is essential to 3D modeling and rendering. It enables the creation of visually complex and detailed models without increasing geometric complexity.
Whether working with simple planes or complex shapes like cylinders and spheres, understanding UV mapping will allow you to bring your 3D models to life with realistic textures.