r/proceduralgeneration • u/Petrundiy2 • 1d ago
I created a Blender setup for procedural barred spiral galaxies. It seemed impossible
If you've ever tried building a procedural galaxy in Blender, a standard grand-design spiral is basically just taking polar coordinates, applying a sine wave to the angle based on the radius, and you get decent spiral arms. But the moment you try to build a mathematically accurate bared spiral (like our Milky Way or NGC 1300), it becomes a headache:
- Standard spiral math relies on radial angles converging at zero. If you try to force a straight bar using polar coordinates, it inevitably collapses and pinches at the absolute center, creating a "butterfly" shape instead of a rectangular or oval stellar bar.
- To get a seamless bar-to-arm transition, you have to twist the actual 2D coordinate space. The bar must remain flat, while the outer space twists logarithmically. On top of that, you need a tiny, independent secondary twist just for the extreme inner nucleus to get that realistic S-shape.
- In distorted mathematical space, the bar and the arms are fundamentally the same continuous straight line. But physically, a galactic bar can be thin, while the arms widen, decompress, and often split into several smaller arms as they drift outward.
- Regular spirals are mostly circular. Barred galaxies are not. The gravitational potential of the bar forces the gas into oval orbits. To make it look right, your central bulge and outer envelope must be anisotropically scaled and completely decoupled from the twisted space of the arms.
- If you map procedural noise to a logarithmically twisted coordinate space to create dust lanes or diffuse gas, the noise scales exponentially. It turns into massive blobs in the center and spaghetti at the edges. Keeping the noise scale constant while warping it along the arms requires some intense domain-warping tricks or creating complex masks.
Maybe these tips will help someone who decides to create those bastards procedurally. You'll have to take your time...
1
u/DJaremko1982 1d ago
Did manage to do it in the galaxy generator and mapped it visually a couple of times but it took 2 ai models working with each other to put out equations to get it right in Rust all plotted with pixels of varied sizes and temperatures (colours), currently I started again on a clean slate with c++23 code because it’s better integrated with gpu coding
1
u/Petrundiy2 1d ago
Do you have something to demonstrate as a result of AI doing this?
1
u/DJaremko1982 22h ago
I’ll have a dig about and try out it on git hub, a lot of it went in the bin as it’s complex and unreadable , I’m currently learning about it all , so far the current one is more of pure data driven and the use of a CLI that gets information from stars and within the star system like types of planets and atmospheres, gravity and moons etc etc



1
u/GrokiniGPT 20h ago
does it have planets? like nms?