Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/TestSurfaceDecalBlend" {
- Properties {
- _Color("Main Color", Color) = (1,1,1,1)
- _MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
- _BumpMap("Normalmap", 2D) = "bump" {}
- _BumpScale("Normalmap strength", Range(0.0, 10.0)) = 1.0
- _SpecGlossMap("Specular", 2D) = "black" {}
- //_SpecColor("SpecColor", Color) = (1,1,1,1)
- _Specular("Specular", Range(0.0, 1.0)) = 1.0
- _Gloss("Gloss", Range(0.0, 1.0)) = 1.0
- }
- SubShader {
- Tags { "RenderType" = "Opaque" "Queue" = "Geometry+1" "ForceNoShadowCasting" = "True" }
- LOD 200
- //Offset -1, -1
- //Blend SrcAlpha OneMinusSrcAlpha
- //Blend One One
- //Blend SrcColor OneMinusSrcColor
- //Blend SrcColor One
- GrabPass{ "_SharedGrabTexture" }
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf StandardSpecular vertex:vert decal:add //alpha:blend
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 3.0
- //sampler2D _SharedGrabTexture;
- sampler2D _MainTex;
- sampler2D _BumpMap;
- sampler2D _SpecGlossMap;
- float _Specular, _Gloss, _BumpScale;
- fixed4 _Color;
- struct Input {
- float2 uv_MainTex;
- float2 uv_BumpMap;
- float4 grabUV;
- float4 color: Color;
- };
- void vert(inout appdata_full v, out Input o) {
- float4 hpos = mul(UNITY_MATRIX_MVP, v.vertex);
- o.uv_MainTex = v.texcoord;
- o.uv_BumpMap = v.texcoord1;
- o.grabUV = ComputeGrabScreenPos(hpos);
- o.color = v.color;
- }
- void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
- //fixed4 grab = tex2Dproj(_SharedGrabTexture, UNITY_PROJ_COORD(IN.grabUV)) * _Color;
- fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color * _Color;
- o.Albedo = c.rgb * c.a;
- o.Alpha = c.a;
- o.Normal = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_BumpMap), _BumpScale);
- half4 specGloss = tex2D(_SpecGlossMap, IN.uv_MainTex);
- o.Specular = specGloss.rgb * c.a * _Specular;
- o.Smoothness = specGloss.a * _Gloss;
- //clip((c.a-0.5)*2);
- }
- ENDCG
- }
- FallBack "Decal/Transparent Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement