UV Tiling in ShaderFX

[Reposted from my AREA blog – Game On]


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.

First up, we’ll show how to tile in both directions equally. 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 U & V
UV Tiling – Equally in U & V

If you want to tile the U and V by different amounts, you first 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 - Differently in U & V
UV Tiling – Differently in U & V

0 comments on “UV Tiling in ShaderFXAdd yours →

What do you think? No really...I'd like to know.