[URP] Fire Shader Graph

Unity3D/Shader 2021. 10. 26. 01:41
반응형

Surface Shader 

Shader "ShaderStudy/Part06/Fire"
{
    Properties
    {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _MainTex2 ("Albedo (RGB)", 2D) = "black" {}
    }
    SubShader
    {
        Tags { "RenderType"="Transparent" "Queue"="Transparent"}
        LOD 200

        CGPROGRAM
        #pragma surface surf Standard alpha:fade

        sampler2D _MainTex;
        sampler2D _MainTex2;

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_MainTex2;
        };

        void surf (Input IN, inout SurfaceOutputStandard o)
        {
            fixed4 d = tex2D (_MainTex2, float2(IN.uv_MainTex2.x, IN.uv_MainTex2.y - _Time.y));
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex + d.r- 0.1);
            o.Emission = c.rgb-0.1;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

 

 

Shader Graph 

 

 

참고 

https://chulin28ho.tistory.com/671

https://docs.unity3d.com/Packages/com.unity.shadergraph@10.2/manual/Sample-Texture-2D-Node.html

https://developer.download.nvidia.com/cg/tex2D.html

https://www.youtube.com/watch?v=FIvovRrxGUQ 

https://darkcatgame.tistory.com/9

https://github.com/jwawon/UnityShaderStartupStudy/blob/master/Assets/Shaders/Part06/Fire.shader

 

반응형
: