본문으로 바로가기

GLSL WrapCore

category Technical Report/Graphics Tech Reports 2017. 10. 16. 16:29
반응형



  // deform technique from iq: https://www.shadertoy.com/view/Xdf3Rn


void mainImage( out vec4 fragColor, in vec2 fragCoord )

{

    float time = iTime * 1.;    // adjust time
    vec2 p = (-iResolution.xy + 2.0*fragCoord)/iResolution.x;    // center coordinates
       
 
    float r2 = dot(p,p);
    float r = sqrt(r2);
    vec2 uv = p/r2;   

    // animate   
    uv += 10.0 * cos( vec2(0.6,0.3) + vec2(0.1,0.13) * 2. * sin(time) );
    // uv = p; // switch back to normal coords to test drawing
    ////////////////////////////////////
   

    // custom drawing
    uv += vec2(0., 2. * cos(uv.y * 8.));    // warp coordinates a little more
    uv = abs(sin(uv * 0.3));        // draw horizontal stripes
    float color = smoothstep(0.2, 0.8, abs(sin(time + uv.y * 3.)));
    color = min(color, smoothstep(0.1, 0.95, abs(sin(time + uv.y * 4.))) );
    color += 0.75; 

            

                                               
   // brighten everything
    vec3 col = vec3(  

                                                       
    // oscillate color components
    0.6 + 0.1 * cos(time + color * 1.),
    0.5 * color,
    0.9 + 0.2 * sin(time + color * 1.1)
    );
   

     // reverse vignette
    col *= r*1.5 * color;
    col += pow(length(p)/2., 2.);
    fragColor = vec4( col, 1.0 );

}

반응형

'Technical Report > Graphics Tech Reports' 카테고리의 다른 글

FBX exoprt Animation options  (0) 2018.05.09
ASTC Format (2)  (0) 2018.03.22
Unity 2017.1.1 Relese Note  (0) 2017.09.12
Unity Asset review Fog volume 3  (0) 2017.08.30
Cg에서 Uber Shader 구성  (0) 2017.08.18