☰
✎ Starfield Warp
bearbeiten
Bereit
Vertex Shader
Kopieren
attribute vec2 a_position; void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
Fragment Shader
Kopieren
precision mediump float; uniform float u_time; uniform vec2 u_resolution; uniform vec2 u_mouseNorm; uniform float u_zoom; float hash(float n) { return fract(sin(n) * 43758.5453123); } float noise(vec2 x) { vec2 p = floor(x); vec2 f = fract(x); f = f * f * (3.0 - 2.0 * f); float n = p.x + p.y * 57.0; return mix(mix(hash(n), hash(n + 1.0), f.x), mix(hash(n + 57.0), hash(n + 58.0), f.x), f.y); } void main() { vec2 uv = (gl_FragCoord.xy - 0.5 * u_resolution.xy) / u_resolution.y; float t = u_time * 0.5 * u_zoom; vec3 col = vec3(0.0); float mouseInfluence = length(uv - (u_mouseNorm - 0.5) * vec2(u_resolution.x/u_resolution.y, 1.0)); for (float i = 0.0; i < 3.0; i++) { float fi = i + 1.0; vec2 p = uv * fi * 3.0; float a = atan(p.y, p.x); float r = length(p); float warp = t * fi * 0.5; float stars = noise(vec2(a * 10.0 + warp, r * 2.0 - warp * 2.0)); stars = pow(stars, 8.0) * smoothstep(5.0, 0.0, r); vec3 starCol = vec3(0.8, 0.9, 1.0) * stars; if (i == 1.0) starCol = vec3(1.0, 0.8, 0.6) * stars; if (i == 2.0) starCol = vec3(0.6, 0.8, 1.0) * stars; col += starCol / fi; } col += vec3(0.05, 0.02, 0.1) / (length(uv) + 0.3); col += smoothstep(0.3, 0.0, mouseInfluence) * vec3(0.2, 0.4, 1.0) * 0.3; gl_FragColor = vec4(col, 1.0); }
💾 Speichern
⬇ Export JSON
← Zurück
Live-Vorschau
FPS: --
↻ Neu laden
⏸ Pause