대충 프래그먼트 구조...
알파값 value와 intensity value를 넣어둔 정도. Blend mode 선정은 몇가지를 지정하던 파라메터 전부 호출하던 그건 상황에 맞춰서~
Properties {
_MainTex ("Base Texture", 2D) = "white" {}
_TintColor ("Emission Color", Color) = (1, 1, 1, 1)
_Emissive ("Emissive Intensity", Range(0,3)) = 1
_Transparent ("Transparent Value", Range(0, 1)) = 1
// Blend mode values
[Enum(UnityEngine.Rendering.BlendMode)] _Blend ("Blend mode", Float) = 1
// Blend mode value subtracks
[Enum(UnityEngine.Rendering.BlendMode)] _Blend2 ("Blend mode subset", Float) = 1
// A subset of blend mode values, just "One" (value 1) and "SrcAlpha" (value 5)
// 필요한 것들만 넣어 제한적 blend mode만을 지원할때는 이쪽이 나을듯
[Enum(One,1,SrcAlpha,5)] _Blend2 ("Blend mode subset", Float) = 1 // Culling mode
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull mode", Float) = 2
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend [_Blend] [_Blend2]
Lighting Off
ZWrite Off
Cull [_Cull]
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
fixed4 _TintColor;
fixed _Transparent, _Emissive;
sampler2D _MainTex;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 c = i.color * _TintColor * tex2D(_MainTex, i.texcoord) + _Emissive ;
fixed a = _Transparent;
return fixed4(c.rgb, a);
}
ENDCG
}
}
}
}
'Technical Report > Unity Shader' 카테고리의 다른 글
UE4 25 tips for Unreal Engine 4(1) (2) | 2016.07.09 |
---|---|
Unity GLSL base shader (0) | 2016.06.03 |
Unity Alpha Blend Mode Toggle (0) | 2016.05.23 |
Unity3D WorldReflectionVector function (0) | 2016.05.10 |
Shader #pragma 파라메터 역할 (0) | 2016.04.01 |