LoginSignup
0
0

More than 3 years have passed since last update.

[Unity]shaderコード備忘録

Posted at

はじめに

shader書いてて「あーこれいいなー」とか「たまたま出来た」みたいなやつを忘れないようにするために
随時ここに吐き出していこうと思います.(要はちらうら)

fragmentシェーダ系

うねうねスライム

元々は全然違うshaderで円入れたいなーと思って色々やってたらできた副産物(ほんとは円がsin(uv.y)でゆらゆら上昇するのを考えながら作ってた)
output-palette.gif


fixed4 frag (v2f i) : SV_Target
            {
                //球の生成
                float r = 0.1;
                float2 pivot = float2(0.5,0.0);
                pivot.x += 0.2*sin(i.uv.y * 10);
                pivot.y += (fmod(_Time.x*3, 1) / 1);
                float dist = distance(i.uv, pivot);
                float isSphere = step(r,dist);

                fixed4 col = float4(1.0,1.0,1.0,1.0) * isSphere + float4(sin(i.uv.x + 0.3), sin(i.uv.x+ _Time.x *200),sin(i.uv.x + _Time.x *100), 1.0) * (1.0 - isSphere);
                UNITY_APPLY_FOG(i.fogCoord, col);
                return col;
            }

とりあえずこれ一個

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