흑백이미지
|
void surf (Input IN, inout SurfaceOutputStandard o) { // Albedo comes from a texture tinted by color fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; o.Albedo =(c.r+c.g+c.g)/3; o.Alpha = c.a; }
|
|
|
|
|
|
|
UV 밀기
|
void surf (Input IN, inout SurfaceOutputStandard o) { // Albedo comes from a texture tinted by color fixed4 c = tex2D (_MainTex, IN.uv_MainTex+0.5); o.Albedo = c.rgb; o.Alpha = c.a; }
|
|
|
|
|
|
|
lerp함수
|
_MainTex ("텍스쳐1", 2D) = "white { } _MainTex2 ("텍스쳐2", 2D) = "white { }
|
Properties
|
lerp(X,Y,s) X,Y는 반드시 float, float1,float2,float3,float4형태 s는 float 한자리수로 0~1이다.
|
|
sampler2D _MainTex; sampler2D _MainTex2;
|
|
|
|
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 (_MainTex, IN.uv_MainTex2); o.Albedo =lerp(c.rgb, d.rgb, 0.5); o.Alpha = c.a; }
|
2개의 텍스쳐를 혼합 선형 보간(그라데이션)
lerp(X, Y, s) s는 float(숫자)이어야 합니다.
0.5로 인하여 이미지가 반반씩 섞이게 됩니다.
|
|
|
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 (_MainTex, IN.uv_MainTex2); o.Albedo =lerp(c.rgb, d.rgb, c.a); o.Alpha = c.a; }
|
알패 채널을 이용하여 두가지의 텍스쳐를 나오게 하는 방법.
o.Albedo =lerp(c.rgb, d.rgb, 1-c.a) 하면 반대로 뒤집힌다. 위엣것이랑 같은게 된다.o.Albedo =lerp(d.rgb, c.rgb, c.a)
|
|
|
|
|
|
lerp함수 비슷한거
|
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 (_MainTex, IN.uv_MainTex2); o.Albedo = c.rgb * d.rgb; o.Alpha = c.a; }
|
*으로 곱해줌.
o.Albedo = c.rgb * (d.rgb+_lerptest); 위에 프로버티를 그대로 적용하면 컬러가 섞인다.
|
|