A code walkthrough for a 2D N-Body particle sim experiment, in Godot 4, using GLSL compute shaders.
Open Source available on GitHub: https://github.com/ThePathfindersCodex
Learning new stuff is great! Don't hesitate to let me know if you see bugs or have advice on how to improve it.
00:00 Particle Sim Overview
04:35 GDScript Code
14:34 GLSL Compute Shader Code
23:52 Gaps and Issues
27:47 Bring It All Together
Purpose:
TECH DEMO and CODE WALKTHRU - code overview for the project covered in earlier shader experiments videos
HANDS ON CODE LEARNING - code available on GitHub to try yourself
Stuff covered:
a GLSL compute shader with more than one pass
using typed packed arrays in Godot
using a subviewport for zoom-like effects
pairwise 2D Newtonian gravity and collision detection/resolution in the shader during the sim pass 1
manually rasterizing circles to draw all dots during the draw pass 2
a roll-your-own performance graph in it's own subviewport