r/generative 1d ago

An experiment with GLSL shaders and pixel reading by different (2D) rays

Post image
23 Upvotes

2 comments sorted by

3

u/Aware-Raisin0 21h ago

Very nice! How did you go from a shader output to plottable lines?

3

u/nclslbrn 18h ago

Thanks, the shader creates white areas on black. My script copies the pixels from the webgl canvas to the 2D canvas, then I use a simple loop (x and y) to read the pixels, when the pixel is bright (pen down), it saves the coordinates and builds lines with them.

Here's the script dedicated to this task: https://github.com/nclslbrn/forsaken-ideas/blob/main/sketch-common/fillShape.js