Skip to content
bean-mhmPublic

About

2D and 3D wave simulations with pretty visualizations

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

Repository files navigation

wavesim2

wavesim2 lets you define the properties and logic for a 2D or 3D wave simulation and then actually does the simulation for you. On the GPU.

It's written in Python and comes with:

  • GPU acceleration using a compute shader for the simulation and a ray marching fragment shader for rendering 3D volumes.

  • Programmable excitations in the wave field

  • Programmable camera POV

  • Realtime preview

  • PNG and JPEG export

  • Sending custom data to the GPU (image pixel data, audio samples, etc.)

Eye candy

A 2D planar wave passing through a barrier with a small slit

A 3D planar wave passing through a spherical lens

A 2D planar wave passing through a biconvex lens

Running

wavesim2 uses uv for package and project management. It's super easy to learn and use (check out its README.md) so I won't clutter this document with redundant instructions.

Once you got the packages all set up, run main.py.

Editing

If you don't care about the implementation details, config.py is all you need to worry about. It already has 15 simulations for demonstration, but, of course, you can add your own.

Go to the last few lines in config.py to change which simulation main.py will run. For example, the following will tell main.py to use the first demo sim.

selected_sim_params = sim1_basic

The code is easy to understand and modify (unless your brain has lost its functionality due to vibe coding everything).

Supporting

Buy Me a Coffee at ko-fi.com

About

2D and 3D wave simulations with pretty visualizations

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages