LoginSignup
0
0

More than 5 years have passed since last update.

jsdoでshadertoy sandbox その6

Posted at

概要

jsdoでshadertoyのコードを実行したい。
samplerCubeを使いたい。

成果物

写真

ttt.jpg

サンプルコード

precision mediump float;
uniform vec2 iResolution;
uniform float iGlobalTime;
uniform samplerCube iChannel0;

void mainImage(out vec4 f, vec2 w) 
{
    vec4 p = vec4(w, 0, 0) / iResolution.x - .55, d = p, t, c;
    float T = iGlobalTime, C = cos(T), S = sin(T);
    p.z -= T + T;
    for (float i = 2.; i > 0.; i -= .01)
    {
        t = mod(p, 8.) - 4.;
        t.zy *= mat2(C, S, -S, C);
        c = textureCube(iChannel0, t.xyz);
        t = c + length(t.xyz) - 2.7;
        if (t.x < .01) break;
        p -= d * t.x * .2;
        f = c * i;
    }
}
void main() 
{
    vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
    mainImage(color, gl_FragCoord.xy);
    color.w = 1.0;
    gl_FragColor = color;
}   

説明

TEXTURE_CUBE_MAPを実装した。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0