PoC implementation in p5.ps : https://github.com/Drunk-Developper/absolute-crazy-led-mapper
This is half baked :
- setup go, glsl, ...
- load shader from file
- render shader
- pass float uniform to shader (time)
- pass texture to shader as uniform
- extract texture data from shader
- chain shaders (send output texture from a shader as input texture for the next)
- refactor code for readability
- render each shader in its own texture
- use proper mapping shaders
- extract pixels from mapping texture
- generate artnet or sACN udp packages
- fix broken mapping
- add mask generator from a json
- add multi-universe support
[x] fps throttling for sacn- fps throttling for all (screen and sacn output)
- dynamic quantity of universes (should be limited by underlying hardware)
- fix mapping.frag
- [-] fix multi-universe
- basic debug UI [draw mapping lines on top of screen]
- make it run on a jetson nano
- [-] make basic control UI
- add isf support
- add automatic OSC -> ISF controls
- optional antialiasing (average 4 next pixels)
- mapping position has to be multiplied by 10 to work (why ?!)
- [Space] - toggle view between Rendering and Mapping Shader
- [Esc] - Quit
- Only one shader as input
- input shader will render in a 800x600 texture
- ReadPixels is reading from the currently on screen shader, it should always read the mapping shader
First prototype was using a p x 1 mapping texture, n beeing the quantity of pixel to map.
Updated approach is to use a 170 x u mapping texture, u beeing the quantity of universe to send.
If a fixture is overflowing a universe, it will continue on the next one.
Each universe is encoded as one line in the mapping texture and all unused pixels will be "blank" (actually white -> vec4(255 255 255 255) as black -> vec4(0 0 0 0) translate is a valid position vec2(0, 0)) We'll filter out blank pixel in the mapping shader (no computation) and won't send non mapped universe out on the network.
Note : As we only need 3 channels per pixel (RGB) we can send 170 pixels per universe, but it requires dealing with the "2 left over bits" at the end of the frame.
Our mapping texture is 680 bytes per universe (rgba) while our extraction is only 510 bytes per univese (rgb).
- https://github.com/KyleBanks/conways-gol
- https://github.com/go-gl/example/blob/master/gl41core-cube/cube.go
- https://github.com/mjw6i/shadr/blob/master/app.go
- https://thebookofshaders.com
- https://stackoverflow.com/questions/59433403/how-to-save-fragment-shader-image-changes-to-image-output-file
- https://www.haroldserrano.com/blog/how-to-pass-data-from-shader-to-shader-in-opengl
- https://learnopengl.com/book/book_pdf.pdf
- https://github.com/Hundemeier/go-sacn
Maight thank you later :