hydra-synth / hydra

Livecoding networked visuals in the browser
https://hydra.ojack.xyz
GNU Affero General Public License v3.0
2.16k stars 264 forks source link

mipmapping #27

Open claudeha opened 6 years ago

claudeha commented 6 years ago

could be nice if mipmaps were generated for output textures (maybe they are already?), and to expose a way to set the bias parameter of texture2d() for blur effects (a small bias could be used for reaction-diffusion stuff, a very large bias could be used to get the average colour of the whole image for things like equalisation).

I tried implementing a blur by adding scrolled copies, but failed miserably.

generating mipmaps is an expensive operation, so it should probably be optional...

https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html (about 2/5 of the way down the page) http://docs.gl/es2/glGenerateMipmap http://docs.gl/el3/texture

ojack commented 6 years ago

Right now it is using linear filtering, but it shouldn't be hard to expose the texture filtering options.

I am hoping to implement blur and other convolution filters using multi-pass rendering. The idea is that some functions, instead of all becoming part of the same shader, would become a separate render pass. I need to revisit it, but somehow I wasn't getting the expected results.

I started to work on it here: https://github.com/ojack/hydra-synth/blob/master/src/renderpass-functions.js

and here: https://github.com/ojack/hydra-synth/blob/cdbb882a3c9cecac5cf8d3024c8a64f3b71d7e61/src/GeneratorFactory.js#L234

ojack commented 6 years ago

ok, looking at the code again its pretty messy because I was trying things out! Will clean it up and post updates here.