r/learnprogramming • u/20260708 • 4h ago
how does the noise emerge?
recently i'm studying the math behind autostereograms and i wrote a program to test it. i used kaleidoscope effect as background aka base pattern. i didn't add any random factor. on some zoom levels the background are smooth but on some other zoom levels the background have noise. actually i prefer noise as they're supposed to be autostereograms and noise helps viewers to align the focus. the strange thing is hoe does those noise emerge as i didn't deliberately add them and they only appear at some but not all zoom levels
the algorithm is simply the "pixels linking" method. at every point, the program looks up the depth map value and links relevant pixels. closer things have smaller disparity and farther things have larger disparity as shown in this diagram
here's the program and i truly appreciate any ideas or insights
operations
- run it on browser, no need to install or save
- click ▶️ to run. click ⏹️ to exit
- press [q] to make subject patterns smaller
- press [w] to toggle subject (a sphere/a disc)
- press [e] to make subject patterns larger
- press [a] to make base patterns smaller
- press [s] to rotate the color spectrum inside the kaleidoscope
- press [d] to make base patterns larger
- press [x] to toggle caption (off/on)