0

I'm trying to understand GLSL and shaders and have copied an example shader to generate FBM noise and I'm getting discontinuities in the output.

My shader is here: https://www.shadertoy.com/view/mtSGRz

I've copied the example from https://thebookofshaders.com/13/ and reduced it to a single octave and scaled to make the discontinuity visible:

Screenshot of shader output showing discontinuities

I'm not sure if:

a) I'm not understanding the algorithm correctly and this is the expected output (I doubt that though as I thought that the point of FBM noise was it was continuous and differentiable).

b) There's a bug in the code (I expected that when I was trying to implement the algorithm from scratch, but not since I've now just copied the code from The Book of Shaders.)

c) There's a floating point precision (or similar) issue, but it seems this works for other people?

d) It's something buggy on my setup (Chrome 108 on Windows 10, Dell Precision 5530 laptop)

Can anyone point me in the right direction?

Tom
  • 42,844
  • 35
  • 95
  • 101
  • We need a [mcve]. Code should be posted here, not just in another service (lest the service be discontinued and the question no longer make sense). – Software Engineer Jan 11 '23 at 11:36
  • Doesn't show a discontinuity for me. – Yakov Galka Jan 11 '23 at 14:13
  • 1
    Looks good here too, you can try [using native OpenGL](https://www.geeks3d.com/20130611/webgl-how-to-enable-native-opengl-in-your-browser-windows/) as a rendering backend, shifting the seeds in the random function may also "fix" the issue. – LJᛃ Jan 12 '23 at 03:57
  • I think you are right! It's d) and I've been going in circles for nothing! I've tried adding `--use-gl=desktop` to the command line and that fixes the problem, though weirdly the https://browserleaks.com/webgl site still says ANGLE: "True, Direct3D 11". There are regions where the issue is less apparent so changing the seed is possible, but since I'm just trying to understand the algorithms, I'm happy for now. Feel free to change the comment to an answer & I'll mark it correct. – Tom Jan 13 '23 at 09:58

0 Answers0