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

카테고리

분류 전체보기 (2794)
Unity3D (852)
Programming (478)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (11)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
  1. //Somehow achieves an effect similar to this:
  2. //#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
  3. Shader "Photoshop/Overlay"
  4. {
  5. Properties
  6. {
  7. _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  12. ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend DstColor SrcColor
  13. LOD 110
  14. Pass
  15. {
  16. CGPROGRAM
  17. #pragma vertex vert_vct
  18. #pragma fragment frag_mult
  19. #pragma fragmentoption ARB_precision_hint_fastest
  20. #include "UnityCG.cginc"
  21. sampler2D _MainTex;
  22. float4 _MainTex_ST;
  23. struct vin_vct
  24. {
  25. float4 vertex : POSITION;
  26. float4 color : COLOR;
  27. float2 texcoord : TEXCOORD0;
  28. };
  29. struct v2f_vct
  30. {
  31. float4 vertex : POSITION;
  32. fixed4 color : COLOR;
  33. half2 texcoord : TEXCOORD0;
  34. };
  35. v2f_vct vert_vct(vin_vct v)
  36. {
  37. v2f_vct o;
  38. o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
  39. o.color = v.color;
  40. o.texcoord = v.texcoord;
  41. return o;
  42. }
  43. float4 frag_mult(v2f_vct i) : COLOR
  44. {
  45. float4 tex = tex2D(_MainTex, i.texcoord);
  46. float4 final;
  47. final.rgb = i.color.rgb * tex.rgb * 2;
  48. final.a = i.color.a * tex.a;
  49. return lerp(float4(0.5f,0.5f,0.5f,0.5f), final, final.a);
  50. }
  51. ENDCG
  52. }
  53. }
  54. }




출처 : http://answers.unity3d.com/questions/384550/shader-photoshop-overlay-effect.html

반응형
Posted by blueasa
, |