generated from AfonsoCMSousa/CPP-Template
Fixed and added some minor color correction
This commit is contained in:
+7
-23
@@ -76,25 +76,6 @@ vec2 morphingSeed(float t, float interval) {
|
||||
return mix(seedA, seedB, blend);
|
||||
}
|
||||
|
||||
vec2 morphingDirection(float t, float interval) {
|
||||
float phase = floor(t / interval);
|
||||
float blend = fract(t / interval);
|
||||
|
||||
// Generate 2 pseudo-random direction vectors
|
||||
vec2 dirA = normalize(vec2(
|
||||
sin(phase * 12.9898),
|
||||
cos(phase * 78.233)
|
||||
));
|
||||
vec2 dirB = normalize(vec2(
|
||||
sin((phase+1.0) * 93.9898),
|
||||
cos((phase+1.0) * 47.233)
|
||||
));
|
||||
|
||||
// Smooth interpolation between them
|
||||
blend = smoothstep(0.0, 1.0, blend);
|
||||
return normalize(mix(dirA, dirB, blend));
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy / u_resolution.xy; // Normalize coordinates
|
||||
st.x *= u_resolution.x / u_resolution.y; // Correct aspect ratio
|
||||
@@ -104,7 +85,8 @@ void main() {
|
||||
st *= 2.05 * u_scale; // Zoom out
|
||||
vec2 seed = morphingSeed(u_time, 10.0); // 10 second interval
|
||||
|
||||
vec2 pos = st + morphingDirection(u_time * 0.2, 15.0); // 15 second interval
|
||||
vec2 pos = st; // 15 second interval
|
||||
pos += vec2(0.3, 0.1) * u_time * 0.1;
|
||||
|
||||
float pre_noise = perlinNoise((pos) * 1.5); // N = [0..1]
|
||||
// noise += 0.6 * perlinNoise(pos * 4.0);
|
||||
@@ -120,9 +102,9 @@ void main() {
|
||||
|
||||
vec3 color;
|
||||
|
||||
if (noise >= 0.9) {
|
||||
if (noise >= 0.85) {
|
||||
color = getPaletteColor(u_time * 0.1, noise);
|
||||
} else if (noise >= 0.76 ) {
|
||||
} else if (noise >= 0.75 ) {
|
||||
color = getPaletteColor((u_time * 0.1) + 1.0, noise);
|
||||
|
||||
// Estimate gradient (2D normal)
|
||||
@@ -145,7 +127,7 @@ void main() {
|
||||
float spec = pow(max(dot(normal, lightDir), 0.0), 32.0);
|
||||
|
||||
// Combine Fresnel + spec
|
||||
float gloss = fresnel + 0.5 * spec;
|
||||
float gloss = fresnel + 0.6 * spec;
|
||||
|
||||
// Stronger at edges (transition zone of blob)
|
||||
float edge = smoothstep(0.8, 0.9, noise) * (1.0 - smoothstep(0.9, 1.0, noise));
|
||||
@@ -157,5 +139,7 @@ void main() {
|
||||
color = vec3(0.0);
|
||||
}
|
||||
|
||||
// Denoise edges -> "Insane look-alike effect"
|
||||
color += mix(color, vec3(0.0), smoothstep(0.0, 0.02, abs(noise - 0.9)));
|
||||
FragColor = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user