How paveldogreat/webgl-fluid-simulation works
This is a browser-based WebGL fluid simulation: users interact with a canvas and adjust simulation and visual settings. The visible code shows pointer event handling, GPU-based fluid calculations, and optional bloom and sunray effects during rendering. The implementation is concentrated in one source file. Because excerpts omit portions of the runtime loop, links from pointer input to simulation updates and from rendering to the displayed canvas are not asserted.
Main entry points: script.js Fluid solver
Components 9
Interaction and controls
- Pointer input
script.js - Simulation settings
script.js
GPU simulation
- Fluid solver
script.js - GPU buffers
script.js - Shader programs
script.js
Rendering effects
- Renderer
script.js - Bloom effect
script.js - Sunray effect
script.js
Other components
- User
Connections 8
- User → Pointer input: moves pointer
script.js - User → Simulation settings: adjusts controls
script.js - Pointer input → Fluid solver: updates input
script.js - Simulation settings → Fluid solver: configures solver
script.js - Fluid solver → GPU buffers: updates fields
script.js - Fluid solver → Shader programs: dispatches passes
script.js - Renderer → Bloom effect: applies optionally
script.js - Renderer → Sunray effect: applies optionally
script.js