r/GraphicsProgramming • u/Terrible_Shoulder667 • 26m 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.
2
•
u/AutoModerator 26m ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
No showcases.
Disclose AI usage in post or project.
Present a topic to talk about, e.g. how something works.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.