Skip to content
dhkjones
Portfolio
Home
Shaders
Orbital
Shader Editor
+
Delete
−
+
Fit
Scroll, middle-drag or Space-drag to pan. Pinch or use Control and scroll to zoom. Press 0 to fit the graph.
Home
↑
Add Node
!
Click or drag from the dot below Home to connect a node.
About
Work
Demoreel
Sign in
Shaders
404
Orbital
Thin Film Interference
Shader Editor
CV
Contact Details
Ghost Recon
Assassin’s Creed Shadows
Star Wars outlaws
Game Engine Programming
Raytracing Engine
Hobby Renders
Gallery
Fullscreen
Education
ARTFX
Open Window Institute
Connect to
About
Work
Demoreel
Sign in
Shaders
404
Orbital
Thin Film Interference
Shader Editor
CV
Contact Details
Ghost Recon
Assassin’s Creed Shadows
Star Wars outlaws
Game Engine Programming
Raytracing Engine
Hobby Renders
Gallery
Fullscreen
Education
ARTFX
Open Window Institute
All nodes connected.
Home
About
Work
Demoreel
Sign in
Shaders
Orbital
Thin Film Interference
Shader Editor
CV
Contact Details
Ghost Recon
Assassin’s Creed Shadows
Star Wars outlaws
Game Engine Programming
Raytracing Engine
Hobby Renders
Gallery
Fullscreen
Education
ARTFX
Open Window Institute
Shader Editor
darmstadtium.glsl
#version 300 es precision highp float; uniform vec2 u_resolution; uniform float u_time; uniform vec2 u_orbit; out vec4 fragColor; // This is the 6d orbital with m = 0 from Gunnar Ilhuicaatl Medina // Sanson's orbital table: https://www.shadertoy.com/view/7XB3WW const vec3 AMBER = vec3(0.750, 0.750, 0.750); const vec3 BACKGROUND = vec3(0.008, 0.008, 0.015); const float EDGE_FADE = 0.12; const float HORIZONTAL_FALLOFF = 1.35; const float ROLL_DEGREES = 1.0; const float TIP_DEGREES = 2.5; const float SECONDS_PER_WOBBLE = 8.0 / 30.0; const float PI = 3.14159265; const float CLOUD_RADIUS = 0.60; const float SAMPLE_SPACING = 0.012; const int MAX_SAMPLES = 100; vec3 turnAround(vec3 direction, vec3 axis, float angle) { float cosine = cos(angle); return direction * cosine + cross(axis, direction) * sin(angle) + axis * dot(axis, direction) * (1.0 - cosine); } vec3 movingPole(vec3 towardViewer, vec3 screenRight) { float cycle = fract(u_time / SECONDS_PER_WOBBLE); float rollProgress = clamp(cycle * 2.0, 0.0, 1.0); float tipProgress = clamp(cycle * 2.0 - 1.0, 0.0, 1.0); float swing = sin(2.0 * PI * rollProgress); float rollAngle = radians(ROLL_DEGREES) * swing * abs(swing); float tip = sin(PI * tipProgress); float tipAngle = radians(TIP_DEGREES) * tip * tip; vec3 upright = vec3(0.0, 1.0, 0.0); vec3 rolledPole = turnAround(upright, towardViewer, rollAngle); return turnAround(rolledPole, screenRight, tipAngle); } float waveAt(vec3 point, vec3 pole) { float distanceFromCentre = length(point); if (distanceFromCentre < 0.0000002) return 0.0; // The 6d radial wave has three zeros. They form the gaps between shells. const float distanceScale = (2.0 * 380.0) / (0.65 * 6.0 * 5.1); float radius = distanceFromCentre * distanceScale; float shellPattern = 56.0 + radius * (-28.0 + radius * (4.0 - radius / 6.0)); float radialWave = radius * radius * exp(-0.5 * radius) * shellPattern; // For m = 0 the poles and the equator have opposite signs. Tighten the // equatorial band while keeping its centre bright and its edges smooth. float heightAlongPole = dot(point, pole) / distanceFromCentre; float lobeShape = 1.0 - 3.0 * heightAlongPole * heightAlongPole; if (lobeShape > 0.0) lobeShape = pow(lobeShape, HORIZONTAL_FALLOFF); float fadeStartsAt = CLOUD_RADIUS * (1.0 - EDGE_FADE); float edgeWeight = 1.0 - smoothstep(fadeStartsAt, CLOUD_RADIUS, distanceFromCentre); return radialWave * (0.5 * lobeShape) * edgeWeight; } vec3 cloudColour(vec3 camera, vec3 ray, vec3 pole) { // Find where this pixel's ray enters and leaves the cloud. vec3 nearestPoint = camera - ray * dot(camera, ray); float depthSquared = CLOUD_RADIUS * CLOUD_RADIUS - dot(nearestPoint, nearestPoint); if (depthSquared <= 0.0) return BACKGROUND; float halfDepth = sqrt(depthSquared); // Convert squared wave amplitude into the density used by the reference. const float inverseLength = 2.0 / (6.0 * 5.1); const float densityScale = 15000000.0 * inverseLength * inverseLength * inverseLength * (6.0 / (12.0 * 40320.0)) * (5.0 / (4.0 * PI)); float totalDensity = 0.0; float totalLight = 0.0; for (int sampleIndex = 0; sampleIndex < MAX_SAMPLES; ++sampleIndex) { float depth = -halfDepth + float(sampleIndex) * SAMPLE_SPACING; if (depth >= halfDepth) break; float wave = waveAt(nearestPoint + depth * ray, pole); float density = wave * wave * densityScale; if (density <= 0.002) continue; float sampleWeight = 0.05 * density; totalDensity += sampleWeight; totalLight += sampleWeight * (wave < 0.0 ? 0.5 : 1.0); if (totalDensity >= 1.0) break; } vec3 glow = 1.0 - exp(-1.6 * AMBER * totalLight); return glow + BACKGROUND * (1.0 - min(totalDensity, 1.0)); } void main() { float yaw = 2.9 + 0.005 * u_time + u_orbit.x; float elevation = clamp(-0.289 + u_orbit.y, -1.47, 1.47); vec3 orbitDirection = vec3(sin(yaw) * cos(elevation), sin(elevation), cos(yaw) * cos(elevation)); vec3 camera = 9.5 * orbitDirection + vec3(-0.425, 2.05, 0.0); vec3 towardViewer = normalize(camera); vec3 screenRight = normalize(cross(vec3(0.0, 1.0, 0.0), towardViewer)); vec3 screenUp = cross(towardViewer, screenRight); vec2 screen = (2.0 * gl_FragCoord.xy - u_resolution) / min(u_resolution.x, u_resolution.y); float viewScale = CLOUD_RADIUS / (0.89 * sqrt(dot(camera, camera) - CLOUD_RADIUS * CLOUD_RADIUS)); vec3 ray = normalize(-towardViewer + viewScale * (screen.x * screenRight + screen.y * screenUp)); vec3 pole = movingPole(towardViewer, screenRight); fragColor = vec4(cloudColour(camera, ray, pole), 1.0); }
Run shader
Download .glsl
View orbital
Enable JavaScript to compile or download the shader.