GithubHelp home page GithubHelp logo

chimera's Introduction

Chimera

Presentation

Chimera is a 2D fluid simulation framework in Unity based on Nimitz's implementation of the Simple and fast fluids, adding vorticity confinement.

Experimental results

Color advection

Particle advection

Height from fluid

Fluid and boids

Result video

Lights of Nibel

Disclaimer

This framework is a work in progress, things may change (a lot) or not alway work as expected.

The 3D implementation is not functional for now, you can delete the 3D folders safely.

The 2D example scene works in HDRP since it uses HDRP materials and Visual Effect Graph, but the framework should work in any pipeline.

Description

The fluid is simulated in a custom render texture, updated with the fluid shader and controlled by the FluidTextureController.cs script. The velocity of the fluid is stored in the R and G channels of the texture and can be used to create normals, advect colors or particules, or refract light.

The advection texture is used to advect a texture color along the velocity of a fluid texture.

Fluid Texture Controller

It controls how many times the fluid is updated at each frame. A higher number of updates per frames will make the fluid faster but less detailed.

Its ID is used to link emitters to it.

Advection Texture Controller

It controls how many times the advection texture is updated at each frame. A higher number of updates per frames will make the advected color move faster.

Its ID is used to link emitters to it.

Fluid Emitter

To create a fluid emitter add the FluidEmitter.cs script to an object in your scene. Link it to a fluid and/or advection controller via the controllers ID fields.

The position of the emitter is converted from world 3D position to UV 2D position using the position mapping parameter to define which axis to project on.

The size parameter is used to scale the position of the emitter into the [0,1] texture UV range. Use it if your emitter movement is not in the [0,1] range (i.e. inside a 1x1x1m cube).

The IsCentered parameter is used to determine how to translate the position of the emitter to the [0,1] texture UV range. If checked, the origin (0,0,0) is mapped to the center of the texture (0.5,0.5), if unchecked no mapping is applied and the origin (0,0,0) will map to the bottom left of the texture (0,0).

The forward axis of the emitter object is used to determine 2D emitter direction.

The emitter can create velocity in the linked FluidController texture and/or add color in the linked AdvectionController texture.

Version

Tested in 2019.4.12f1.

Acknowledgments

  • Nimitz for his shadertoy example.
  • Fluid simulation based on Simple and fast fluids by Martin Guay, Fabrice Colin and Richard Egli.
  • Ben Golus for his valuable help on Unity Forums.
  • Sylvia Wilhelm for her help, thoughts and remarks on the fluid equations.

chimera's People

Contributors

barbelot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.