Coder Social home page Coder Social logo

cjsb / position-based-fluids Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikeswoods/position-based-fluids

2.0 2.0 0.0 95.37 MB

Real(ish)-time position based fluid simulation

Makefile 4.64% C++ 40.31% C 53.04% Objective-C 1.70% GLSL 0.01% CMake 0.03% Objective-C++ 0.16% CSS 0.08% HTML 0.01% Shell 0.02% Batchfile 0.01%

position-based-fluids's Introduction

Real(ish)-time position based fluid simulation

CIS 563: Physically Based Animation, Spring 2015
Instructor: Ladislav Kavan
TAs: Yu Wang, Harmony Li, Xinjie Ma, Ying Li, and Tiantian Liu

Background

For the purpose of this project, we had two main goals in mind: to correctly and cleanly implement a real-time, particle-based fluid simulation as outlined in the 2013 paper Position Based Fluids by Matthias Müller and Miles Macklin. To achieve the goal of real-time simulation, we exploited the parallel processing power of the GPU as much as possible, either through the use of OpenGL for direct rendering, or OpenCL for generalized parallel computation.

Implementation details

For the most part, every major feature outlined by Müller and Macklin was implemented in our simulator:

  • Particle incompressibility
  • Simulated surface tension using an artificial pressure term
  • Vorticity confinement to mitigate numerical dissipation issues
  • XSPH viscosity

Enhancements

  • All major components of the simulation were implemented as OpenCL kernels, allowing the code to run directly on the GPU
  • As a potential improvement over the fast nearest-neighbor finding method employed by Müller and Macklin (Green 2008), we implemented the parallel counting sort technique as described in FAST FIXED-RADIUS NEAREST NEIGHBORS: INTERACTIVE MILLION-PARTICLE FLUIDS by Hoetzlein/NVIDIA (2013)
  • The bounds of the simulation can be dynamically changed at runtime according to a number of predefined animation patterns, such as sine wave, sawtooth wave, and one-shot compression. This allows us to create a number of novel fluid motion effects like crashing waves, etc. with ease on-the-fly

Tooling, third party libraries, and frameworks

  • Xcode 6.1 (tested under OSX 10.9.5 on model "MacBookPro11,1")
  • openFrameworks, community contributed
    • A great, generalized C++ framework for creative coding and experimentation
  • ofxMSAOpenCL, Memo Akten
    • A openFrameworks addon wrapper that removes much of the boilerplate code associated with OpenCL

Results

Demo video

References

Building

Hardware prerequisites

A graphics card that supports OpenCL v1.1+ and OpenGL 3+ (a.k.a. "modern OpenGL")

Software prerequisites

OSX
  • Xcode 6.x

  • OSX 10.9 and higher, although it might compile on older versions. Unfortunately, we are unable to test for compatibility on older versions of OSX.

Windows 7+
  • Visual Studio 2012 Professional (although the Basic edition may suffice)

  • The necessary OpenCL runtime/SDK provided by the manufacturer of the the graphics card/devices:

    • For Intel cards and chipsets:

      1. Download the latest Intel graphics drivers
      2. Download the free edition of OpenCL™ Code Builder with Intel® INDE (formerly Intel® SDK for OpenCL™ Applications). This is needed for OpenCL.lib for Visual Studio to link against. If it is installed correctly, you should see the environment variable INTELOCLSDKROOT defined under System > Advanced System Settings > Environment Variable > System variables
    • For Nvidia cards and chipsets:

      1. TODO
    • For AMD cards and chipsets:

      1. TODO
    • For ATI cards and chipsets:

      1. TODO

position-based-fluids's People

Contributors

mikeswoods avatar postmandev avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.