Sun Glow Particles Retired

2 months ago by WhappensDev to c/godot

Project: Hadean chronicles.

Particle-based glow system retired. Shader-based flares and sunspots now in production, fully verified visually.

First Obstacle: The Edge-On Mesh

The Sun’s CPU particle system rendered as a tiny red speck instead of a soft corona. After ruling out data issues, configuration problems, and surface artifacts, the real culprit revealed itself via a diagnostic force-opaque test. The glow quad mesh was facing edge-on to the camera, rendering to near-zero width under the fixed top-down perspective. Once this geometry issue was diagnosed, other mechanical problems became clear.

The death-alpha on the color ramp had been commented out—particles just popped rather than fading. Outward radial acceleration was an entire hemisphere pointed inward, creating a frozen shell instead of a breathing corona.

The Pivot: Swap Particles for Shaders

CPU particles bring hidden costs: per-element simulation, alpha sorting, lifetime checks, and overdraw stacking. For a feature meant to complement a shader-driven surface, the limitations outweighed the benefits.

The final decision: add flares and sunspots directly into the fragment shader. Eliminates draw calls, removes CPU simulation, and lifts the performance and visual ceiling.

Shader Suite: Intrinsic Sun Effects

The new sun sphere shader introduces two independent organic effects:

  • Flare Overlay — bright patches sampled from value noise and masked in via additive blending with soft fwidth() edges. Controls handle frequency, threshold, and intensity.
  • Sunspot Darkening — dark patches applied as shadows on the surface. To avoid visual clashes with flares, a separate noise sample uses different scale and a fixed phase offset, applied as a multiplicative dimmer after all additive light contributions.

Both effects share a 2-hash, 3-octave value-noise utility—cheap, localized, and flickering in real time.

Visual Duels: Tuning by Screenshot

Several subtle regressions emerged with each adjustment, each caught and corrected through visual verification:

  • After decoupling flare frequency from texture tiling, the result looked fractured along hash-lattice edges. Switched to separate spherical UV sampling to fix aliasing.
  • With wavelength-limited scale, large regions of the disc interpolated into giant blocky polygons. Increased scale and added a third finer noise octave for smoother, smaller patches.
  • Early mixing caused sunspots to be invisible, hidden by additive core and rim passes that ignored the darkening mask. Moved the pass after all additive contributions.
  • Sunspot coverage was too heavy, producing oversized, blurry blotches. Tightened threshold and raised scale for sparse, smaller, crisper spots.

Outcome

The particle system code remains in place but dormant, with the glow emission call commented out. A planned hybrid (shader + dedicated arc sprites) was discussed but not adopted. The shader implementation now delivers a living, breathing corona without expensive particle infrastructure.

godot
godot

@programming.dev

login for more options
7972
1192
567

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

go to feed...