fix: amplify ambient shader motion for visible animation
Previous shader was too subtle — drift, rotation, and breathing were imperceptible with the smooth 8x8 texture. Now with much larger values: - Drift: 0.05 -> 0.20 max (Lissajous with two frequencies) - Scale breathing: 2% -> 12% range - Rotation: 0.86deg -> 5deg range - Added warm/cool color shifting over time - Stronger vignette pulsing and brightness breathing Safe because the 8x8-sourced texture has zero structure to reveal.
This commit is contained in:
1 file changed
+27
-19
@@ -2,10 +2,9 @@
|
|||||||
/**
|
/**
|
||||||
* Ambient Immersion Shader
|
* Ambient Immersion Shader
|
||||||
*
|
*
|
||||||
* Single-layer approach with slow drift, rotation, and breathing.
|
* Single-layer approach with pronounced drift, rotation, scale breathing,
|
||||||
* Produces smooth organic motion without multi-layer blending artifacts.
|
* and color modulation. No multi-layer blending = no geometric artifacts.
|
||||||
* The pre-blurred texture does all the heavy lifting — the shader just
|
* Safe because the texture is generated at 8x8 and has no structure.
|
||||||
* adds gentle life to it.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
@@ -19,22 +18,25 @@ uniform float u_intensity;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 uv = v_texCoord;
|
vec2 uv = v_texCoord;
|
||||||
float time = u_time * 0.8;
|
float time = u_time;
|
||||||
float intensity = u_intensity;
|
float intensity = u_intensity;
|
||||||
|
vec2 center = vec2(0.5);
|
||||||
|
|
||||||
// Slow organic drift (Lissajous-like path, never repeats quickly)
|
// === DRIFT: Lissajous-like wandering path ===
|
||||||
|
// Multiple frequencies for organic, non-repeating motion
|
||||||
vec2 drift = vec2(
|
vec2 drift = vec2(
|
||||||
sin(time * 0.07) * 0.03 + sin(time * 0.03) * 0.02,
|
sin(time * 0.13) * 0.12 + sin(time * 0.07 + 1.3) * 0.08,
|
||||||
cos(time * 0.05) * 0.025 + cos(time * 0.02) * 0.015
|
cos(time * 0.11) * 0.10 + cos(time * 0.05 + 2.1) * 0.07
|
||||||
) * intensity;
|
) * intensity;
|
||||||
|
|
||||||
// Gentle scale breathing around center
|
// === SCALE: Pronounced breathing (zoom in/out) ===
|
||||||
float scaleBreath = 1.0 + sin(time * 0.09) * 0.02 * intensity;
|
float scaleBreath = 1.0
|
||||||
vec2 center = vec2(0.5);
|
+ sin(time * 0.17) * 0.08 * intensity
|
||||||
|
+ sin(time * 0.09 + 0.7) * 0.04 * intensity;
|
||||||
vec2 scaledUV = center + (uv - center) * scaleBreath;
|
vec2 scaledUV = center + (uv - center) * scaleBreath;
|
||||||
|
|
||||||
// Slow rotation
|
// === ROTATION: Slow but visible swaying ===
|
||||||
float angle = sin(time * 0.04) * 0.015 * intensity;
|
float angle = (sin(time * 0.08) * 0.06 + sin(time * 0.04 + 1.5) * 0.03) * intensity;
|
||||||
vec2 centered = scaledUV - center;
|
vec2 centered = scaledUV - center;
|
||||||
float c = cos(angle);
|
float c = cos(angle);
|
||||||
float s = sin(angle);
|
float s = sin(angle);
|
||||||
@@ -49,21 +51,27 @@ void main() {
|
|||||||
// Sample texture (MIRRORED_REPEAT handles out-of-range UVs)
|
// Sample texture (MIRRORED_REPEAT handles out-of-range UVs)
|
||||||
vec3 color = texture(u_texture, finalUV).rgb;
|
vec3 color = texture(u_texture, finalUV).rgb;
|
||||||
|
|
||||||
|
// === COLOR MODULATION: Warm/cool shifting ===
|
||||||
|
// Slowly shifts hue warmth over time
|
||||||
|
float warmShift = sin(time * 0.06) * 0.08 * intensity;
|
||||||
|
color.r *= 1.0 + warmShift;
|
||||||
|
color.b *= 1.0 - warmShift * 0.6;
|
||||||
|
|
||||||
// Radial distance from center (0 at center, ~1 at corners)
|
// Radial distance from center (0 at center, ~1 at corners)
|
||||||
float radial = length(uv - center) * 1.414;
|
float radial = length(uv - center) * 1.414;
|
||||||
|
|
||||||
// Subtle pulsing vignette
|
// === VIGNETTE: Pulsing edge darkening ===
|
||||||
float vignetteStrength = 0.25 + sin(time * 0.12) * 0.05 * intensity;
|
float vignetteStrength = 0.30 + sin(time * 0.14) * 0.10 * intensity;
|
||||||
float vignette = 1.0 - radial * vignetteStrength;
|
float vignette = 1.0 - radial * vignetteStrength;
|
||||||
color *= vignette;
|
color *= vignette;
|
||||||
|
|
||||||
// Vertical gradient tint (cool top, warm bottom)
|
// Vertical gradient tint (cool top, warm bottom)
|
||||||
vec3 tintTop = vec3(0.96, 0.97, 1.0);
|
vec3 tintTop = vec3(0.95, 0.97, 1.0);
|
||||||
vec3 tintBottom = vec3(1.0, 0.97, 0.94);
|
vec3 tintBottom = vec3(1.0, 0.96, 0.93);
|
||||||
color *= mix(tintBottom, tintTop, uv.y);
|
color *= mix(tintBottom, tintTop, uv.y);
|
||||||
|
|
||||||
// Gentle brightness breathing
|
// === BRIGHTNESS BREATHING: Pronounced pulse ===
|
||||||
float breath = 1.0 + sin(time * 0.15) * 0.06 * intensity;
|
float breath = 1.0 + sin(time * 0.20) * 0.12 * intensity;
|
||||||
color *= breath;
|
color *= breath;
|
||||||
|
|
||||||
fragColor = vec4(color, 1.0);
|
fragColor = vec4(color, 1.0);
|
||||||
|
|||||||
Reference in new issue
Block a user