Advertisement
dnnkeeper

TestSurfaceDecalBlendOneOne

Jan 24th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. Shader "Custom/TestSurfaceDecalBlend" {
  2. Properties {
  3. _Color("Main Color", Color) = (1,1,1,1)
  4. _MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
  5. _BumpMap("Normalmap", 2D) = "bump" {}
  6. _BumpScale("Normalmap strength", Range(0.0, 10.0)) = 1.0
  7. _SpecGlossMap("Specular", 2D) = "black" {}
  8. //_SpecColor("SpecColor", Color) = (1,1,1,1)
  9. _Specular("Specular", Range(0.0, 1.0)) = 1.0
  10. _Gloss("Gloss", Range(0.0, 1.0)) = 1.0
  11. }
  12. SubShader {
  13. Tags { "RenderType" = "Opaque" "Queue" = "Geometry+1" "ForceNoShadowCasting" = "True" }
  14. LOD 200
  15. //Offset -1, -1
  16.  
  17. //Blend SrcAlpha OneMinusSrcAlpha
  18. //Blend One One
  19. //Blend SrcColor OneMinusSrcColor
  20. //Blend SrcColor One
  21.  
  22. GrabPass{ "_SharedGrabTexture" }
  23.  
  24. CGPROGRAM
  25. // Physically based Standard lighting model, and enable shadows on all light types
  26. #pragma surface surf StandardSpecular vertex:vert decal:add //alpha:blend
  27.  
  28. // Use shader model 3.0 target, to get nicer looking lighting
  29. #pragma target 3.0
  30.  
  31. //sampler2D _SharedGrabTexture;
  32.  
  33. sampler2D _MainTex;
  34.  
  35. sampler2D _BumpMap;
  36.  
  37. sampler2D _SpecGlossMap;
  38.  
  39. float _Specular, _Gloss, _BumpScale;
  40.  
  41. fixed4 _Color;
  42.  
  43. struct Input {
  44. float2 uv_MainTex;
  45. float2 uv_BumpMap;
  46. float4 grabUV;
  47. float4 color: Color;
  48. };
  49.  
  50. void vert(inout appdata_full v, out Input o) {
  51. float4 hpos = mul(UNITY_MATRIX_MVP, v.vertex);
  52. o.uv_MainTex = v.texcoord;
  53. o.uv_BumpMap = v.texcoord1;
  54. o.grabUV = ComputeGrabScreenPos(hpos);
  55. o.color = v.color;
  56. }
  57.  
  58. void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
  59. //fixed4 grab = tex2Dproj(_SharedGrabTexture, UNITY_PROJ_COORD(IN.grabUV)) * _Color;
  60. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color * _Color;
  61. o.Albedo = c.rgb * c.a;
  62. o.Alpha = c.a;
  63. o.Normal = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_BumpMap), _BumpScale);
  64. half4 specGloss = tex2D(_SpecGlossMap, IN.uv_MainTex);
  65.  
  66. o.Specular = specGloss.rgb * c.a * _Specular;
  67. o.Smoothness = specGloss.a * _Gloss;
  68. //clip((c.a-0.5)*2);
  69.  
  70. }
  71. ENDCG
  72. }
  73. FallBack "Decal/Transparent Diffuse"
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement