☰
✎ Ripple Displacement
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 vec4 u_mouseClick; void main() { vec2 uv = gl_FragCoord.xy / u_resolution.xy; float t = u_time; vec2 p = uv * 10.0; float wave = sin(p.x + t) * sin(p.y + t * 0.7); wave += sin(p.x * 2.0 - t * 1.3) * sin(p.y * 2.0 + t) * 0.5; wave += sin(p.x * 0.5 + t * 0.5) * sin(p.y * 0.5 - t * 0.3) * 0.3; float ripple = 0.0; if (u_mouseClick.z > 0.5) { float d = length(uv - u_mouseNorm); ripple = sin(d * 30.0 - t * 5.0) * exp(-d * 3.0) * 0.5; } float h = wave + ripple; vec3 deep = vec3(0.0, 0.15, 0.25); vec3 surf = vec3(0.0, 0.4, 0.5); vec3 foam = vec3(0.7, 0.9, 1.0); vec3 col = mix(deep, surf, smoothstep(-1.0, 1.0, h)); col = mix(col, foam, smoothstep(0.8, 1.2, h)); float spec = pow(max(sin(p.x * 0.5 + t) * sin(p.y * 0.5 + t * 0.7), 0.0), 8.0); col += vec3(1.0, 0.95, 0.9) * spec * 0.3; gl_FragColor = vec4(col, 1.0); }
💾 Speichern
⬇ Export JSON
← Zurück
Live-Vorschau
FPS: --
↻ Neu laden
⏸ Pause