'Unity/쉐이더'에 해당하는 글 1건

R, G, B의 평균값(float)를 Albedo(또는 Emission)에 할당하면 됨.


RGB to YIQ 변환방식

GrayScale = 0.2989 * R + 0.5870 * G + 0.1140 * B



void surf (Input IN, inout SurfaceOutputStandard o) {

fixed4 c = tex2D (_MainTex, IN.uv_MainTex);

fixed4 d = tex2D (_MainTex2, IN.uv_MainTex2);

// float temp = (c.r + c.g + c.b)/3;

// float3 grey = float3 (temp, temp, temp);

// float3 grey = 0.2989 * c.r + 0.5870 * c.g + 0.1140 * c.b;

// float3 grey = (c.r + c.g + c.b)/3;


o.Albedo = grey;

o.Alpha = c.a;

}


WRITTEN BY
빨강꼬마

,