UV Tiling in ShaderFX

By Matthew Doyle - 12 Feb, 2014 - Maya LT

Recently I was asked how to tile textures inside ShaderFX, so I figured I'd provide a little instruction today for everyone. It's really very simple, but if you're new to real time shaders and the tool, you may have no idea how to do it.

We have to consider that we can tile a texture in two directions - U and V - or horizontally and vertically. Just remember that V = vertical. You can either tile in both directions equally or tile by different amounts in each direction.

I'm going to show you three ways to tile your textures. Ultimately, the third way is the best choice, but I think it's good to see all three ways.

First up, we'll show how to tile in both directions equally using a single floating point number. All that is needed is to use a Multiply operation (from the Math category) on the UV output of a UVSet (from the Inputs Common category). Multiply by a floating point value, then pipe the result into the UV input of the TextureMap node. Simple as that.

UV Tiling - Equally in Both U & V

If you want to tile the U and V by different amounts, there are two ways you can do this - a complicated way, and an easy way.

Here's the complicated way first. You should never really need to do it this way, but this way shows how you can use the Vector Component and Vector Construct nodes:

First, you need to use the Vector Component node (found in the Values category) to be able to work with the U and V separately. The output of the Vector Component node is listed as X, Y, Z, and W. In this case, X is the first value or U, and Y is the second value or V. So, if you want to tile U by 4, you just multiply the X component by 4. Then you need to wire that result, along with the Y component back into a Vector Construct node (also found in the Values category), to rebuild the UV coordinate values into a float2. You can then wire this float2 into the Texture node's UV input. If you want to tile both U and V, just wire a Multiply operation to the Y output of the Vector Component in the same way.

UV Tiling - Different Tiling on U and V

Now for the easy way:

Simply follow the instructions for the first option to tile both U & V equally, and instead of using a single float, use a float2. This will allow you to change the U and V separately in a single node.

Posted By
Published In
Tags
  • Maya LT
  • Games
1 Comment
To post a comment please login or register
jason_galore | 2 years ago
How do you rotate the UVs? I know there is a UV Rotator, but that animates the UV rotation. What if I just want to offset the rotation by 45 degrees? Thanks, Jason
Edited by jason_galore 2 years ago