0504 버텍스에 컬러 입히고 다중 텍스쳐 반영하기
2021. 5. 4. 12:36ㆍunity/쉐이더
Shader "Custom/test"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MainTex2("Albedo (RGB)", 2D) = "white" {}
_MainTex3("Albedo (RGB)", 2D) = "white" {}
_MainTex4("Albedo (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
sampler2D _MainTex;
sampler2D _MainTex2;
sampler2D _MainTex3;
sampler2D _MainTex4;
struct Input
{
float2 uv_MainTex;
float2 uv_MainTex2;
float2 uv_MainTex3;
float2 uv_MainTex4;
float4 color:COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
float4 c = tex2D(_MainTex, IN.uv_MainTex);
float4 d = tex2D(_MainTex2, IN.uv_MainTex);
float4 e = tex2D(_MainTex3, IN.uv_MainTex);
float4 f = tex2D(_MainTex4, IN.uv_MainTex);
o.Emission = lerp(c.rgb, d.rgb, IN.color.r);
o.Emission = lerp(o.Emission, e.rgb, IN.color.g);
o.Emission = lerp(o.Emission, f.rgb, IN.color.b);
}
ENDCG
}
FallBack "Diffuse"
}
Shader "Custom/stone"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MainTex2("Albedo (RGB)", 2D) = "white" {}
_MainTex3("Albedo (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
sampler2D _MainTex;
sampler2D _MainTex2;
sampler2D _MainTex3;
struct Input
{
float2 uv_MainTex;
float2 uv_MainTex2;
float2 uv_MainTex3;
float4 color:COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
fixed4 d = tex2D(_MainTex2, IN.uv_MainTex2);
fixed4 e = tex2D(_MainTex3, IN.uv_MainTex3);
o.Albedo = lerp(c.rgb, d.rgb, IN.color.r);
o.Albedo = lerp(o.Albedo, e.rgb, IN.color.b);
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
'unity > 쉐이더' 카테고리의 다른 글
0504 쉐이더 커스텀 라이트 Lambert, BlinnPhong, Standard (0) | 2021.05.04 |
---|---|
0504 쉐이더 특정 부분만 반짝거리게 하기 (0) | 2021.05.04 |
0503 쉐이더를 이용해서 불 이펙트 만들기 (0) | 2021.05.03 |
0503 쉐이더 UV (0) | 2021.05.03 |
0503 쉐이더 기본 (0) | 2021.05.03 |