1. Vertex Shader를 이용한 오브젝트 확장하기
Shader "Custom/2Pass"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_ShadowTex ("Shader Texture", Range(0, 0.01)) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" }
Cull Front
//1Pass
CGPROGRAM
#pragma surface surf _NoLight vertex:vert noshadow
#pragma target 3.0
sampler2D _MainTex;
float _ShadowTex;
// vertex:vert 에 대한 함수 따로 추가
void vert (inout appdata_full v)
{
// 외각선 굵기 조절 normal로 전체 크기를 조절 가능
// 즉 normal * 길이 를 vertex.xyz축 전체만큼 더한다.
v.vertex.xyz = v.vertex.xyz + (v.normal.xyz * _ShadowTex);
}
struct Input
{
float2 uv_MainTex;
//float4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutput o)
{
// fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
// o.Emission = c.rgb + abs(sin(_Time.y));
// o.Alpha = c.a;
}
float4 Lighting_NoLight(SurfaceOutput s, float3 lightDir,float atten)
{
return 0;
}
ENDCG
Cull Back
//2Pass
CGPROGRAM
#pragma surface surf Lambert
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
'[학원 Unity] > [게임 그래픽 프로그래밍]' 카테고리의 다른 글
그래픽스) 시험 내용 정리 (0) | 2024.09.09 |
---|---|
09-04 수업내용 ) SurfaceOutputStandard (0) | 2024.09.04 |
09-03 ) 버텍스 컬러 (0) | 2024.09.03 |
09-03 수업내용 ) UV 이미지 이용해보기 (0) | 2024.09.03 |
09-02 두번째 수업내용 (0) | 2024.09.02 |