GithubHelp home page GithubHelp logo

loganzartman / wavescape Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 3.72 MB

interactive fluid simulation in browser based on SPH, GPU-accelerated with WebGL2

Home Page: https://wavescape.loga.nz/

License: MIT License

HTML 0.74% TypeScript 97.64% CSS 1.62%
javascript simulation sph interactive smoothed-particle-hydrodynamics gpgpu webgl webgl2 gpu typescript

wavescape's Introduction

wavescape

WIP interactive, GPU-accelerated fluid simulation using smoothed particle hydrodynamics.

It can do all the simulation work on the GPU using WebGL2! It doesn't use WebGL2 Compute, which isn't widely supported. Instead, it does tricks with regular vertex and fragment shaders.

try it!

a dam break scene where water sloshes from one side to the other

controls

  • space: start/stop simulation
  • s: step forward in time (use while stopped)
  • r: reset
  • click and drag: touch fluid
  • click settings for some tweakable parameters!

references

wavescape's People

Contributors

loganzartman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

wavescape's Issues

modularize shaders

the shaders are a mess with tons of copy-pasted code.

I already tried glslify, but it is broken for webgl2. there's already a PR open that might fix all my problems, but glslify seems pretty dead. It might be easiest to define shaders in JS with a glsl template literal, and use string interpolation to do some very basic code reuse.

do walls properly

my implementation of walls is a hack at best. At the very least, the density estimate is incorrect for particles near walls, since the walls are not factored into density computation at all. This is probably responsible for particle clustering on walls.

basic diagnostics

as a subset of writing tests #6, it would be great to automatically run some basic diagnostics; things like:

  1. can we write to and read from a texture
  2. can we copy between textures using a sampler
  3. can we do scattered atomic writes using the vertex shader+gl.points technique
  4. etc.

the reason for this is that this doesn't work on some browsers/systems, and I have no way to debug them.

switch to uniform buffer objects

most of the compute-like shaders use the exact same uniforms, so it could be more convenient and performant to group them into uniform buffer objects

write tests

is this testable? I'd need to be able to actually create a webgl context, so... headless browsers? (playwright? puppeteer?)

fix ios safari 16

works fine in desktop safari, what's wrong with iOS?

I don't have an iphone but maybe I can use the free 1-minute browserstack sessions to debug ๐Ÿ’€

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.