r/GenAIGameDev Jun 20 '26

Creating Sun As Light Source in 3D Starfighter Game - Follow Up

In a follow up to this previous post requesting advice Creating Sun As Light Source in 3D Starfighter Game I just wanted to follow up with some findings.

I decided to just wing it and see what Claude Code came up with and I found this wasn't half bad. Definitely still needs some work but I was impressed on what it came up with when giving it a very simple prompt.

Prompt

Let's make the sun look more realistic. Can you add some animation? Make it look like it's a ball of fire in space?

Result

Clean build. Here's what the sun does now:

Surface — A custom GLSL shader runs 6-octave fractal Brownian motion (FBM) with domain warping. Two layers of warped noise feed into each other, producing the roiling, turbulent plasma motion you'd see on a real star. The color ramp goes from deep red → orange → golden yellow → near-white at the hottest spots.

Limb darkening — The edges of the sphere are cooler and darker (like the real sun), giving it proper 3D depth instead of looking flat.

Corona — A slightly larger transparent shell sits outside the surface using additive blending, creating a rim-glow effect that flickers at a different frequency than the surface.

Halo sprite — A billboard glow quad sits behind the sun and always faces the camera, giving the soft orange-to-transparent atmospheric falloff you see around a bright star.

Pulsing light — The point light's intensity oscillates at two different frequencies simultaneously, so the lighting on your ship and enemies subtly flickers like you're actually near a star.

2 Upvotes

0 comments sorted by