Download

How to properly use Frac for CustomUV

Hi

I have try to make shader for performance benefit by calculatin tiled material in the vertex shader. but seems that there some trouble with Frac when calculation is placed in the vertex shader.
How to correctly calculate Frac result for CustomUV?

Pixel shader version. Works well

Vertex shader version. Does not working

What you are trying to do will not work in vertex shader and the result you received is expected.

Can you provide more info why is not will work with VS?

Take a list of paper, draw a triangle in 2d coordinate system. Run your math on its vertices coordinates. Try to interpolate result between two vertices and you will see why it will not work.

You are right. Thank you.

General rule is that you can only interpolate linear and continuous functions without errors.