0
\$\begingroup\$

I am working on a game where I want to allow users to mix multiple colors (similar to shown in this video): https://youtu.be/11UFYyv8hjs?t=316.

I have the following questions:

  1. I am expecting that this is done using shaders. What kind of shader I have to use for such implementation? What will be the logic to create this type of shader?
  2. Are there any other ways using which this feature can be implemented?
  3. Are there any open source tutorials or examples?

I would appreciate any suggestions and thoughts on this topic. Thank you.

\$\endgroup\$
  • 1
    \$\begingroup\$ This looks like texture advection, using Navier-Stokes equations for fluid simulation. This is an extremely common effect to find in shader demos, so I'd encourage you to do a quick search for "fluid simulation shader" to find tons of tutorials and sample projects to choose from. If you run into any trouble implementing one of these guides in your game, please edit your question to describe the specific step you need help with. \$\endgroup\$ – DMGregory Aug 11 at 14:10
  • \$\begingroup\$ Thank you for your reply. I ended up using [this link] (github.com/keijiro/StableFluids). \$\endgroup\$ – Naresh Aug 12 at 13:27
  • 1
    \$\begingroup\$ If you've solved your problem, please consider writing up a walkthrough of your solution as an Answer below - that way you can help the next dev who has a similar question. \$\endgroup\$ – DMGregory Aug 12 at 13:30
-1
\$\begingroup\$

I ended up using Jos Stam's stable fluid simulation on Unity. Here is the one Unity plugin for that simulation. For WebGL, there are plenty of open-source implementation available to refere.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is currently a link-only answer, which becomes fairly useless if the repo you're linking to ever changes, moves, goes offline, or becomes unavailable from a reader's region. For this reason, we usually delete link-only answers. To make sure your answer remains useful for readers well into the future, try editing it to provide a more detailed walkthrough of how you solved the problem. That way, even if the link rots away, your answer still gives future readers useful advice to apply. \$\endgroup\$ – DMGregory Aug 12 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.