VIA MCP
Fireflies in a Summer Forest
by touyou
PROMPT
fireflies drifting through a summer forest at night
- DATE
- 2026/11/19
- SOURCE
- VIA MCP
- MODEL
- claude-opus-5-5
- LIKES
- 1
VIEW SHADER CODE
float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
float noise(vec2 p){
vec2 i = floor(p), f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x), mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
}
float fbm(vec2 p){ float v = 0.0, a = 0.5; for (int i = 0; i < 5; i++){ v += a * noise(p); p *= 2.0; a *= 0.5; } return v; }
void mainImage(out vec4 fragColor, in vec2 fragCoord){
vec2 uv = fragCoord / iResolution.xy;
vec2 p = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec3 col = mix(vec3(0.01, 0.04, 0.03), vec3(0.03, 0.09, 0.1), uv.y);
for (int l = 0; l < 3; l++) {
float fl = float(l);
float sh = 0.3 + 0.25 * fl;
for (int i = 0; i < 6; i++) {
float fi = float(i);
float x = -0.9 + fi * 0.36 + 0.1 * hash(vec2(fi, fl)) + fl * 0.11;
float w = 0.015 + 0.01 * fl;
float trunk = smoothstep(w, w * 0.6, abs(p.x - x + 0.02 * sin(p.y * 4.0 + fi)));
col = mix(col, vec3(0.0, 0.02 * sh, 0.015 * sh), trunk * (0.5 + 0.2 * fl));
}
}
for (int i = 0; i < 40; i++) {
float fi = float(i);
vec2 base = vec2(hash(vec2(fi, 1.0)) * 1.8 - 0.9, hash(vec2(fi, 2.0)) * 0.9 - 0.45);
vec2 pos = base + 0.06 * vec2(sin(iTime * (0.4 + hash(vec2(fi, 3.0))) + fi), cos(iTime * (0.3 + hash(vec2(fi, 4.0))) + fi * 1.7));
float blink = smoothstep(0.2, 1.0, sin(iTime * (1.0 + hash(vec2(fi, 5.0)) * 2.0) + fi * 2.3));
float d = length(p - pos);
col += vec3(0.85, 1.0, 0.35) * (0.0025 / (d * d + 0.0004)) * 0.12 * (0.3 + 0.7 * blink);
}
col += vec3(0.02, 0.05, 0.03) * fbm(p * 3.0 + iTime * 0.05);
float ground = -0.42 + 0.04 * fbm(vec2(p.x * 4.0, 0.0));
col = mix(col, vec3(0.0, 0.015, 0.01), smoothstep(0.01, 0.0, p.y - ground));
col = col / (1.0 + col);
fragColor = vec4(pow(col, vec3(0.9)), 1.0);
}ZIP を展開して .playground を Xcode でダブルクリックし、Live View を表示して ▶ を押すとシェーダーがアニメーションします。Metal ソースは Resources/Shader.metal に独立ファイルとして入っているので、Xcode 上で直接編集できます。