我的第一個 shadertoy 作品
01-31
公式是之前拼胡亂湊出來的,不管怎麼說,終於入門了啊~
鏈接:Shadertoy
代碼
float RGB(float x, float y, float e)n{n return ( x * tan(x/y) ) * ( y * tan( x/y + iGlobalTime/2.0 * e ) ) / (iMouse.x*20.0+500.0);n}nnvoid mainImage( out vec4 fragColor, in vec2 fragCoord )n{n vec2 coord;n coord = (fragCoord - iResolution.xy/2.0)*5.0;n ntfragColor = vec4(n float(int(RGB(coord.x, coord.y, 0.3)) %255) / 255.0,n float(int(RGB(coord.x, coord.y, 0.6)) %255) / 255.0,n float(int(RGB(coord.x, coord.y, 1.9)) %255) / 255.0,n 1.0);n}n
好像有個大牛評論指導了
FabriceNeyret2, 2017-Jul-7
welcome to the gang !nnnote that you could simply do fract(RGB(coord.x, coord.y, 0.33) / 255.),n(but ok, the rounding in negatives change a little bit.)nnalso, glsl love vectors. you can do directly nvec2 coord = ( fragCoord - iResolution.xy/2.) * 5.;nornvec4 RGB(float x, float y, vec4 e) using parameter e = vec4(.33,.66,.99,0)nnNB: rtx not used
(平台好棒,就是訪問好慢
推薦閱讀: