AI GENERATED
綺麗な海
by touyou
PROMPT
海の香り
- DATE
- 2026/6/25
- SOURCE
- AI GENERATED
- MODEL
- gemini-2.5-flash
- LIKES
- 2
VIEW SHADER CODE
float hash12(vec2 p) {
vec3 p3 = fract(p.xyx * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
float a = hash12(i);
float b = hash12(i + vec2(1.0, 0.0));
float c = hash12(i + vec2(0.0, 1.0));
float d = hash12(i + vec2(1.0, 1.0));
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
}
float fbm(vec2 p) {
float f = 0.0;
p *= 1.5;
float amp = 0.5;
for (int i = 0; i < 5; i++) {
f += amp * noise(p);
p *= 2.0;
amp *= 0.5;
}
return f;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
float time = iTime * 0.15;
// Domain warping to create organic, swirling patterns reminiscent of water currents
vec2 q = vec2(fbm(uv * 1.0 + time * 0.5), fbm(uv * 1.0 + time * 0.5 + vec2(5.2, 1.3)));
q = q * 2.0 - 1.0;
vec2 r = vec2(fbm(uv * 1.0 + q * 1.5 - time * 0.3), fbm(uv * 1.0 + q * 1.5 - time * 0.3 + vec2(7.3, 2.1)));
r = r * 2.0 - 1.0;
// Final noise value, influenced by both layers of warping, creating the main flow
float f = fbm(uv * 1.5 + r * 1.0 + time * 0.2);
// Add another layer of noise for finer details, like light caustics or subtle surface variations
float surfaceDetail = fbm(uv * 4.0 + f * 2.0 + time * 0.4);
// Combine noise values, enhance contrast and brightness for more defined "light" areas
float finalNoise = f + surfaceDetail * 0.5;
finalNoise = pow(finalNoise, 1.5);
// Color palette: a gradient from deep sea blues to lighter aquas and hints of foamy white
vec3 col = vec3(0.0);
// Darker base for deep water
col = mix(vec3(0.05, 0.15, 0.25), vec3(0.1, 0.35, 0.5), smoothstep(0.0, 0.6, finalNoise));
// Mid-tones for clearer water
col = mix(col, vec3(0.2, 0.6, 0.8), smoothstep(0.3, 0.8, finalNoise));
// Highlights for surface foam or strong light penetration
col = mix(col, vec3(0.8, 0.95, 1.0), smoothstep(0.7, 1.0, finalNoise));
// Apply a subtle blue-green tint to enhance the "sea" feel
col *= vec3(0.95, 1.05, 1.1);
// Add a soft, subtle vignette to focus the view
float len_uv = length(uv);
float vignette = smoothstep(1.1, 0.6, len_uv);
col *= vignette;
fragColor = vec4(col, 1.0);
}ZIP を展開して .playground を Xcode でダブルクリックし、Live View を表示して ▶ を押すとシェーダーがアニメーションします。Metal ソースは Resources/Shader.metal に独立ファイルとして入っているので、Xcode 上で直接編集できます。