카테고리 없음

간단한 Lerp 함수 테스트

소나무꼴 2020. 2. 28. 13:07

Shader "Custom/NewSurfaceShader1" {
	Properties {
		_Color ("Color", Color) = (1,1,1,1)
		_MainTex ("Albedo (RGB)", 2D) = "white" {}
		_MainTex2("SubTex", 2D) = "whilt"{}
		_lerp("Lerp", Range(0, 1)) = 1
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
		
		CGPROGRAM
		#pragma surface surf Standard

		sampler2D _MainTex;
		sampler2D _MainTex2;
		sampler2D _2d;

		struct Input {
			float2 uv_MainTex;
			float2 uv_MainTex2;
			float4 color : COLOR;
		};

		half _Glossiness;
		half _Metallic;
		fixed4 _Color;
		float _lerp;

		UNITY_INSTANCING_BUFFER_START(Props)
		UNITY_INSTANCING_BUFFER_END(Props)

		void surf (Input IN, inout SurfaceOutputStandard o) {
			fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;			
			fixed4 c1 = tex2D(_MainTex2, IN.uv_MainTex2) * _Color;
			o.Albedo = lerp(c.rgb, c1.rgb, _lerp);
			o.Alpha = c.a;
		}
		ENDCG
	}
	FallBack "Diffuse"
}