elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
117 stars 17 forks source link

Dynamic textures support #6

Open shamansir opened 5 years ago

shamansir commented 5 years ago

We have several projects using Elm+WebGL for now and we produce generative graphics with that and we're very happy with using it. Thanks to Elm, we have type safety, and our code defines algorithms in a very clear way. Thanks to WebGL package and its simple and powerful API, doing shaders and passing complex structures to them is easy.

However, for more and more times we encounter the issue that it would be interesting to work with dynamic textures—for example, one would create a kaleidoscopic effect using the part of the viewport that is already rendered. Sure, we can use several canvases for that, but sometimes one layer is needs to be reflected and another is not, or the effect result itself is transforming inside the complex scene.

So, I would kindly ask to think once again on adding this functionality to the API. I did the Pull Request for the Elm 0.18 version, but now in 0.19 it's harder to have your own forks of Elm Packages which use JavaScript, except patching them on build.

shamansir commented 5 years ago

Also, the technique is widely used for storing the data for shaders between frames, renewable, but pre-calculated in the shader itself (so to use GPU force instead of the CPU for such calculation), like different noises depending on the scene environment, etc.

declension commented 5 years ago

@shamansir would this be rendering to framebuffers (on the same lines as https://github.com/elm-community/webgl/issues/35)?

Definitely opening up Elm WebGL to post-processing effects etc would be amazing :smile:

shamansir commented 5 years ago

@declension Yes, having framebuffers would be awesome, can't wait for this to happen :).

coballast commented 5 years ago

@w0rm had a working branch on the old repo for rendering to textures. I wonder how nontrivial it would be to get that working on the latest version?

thewrath commented 3 years ago

Hi, no news on this feature? It's something that is really useful, is there an alternative while waiting for an update?