- Rim Light -
Rim Light가 적용된 캐릭터.
Rim Light 쉐이더 코드
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 31 32 33 34 35 36 37 | Shader "Custom/RimLight" { Properties { _MainTex ("Albedo", 2D) = "white" {} _BumpMap("NormalMap", 2D) = "bump" {} _RimColor("RimColor", Color) = (1,1,1,1) _RimPower("RimPower", Range(1, 10)) = 3 } SubShader{ Tags { "RenderType" = "Opanque" } CGPROGRAM #pragma surface surf Lambert sampler2D _MainTex; sampler2D _BumpMap; struct Input { float2 uv_MainTex; float2 uv_BumpMap; float3 viewDir; }; float4 _RimColor; float _RimPower; void surf(Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = c.rgb; o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap)); float rim = saturate(dot(o.Normal, IN.viewDir)); o.Emission = pow(1 - rim, _RimPower) * _RimColor.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" } | cs |
- Hologram -
참고 자료
http://chulin28ho.tistory.com/100
Hologram 쉐이더 코드
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 31 32 33 34 35 36 37 | Shader "Custom/Hologram" { Properties { _MainTex ("Albedo", 2D) = "white" {} _BumpMap("BumpMap", 2D) = "bump" {} _RimColor("RimColor", Color) = (1,1,1,1) } SubShader{ Tags { "RenderType" = "Transparent" "RenderType" = "Qpaque" } CGPROGRAM #pragma surface surf Lambert noambient alpha:fade sampler2D _MainTex; sampler2D _BumpMap; struct Input { float2 uv_MainTex; float2 uv_BumpMap; float3 viewDir; float3 worldPos; }; float4 _RimColor; void surf(Input In, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex, In.uv_MainTex); o.Albedo = c.rgb; o.Normal = UnpackNormal(tex2D(_BumpMap, In.uv_BumpMap)); o.Emission = _RimColor; float rim = saturate(dot(o.Normal, In.viewDir)); rim = pow(1 - rim, 3) + pow(frac(In.worldPos.y * 3 - _Time.y), 30); o.Alpha = rim; } ENDCG } FallBack "Diffuse" } | cs |
반응형
'Programming > Shader' 카테고리의 다른 글
[Unity Shader] 외곽선 Outline, ToonShader (2) | 2015.10.10 |
---|---|
[Unity Shader] Reflection Probe 반사처리 (0) | 2015.10.06 |
[Unity Shader] 실수 및 에러 정리 (0) | 2015.10.01 |
[Unity Shader] Blinn-Phong-Gloss (0) | 2015.09.30 |
[Unity Shader] Parts Color Shader (0) | 2015.09.24 |
[Unity Shader] BumpMap, BlinnPhong (0) | 2015.09.21 |
[Unity Shader] 머테리얼색 반전, 회색, 시간에 따라 색깔 바꾸기 (0) | 2015.09.17 |
[Unity Shader] 쉐이더 문법 (0) | 2015.09.08 |