색상출력

void surf (Input IN, inout SurfaceOutputStandard o){ }

SurfaceOutputStandard 라는 구조체를 o.이라고 부르겠다.
마침표는 ' 안에 있는' 같은 의미

input구조체를 IN이란 이름으로 함수 안에 받아들이고,
SurfaceOutputStandard
라는 구조체를 o라는 이름으로
함수안에 받기도 집어 넣기도 하겠다.

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 =float3 (1,0,0)
o.Alpha = c.a;
}

빨간색을 출력

o.Albedo = 'o'
안에 Albedo 변수라는 의미

// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows noambient

// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0

ambient 컬러가 꺼진다.

target 3.0
쉐이더 모델3.0이상에서만 돌아가게 하는 코드
불필요하면 지워도 된다.

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 =float3 (1,0,0)+float3 (0,1,0)
o.Alpha = c.a;
}

노란색으로 출력

+
add 포토샵의 Liner Dodge 같다.
*
Multipy 이다.

 

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

texture  (0) 2020.05.16
CGPROGRAM03  (0) 2020.05.16
CGPROGRAM01  (0) 2020.05.16
Propeties  (0) 2020.05.16
기초  (0) 2020.05.16