게임 그래픽 프로그래밍
셰이더6: 버택스
101won
2024. 9. 4. 00:36
> 엔진에 저장된 Vertex안에 내장되어 있는 값
• 위치(Position)
• UV (Texcoord)
• 컬러(Color)
• 노멀(Normal)
• 탄젠트(Tangent)
> 기본 흰색 float4(1,1,1,1)
float4 color: COLOR; 버택스 칼라다
> 버택스 칼라 출력하기
poly brush 설치
Shader "Custom/vertexcolor"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
float4 color : COLOR; // 버택스 칼라
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = IN.color.rgb; // 버택스 칼라 보기
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}