In this lesson, you will learn how to manipulate UV coordinates to precisely control how textures are positioned, tiled, and offset across your 3D geometry.
The UV Coordinate System
Think of a texture as a 2D canvas defined by a grid ranging from (0,0) at the bottom-left to (1,1) at the top-right. The "U" represents the horizontal axis, and "V" represents the vertical axis. Every vertex on your 3D mesh is assigned a UV coordinate that tells the GPU exactly which pixel (texel) from the texture to display at that specific corner of the polygon.
Tiling and Offsetting
By manipulating these coordinates, you can change how a texture maps to a surface without altering the underlying mesh. This is typically handled within the Shader Graph using the Tiling and Offset node.
- Tiling: By multiplying the UV coordinates, you shrink the mapping area, forcing the texture to repeat across the surface. Setting tiling to (2, 2) creates four tiles within the space originally occupied by one.
- Offsetting: By adding a value to the UV coordinates, you shift the texture's starting point. This is essential for scrolling effects, like moving water or conveyor belts.
Implementation in Shader Graph
In Shader Graph, you pull the UV data from a UV node and pass it into the UV input of a Sample Texture 2D node. To manipulate the mapping, you insert a Tiling and Offset node in between:
// Logic flow
UV Node -> Tiling and Offset Node -> Sample Texture 2D -> Base Color
By connecting a Vector2 property to the Tiling or Offset inputs of the node, you gain runtime control over the visual appearance of your materials. For instance, increasing the U-offset value over time creates the illusion of seamless motion across an object’s surface. Mastering this allows you to reuse a single small texture for massive surfaces while maintaining control over visual density and animation.
Key Takeaway: UV coordinates act as a bridge between 2D textures and 3D space; by adjusting tiling and offset values, you can procedurally reposition or repeat textures without needing to modify the underlying 3D model.