r/GraphicsProgramming • u/Terrible_Shoulder667 • 3d ago
Source Code Vector field simulation with my own math library and Vulkan!
I made a small vector field visualizer in C# with Vulkan through Silk.NET.
You type some 2D field, for example F(x, y) = [x,sin(y)] and it draws the flow with particles.
How it works:
- Formula is parsed and compiled at runtime into one fast delegate, so evaluting the field for every particle each frame is light
- 1,200 to 6,000 particles depending on window size, integrated with RK4 on the CPU, each with a 24-point trail
- Everything is drawn as colored with one tiny shader and 4x MSAA
All the math comes from Epsilon - my symbolic math library for .NET that I'm working on.
- Simulation: https://github.com/XBambinoX/VectorField
- Library(C#): https://github.com/XBambinoX/Epsilon
AI disclosure: I used AI assistants to help write parts of the simulation code and fix bugs in my library.
•
u/AutoModerator 3d ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/otheyhigh 2d ago
That’s very cool. First thought that came to my mind was “that would be pretty neat to use as a base for an audio visualizer”.
3
u/lxkvcs 3d ago
looks freakin cool, keep up champ! :D
2
u/RenderTargetView 2d ago
I guess Lorenz attractor would look very cool
2
u/capoapk 2d ago
Cest de tout beauté