GLSL dot function

Hi!

I was porting this old seascape-code from shadertoy Shader - Shadertoy BETA and came up with some kind of a tearing problem like in the first picture here.


Somehow I found out that if I change the second part of the dot-function on the line 48 (of the code in the picture) to integers (line 50), the tearing disappears like in the next picture here.

I don’t understand what is happening here, can someone explain it to me?

Toni.

This has come up a few times. It seems like a defect in that hash function, that results in some artifacts at certain intervals on certain GPUs. It’s not TouchDesigner specific, but different shading languages (CUDA/WebGL/Vulkan etc) have different rules for how floating point precision and the sin() function works.

1 Like

More information in this post: