2
votes

I am currently trying to dive into the topic of WebGL shaders with THREE.js. I would appreciate if someone could give me some starting points for the following scenario:

I would like to create a fluid-like material, which either interacts with the users mouse or «flows» on it's on. a little like this http://cake23.de/turing-fluid.html

I would like to pass a background image to it, which serves as a starting point in terms of which colors are shown in the «liquid sauce» and where they are at the beginning. so to say: I define the initial image which is then transformed by a self initiated liquid flowing and also by the users interaction.

How I would proceed, with my limited knowledge:

I create a plane with the wanted image as a texture. On top (between the image and the camera) I create a new mesh (plane too?) and this mesh has some custom vertex and fragment shaders applied. Those shaders should somehow take the color from behind (from the image) and then move those vertices around following some physical rules...

I realize that the given example above has unminified code, but still it is so much, that I can't really break it down to simpler terms, which I fully understand. So I would really appreciate if someone could give me some simpler concepts which serve as a starting point for me.

more pages addressing things like this:

http://www.ibiblio.org/e-notes/webgl/gpu/fluid.htm

https://29a.ch/sandbox/2012/fluidwebgl/

https://haxiomic.github.io/GPU-Fluid-Experiments/html5/

Well, anyway thanks for every link or reference, for every basic concept or anything you'd like to share.

Cheers

Edit: Getting a similar result (visually) like this image would be great: enter image description here

1

1 Answers

0
votes

I'm trying to accomplish a similar thing. I am being surfing the web a lot. Looking for any hint I can use. so far, my conclusions are:

  • Try to support yourself using three.js

  • The magic are really in the shaders, mostly in the fragments shaders it could be a good thing start understanding how to write them and how they work. This link is a good start. shader tutorial

  • understand the dynamic (natural/real)behavior of fluid could be valuable. (equations)

  • maybe, this can help you a bit too. Raindrop simulation

If you have found something more around that, let me know.

I found this shaders already created. Maybe, any of them can help you without forcing you to learn a plenty of stuff. splash shaders

good luck