概要
plunkerでshadertoyのglsl動かしてみた。
TUTORIAL、やってみる。
TUTORIAL 12
DISK
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 r = 2.0 * vec2(fragCoord.xy - 0.5 * iResolution.xy) / iResolution.y;
vec3 bgCol = vec3(0.3);
vec3 col1 = vec3(0.216, 0.471, 0.698);
vec3 col2 = vec3(1.00, 0.329, 0.298);
vec3 col3 = vec3(0.867, 0.910, 0.247);
vec3 pixel = bgCol;
float radius = 0.8;
if (r.x * r.x + r.y * r.y < radius * radius)
{
pixel = col1;
}
if (length(r) < 0.3)
{
pixel = col3;
}
vec2 center = vec2(0.9, -0.4);
vec2 d = r - center;
if (length(d) < 0.6)
{
pixel = col2;
}
fragColor = vec4(pixel, 1.0);
}
写真
成果物
以上。
