Help me understand the UV input on textures

I know what is UV mapping, but I can’t really understand what happens when we provide UV data. When we scale by the texture coordinate node what exactly we change (do we multiply each vertex coordinates on the map? or what?)? What happens when we use the panner?

A more specific question: how should I imagine the effect when I plug a worldposition node into the uv input? this node was used to create a material where the texture position was independent of the mesh postion, and I’d like to understand how it worked. (my description might not be clear, check this great video at 18:30 about the effect I wish to understand: https://www.youtube.com/watch?v=rxM6QVwrzBg )

It’s quite hard to explain without image reference, but I’ll give it a shot.

By default, the UV input node is just two gradients. One is a gradient from Right > Left in the ‘Red’ channel, the other is a gradient (black to white) from Top > Bottom in the Green Channel. The term ‘gradient’ is slightly misleading, since they aren’t gradients, they’re actually just a representation of a sequence of 2D Coordinates.

That’s why when you place a TexCoord node down in the material editor, you’re given the funky red/yellow/green looking node. Although it looks like a gradient, it’s actually just purely numbers. It’s just a gradient from 0-1 in X (red), and 0-1 in y (green).

Now, Textures map each pixel to a specific UV-coordinate. In a texture that’s 10px * 10px, the top-left pixel in the source texture will be at UV position 0, 0. The one at the bottom-right will be at position 1, 1. All the pixels in between will be at their respective positions and have a coordinate relative to their position in the texture. Simple so far yah?


Now imagine that I change the UV input by changing the value at (1 1) to (0 0). I haven’t changed the texture yet at all, all I’ve done is change the values of the UV’s. When I send this input to the texture, the pixel on the texture that was originally at 0, 0 will now ALSO appear at 1, 1. AKA, the pixel at the top-left will also be displayed at the bottom-right.

The World-Position node gives you the world-position of a specific pixel. World-Position you can also think of like a gradient, going from zero up to some large number, based on where the pixel is in the world. You can divide this by a certain number to make the scale smaller, and plug that into the UV’s to create the same kind of ‘gradient’ of numbers in 3D-space.

Hopefully that explains it well enough. The best way to think about it is think of UV’s as a gradient of numbers or coordinates. Manipulating those coordinates changes the way the texture appears.

There’s a great tutorial on ImbueFX.com, called ‘Colour Indexing’ which is Free! I highly recommend watching it, it should explain everything :slight_smile: https://www.imbuefx.com/downloads/vfx-quick-tips-color-indexing-in-udk/

1 Like