Shader/Shader - SurfaceShader

18-6 외곡

소나무꼴 2020. 4. 23. 00:16
Shader "Custom/18-6"
{
	Properties
	{
		_MainTex("Texture", 2D) = "white" {}
		_strength("Strength", Range(0, 0.1)) = 0.05
	}
		SubShader
	{
		Tags { "RenderType" = "Opaque" "Queue" = "Transparent"}
		zwrite off
		GrabPass{}
		CGPROGRAM
		#pragma surface surf NoLight noambient

		sampler2D _MainTex;
		sampler2D _GrabTexture;
		float _strength;
		
		struct Input
		{
			float4 color:COLOR;
			float4 screenPos;
			float2 uv_MainTex;
		};
		void surf(Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
			float3 screenUV = IN.screenPos.rgb / IN.screenPos.a;
			o.Emission = tex2D(_GrabTexture, screenUV.xy + c.x * _strength);
		}		
		float4 LightingNoLight(SurfaceOutput s, float3 lightDir, float3 viewDir, float atten)
		{
			return float4(0, 0, 0, 1);
		}
		
		ENDCG
	}
	FallBack "Diffuse"
}

'Shader > Shader - SurfaceShader' 카테고리의 다른 글

18-8 물 버텍스 이동  (0) 2020.04.30
18-7 물흐르기(스펙큘러, 림라이트)  (0) 2020.04.30
18-4 풀흔들기  (0) 2020.04.22
18-3타들어가는  (0) 2020.04.15
18-2  (0) 2020.04.15