변수

void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color

float4 test = float4(1,0,0,1)

fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = test;

o.Alpha = c.a;
}

빨란색이 출력

o.Albedo = test.rgb;
라고 써야 맞다. 이유는 rgb 사용하기 때문이다.

rgb
앞에 마침표는 내부에 들어갈 값이다.

.rgb
라고 쓰면 float3으로 변경되는것이다.

float4 test = float4(1,0,0,1)
위치가 위어야 정상으로 출력이된다.

void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color

float K = 1;
float G = float2(0.5,0);
float BB = float3(1,0,1);

fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = float3(K,G,BB)

o.Alpha = c.a;
}

핑크 컬러 출력

o.Albedo = float3(0.2,G,1)
이런식으로 숫자를 넣어도 된다.

 

'Unity > Surface Shader' 카테고리의 다른 글

Vertex color  (0) 2020.05.17
texture  (0) 2020.05.16
CGPROGRAM02  (0) 2020.05.16
CGPROGRAM01  (0) 2020.05.16
Propeties  (0) 2020.05.16