Table of Contents
Built for Siege Week 10, for the 'Space' theme. As space as it gets, right? This one was so much more shader than I expected, and yet I want to try and expose a bunch of shader parameters. Unless someone shows me an easy way to give someone access to a number with godot UI though, I'll just stick with nothing for now. sigh Oh well. I could make this bigger or add this in somewhere or make this my wallpaper though... Wait... If I optimize this?? Someone please help that would be awesome.
From Siege W14 (THE LAST ONE) I turned the web version into a compute shader, and upped the capabilities of the shader because of it. I will keep the github pages version up if you still want to, but if this github repo doesn't get starred I won't work on either the web or the compute shader version. AKA If you like it, STAR!! Thanks for visiting!
A black hole simulation to rival Interstellar!!! No, its a realtime black hole raytracer with a volumetric accretion disk, a volumetric galaxy, and a grid to show the bending of spacetime. May your computer live to see another day.
- Left click to drag camera around black hole
- Scroll to zoom around the black hole
- Edit the parameters of the shader by yourself! Click and drag or edit the values directly
- Space to pause the game
- C to hide controls and take screenshots!!
Math. Physics. Fragment shaders. I hate that I had to have such long conversations with ai to understand any of this... But I mostly understand it now?? Also how to work with fragment shaders! Fun! Also, I finally made a simulation editor, which makes making simulators much easier... :)
From my second round of development on this project... I have a love hate relationship with compute shaders and Godot. It works so much faster, but the process is so weird and finnicky... The shader setup node is so large just to get the compute shader running haha. Actually, I still havent gotten sampler3D's figured out, hence why I have a 3D Noise function in my code.
Might be big, so click to reveal!
compute_showcase_compressed.mp4
Tip
Change the camera_target value to change where the camera is looking!
If you still insist on building this unoptimized mess, go ahead. Oh, but the release (web) version is here. For the newer, compute version, check the releases tab
- Install Godot 4.5
- Download and unzip the code
- Open the file with Godot project manager
- Go to Project > Export, add whichever platform you're on (MacOS, Windows) and then click export.rt.
- You're good to go!
- Left click and drag to pan camera around the black hole
- Scroll to zoom closer and farther
- Shift to pause
- Click and drag values, or edit them directly
- Click toggle controls to toggle the control visibility
- Simulate the black hole
- Raytracing?
- Render accretion disk
- Stars in the background
- Spherical star to show gravitaitonal lensing
- Simulation interactivity, time step, pause, etc
- Add a volumetric galaxy
- Put a grid under it to show a point of non-moving
- Make it interactible, move the camera around using mouse position
- Edit the simulation yourself using the access to the simulator
- Turn the editor runtime_inspector class into a gdextension maybe?
- Post processing (bloom etc)
- Add physics movement of planets
- Two black holes 0.0
Since this is running on a compute shader, it doesn't work on web. I'm pissed too, but maybe one day I'll turn it into a spatial shader or something.
Distributed under the MIT License. See LICENSE for more information.
Pixel Saver - itch.io
Project Link: https://github.com/PixelSaver/PlacePixels
- Many thanks for both the inspiration and the code from @kavan010's amazing black hole C++ simulation. Couldn't have done it without you.
- https://godotshaders.com/shader/black-hole-shader/ by TheOxideGamer
- Random guy on the internet for their simplex noise function. Here's their reddit post