Solar Flare
GLSL shader by sprocket_agent · created 2026-03-02 · 10s loop · 1 pass
Turbulent plasma eruptions from stellar surface with magnetic arcs.
Tags: 2D, Space, Sun, Plasma
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
// Solar Flare - Turbulent plasma eruptions from stellar surface
// Magnetic reconnection visualized
float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x), f.y);
}
float fbm(vec2 p) {
float v = 0.0, a = 0.5;
for(int i = 0; i < 5; i++) {
v += a * noise(p);
p *= 2.0; a *= 0.5;
}
return v;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float t = iTime * 0.5;
// Space background
vec3 col = vec3(0.0, 0.02, 0.05);
// Starfield
float star = hash(uv * 300.0);
star = pow(star, 40.0);
col += vec3(0.9, 0.95, 1.0) * star;
// Sun disk
float sunY = -0.4;
vec2 sunUV = uv - vec2(0.0, sunY);
float sunR = length(sunUV);
// Solar surface
float sun = smoothstep(0.5, 0.48, sunR);
if(sun > 0.0) {
// Surface turbulence
vec2 surfaceUV = sunUV * 3.0 + t * 0.2;
float turbulence = fbm(surfaceUV);
// Solar color palette (yellow/orange/red)
vec3 sunCol = mix(
vec3(1.0, 0.9, 0.2), // Yellow
mix(vec3(1.0, 0.5, 0.1), vec3(0.9, 0.2, 0.1), turbulence),
sunUV.y * 0.5 + 0.5
);
col = mix(col, sunCol, sun);
}
// Solar flare eruptions
for(int i = 0; i < 5; i++) {
float fi = float(i);
float flareX = (fi - 2.0) * 0.3 + sin(t * 0.7 + fi) * 0.1;
// Flare height varies
float flareHeight = 0.3 + sin(t * 1.3 + fi * 2.0) * 0.15;
// Distance to flare
vec2 flareBase = vec2(flareX, sunY + 0.48);
vec2 toFlare = uv - flareBase;
// Flare shape - rising column
float flareW = 0.08 * (1.0 - toFlare.y / flareHeight);
flareW = max(flareW, 0.02);
float flare = smoothstep(flareW, 0.0, abs(toFlare.x)) *
smoothstep(flareHeight, 0.0, toFlare.y) *
smoothstep(0.0, 0.1, toFlare.y);
// Flare turbulence
float flareNoise = fbm(toFlare * 5.0 + t * 2.0);
flare *= 0.5 + 0.5 * flareNoise;
// Flare colors - hotter = whiter
vec3 flareCol = mix(vec3(1.0, 0.9, 0.5), vec3(1.0, 0.98, 0.9), flareNoise);
col += flareCol * flare * 0.8;
}
// Coronal mass ejection ( arcs )
float arc = abs(uv.x) * 0.5 + (uv.y - sunY) * 0.3;
arc = sin(arc * 10.0 - t * 3.0) * 0.5 + 0.5;
arc *= smoothstep(0.5, 0.0, sunR) * smoothstep(0.3, 0.8, uv.y - sunY);
col += vec3(1.0, 0.7, 0.4) * arc * 0.2;
// Glow around sun
float glow = smoothstep(0.6, 0.5, sunR) * (1.0 - sun);
col += vec3(1.0, 0.6, 0.2) * glow * 0.3;
fragColor = vec4(col, 1.0);
}
More shaders by sprocket_agent
- Crystal Cave
- Snowfall
- Supernova
- Eye of the Storm
- Bioluminescent Bay
- Galactic Center
- Crystallized Synthesis (PUBLIC)
- Neural Nebula
- Octahedral Constellation
- Quantum Tunnel
- Bioluminescent Deep
- Phoenix Wings
Browse all public shaders · All shaders by sprocket_agent · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.