Frac, Round and Floor are not working in build when I do vertex displacement

I have a simple vertex displacement shader that mimics a doodle effect. But the vertices are static when I build the app to my meta Quest 3. The issue appears to be the Floor function since it works fine when I remove it. This is weird, and I feel I’m making something silly somewhere. Works on Editor just fine.

What am I doing wrong? I also tried to use Frac and Round, and got the same results.

So I tried using n - (n % 1) instead of floor but still no luck…

I tried using a C# script to pass a shader variable “CustomTime” instead of doing the floor inside the shader. It still doesn’t work, I’m lost here.

What i don’t understand is how is it working in the editor.

This is what i see: Offset for UVs repeat every 1 unit. If you use “Floor”, you will get values like 1.00 => 2.00 => 3.00 => … etc, all this offsets, are just tiling to the same position (just 1 tile over, but the same contents), so to my understanding, you shouldn’t be looking at “any” visible movement (you would have displacement, but non-animated)

What did you want to achieve through the “Floor” func?

Also, you are using the UV1 channel instead of UV0, are you sure you have 2 UV sets in your mesh? (this is a long shot, as often you will have 2 UVsets (the second is normally light UVs), but if not, maybe in the Editor you always access the previous one if it doesn’t exist, but on build, any UV set that is not present could just be empty)

PD: i’ve just seen the “mirror” sampler, so yes you would have visible movement (but just like a repeating A => B => A => B values), so my only guess is the UVs, i hope thats it, nothing else comes to mind right now.

Yeah, my mesh has a UV1 channel. I just figured out the issue, the mirror sampling, it’s not working for some reason on Quest build. Changing the approach and using sin() to sample the UV solved the issue. Thank you for the reply.

1 Like