반응형
0. color.b 에만 추가할것 이다.
1.저 부분만 젖은 느낌으로 러프니스를 높여줄꺼다.
o.Smoothness = (IN.color.b * 0.5) * _Smoothness;
b로 평균값을 구하는 공식
0.5는 오프셋 값.
o.Smoothness = (IN.color.b * 0.5) * _Smoothness + 0.5;
Shader "Custom/Test"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MainTex2 ("Albedo (RGB)", 2D) = "white" {}
_MainTex3 ("Albedo (RGB)", 2D) = "white" {}
_MainTex4 ("Albedo (RGB)", 2D) = "white" {}
_Normal ("Normal", 2D) = "white" {}
_Metallic ("Metallic", Range(0,1)) = 0
_Smoothness ("Smoothness", Range(0,1)) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _MainTex;
sampler2D _MainTex2;
sampler2D _MainTex3;
sampler2D _MainTex4;
sampler2D _Normal;
float _Metallic;
float _Smoothness;
struct Input
{
float2 uv_MainTex;
float2 uv_MainTex2;
float2 uv_MainTex3;
float2 uv_MainTex4;
float2 uv_Normal;
float4 color:COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
fixed4 d = tex2D (_MainTex2, IN.uv_MainTex2);
fixed4 e = tex2D (_MainTex3, IN.uv_MainTex3);
fixed4 f = tex2D (_MainTex4, IN.uv_MainTex4);
fixed3 n = UnpackNormal(tex2D (_Normal, IN.uv_Normal));
o.Albedo = lerp(c.rgb, d.rgb, IN.color.r);
o.Albedo = lerp(o.Albedo, e.rgb, IN.color.g);
o.Albedo = lerp(o.Albedo, f.rgb, IN.color.b);;
o.Normal = n;
o.Alpha = c.a;
o.Metallic = 0;
o.Smoothness = (IN.color.b * 0.5) * _Smoothness + 0.5;
}
ENDCG
}
FallBack "Diffuse"
}
반응형
'Unity > 그래픽스프로그래밍' 카테고리의 다른 글
0504 _ 라이트에 따른 쉐이더 // 노멀 및 여러맵 넣었을 때 차이점 (0) | 2021.05.04 |
---|---|
0504_ 버텍스컬러 찍은 부분만 텍스쳐링 나오게하기 (0) | 2021.05.04 |
0504_그래픽스 Metallic, Smoothness (0) | 2021.05.04 |
0504_ 그래픽스 폴리브러쉬 사용해서 돌에 이끼 및 텍스쳐 그려보기 (0) | 2021.05.04 |
0504 _ 그래픽스, 버텍스 색 바꾸기 (0) | 2021.05.04 |