블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2318)N
Unity3D (567)N
Programming (471)
Unreal (4)
Gamebryo (56)
Tip & Tech (183)
협업 (34)
3DS Max (3)
Game (12)
Utility (116)
Etc (92)
Link (31)
Portfolio (19)
Subject (90)
iOS,OSX (38)
Android (13)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (1)
Memories (19)
Interest (37)
Thinking (36)
한글 (26)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (19)
Exercise (3)
나만의 맛집 (2)
냥이 (9)
육아 (7)
Total1,339,007
Today20
Yesterday214
Statistics Graph

달력

« » 2019.11
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

공지사항

태그목록

출처에 있는 SubShader의 해당 부분만 교체..(실행 확인)



Toony-BasicWithAlpha.shader




1 Shader "Toon/Basic with Alpha" { 2 Properties { 3 _Color ("Main Color", Color) = (.5,.5,.5,1) 4 _MainTex ("Base (RGB)", 2D) = "white" {} 5 _ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { Texgen CubeNormal } 6 } 7 8 9 SubShader { 10 Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} 11 Pass { 12 Name "BASE" 13 Cull Back 14 Blend SrcAlpha OneMinusSrcAlpha 15 16 CGPROGRAM 17 #pragma vertex vert 18 #pragma fragment frag 19 #pragma fragmentoption ARB_precision_hint_fastest 20 21 #include "UnityCG.cginc" 22 23 sampler2D _MainTex; 24 samplerCUBE _ToonShade; 25 float4 _MainTex_ST; 26 float4 _Color; 27 28 struct appdata { 29 float4 vertex : POSITION; 30 float2 texcoord : TEXCOORD0; 31 float3 normal : NORMAL; 32 }; 33 34 struct v2f { 35 float4 pos : POSITION; 36 float2 texcoord : TEXCOORD0; 37 float3 cubenormal : TEXCOORD1; 38 }; 39 40 v2f vert (appdata v) 41 { 42 v2f o; 43 o.pos = mul (UNITY_MATRIX_MVP, v.vertex); 44 o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); 45 o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0)); 46 return o; 47 } 48 49 float4 frag (v2f i) : COLOR 50 { 51 float4 col = _Color * tex2D(_MainTex, i.texcoord); 52 float4 cube = texCUBE(_ToonShade, i.cubenormal); 53 return float4(2.0f * cube.rgb * col.rgb, col.a); 54 } 55 ENDCG 56 } 57 } 58 59 SubShader { 60 Tags { "RenderType"="Opaque" } 61 Pass { 62 Name "BASE" 63 Cull Back 64 SetTexture [_MainTex] { 65 constantColor [_Color] 66 Combine texture * constant 67 } 68 SetTexture [_ToonShade] { 69 combine texture * previous DOUBLE, previous 70 } 71 } 72 } 73 74 Fallback "VertexLit" 75 } 76



출처 : http://forum.unity3d.com/threads/103030-Toon-shader-with-Transparency

'Unity3D > Shader' 카테고리의 다른 글

쉐이더 자료 많은 사이트..  (0) 2014.04.03
Toon/Tf2Shader  (0) 2013.07.19
Toon/Basic with Alpha  (0) 2013.07.19
Toon/Lighted with Alpha  (0) 2013.07.19
toon-water shader  (0) 2012.11.07
스크립트로 Shader 변경  (0) 2012.11.06
Posted by blueasa

댓글을 달아 주세요