|
1 |
| -Shader "Mapbox/MapboxStyles" { |
2 |
| - Properties |
3 |
| - { |
4 |
| - _BaseColor ("BaseColor", Color) = (1,1,1,1) |
5 |
| - _DetailColor1 ("DetailColor1", Color) = (1,1,1,1) |
6 |
| - _DetailColor2 ("DetailColor2", Color) = (1,1,1,1) |
| 1 | +// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax. |
| 2 | + |
| 3 | +Shader "Mapbox/MapboxStyles" |
| 4 | +{ |
| 5 | + Properties |
| 6 | + { |
| 7 | + _BaseColor ("BaseColor", Color) = (1,1,1,1) |
| 8 | + _DetailColor1 ("DetailColor1", Color) = (1,1,1,1) |
| 9 | + _DetailColor2 ("DetailColor2", Color) = (1,1,1,1) |
7 | 10 |
|
8 | 11 | _BaseTex ("Base", 2D) = "white" {}
|
9 |
| - _DetailTex1 ("Detail_1", 2D) = "white" {} |
10 |
| - _DetailTex2 ("Detail_2", 2D) = "white" {} |
| 12 | + _DetailTex1 ("Detail_1", 2D) = "white" {} |
| 13 | + _DetailTex2 ("Detail_2", 2D) = "white" {} |
11 | 14 |
|
12 |
| - _Emission ("Emission", Range(0.0, 1.0)) = 0.1 |
| 15 | + _Emission ("Emission", Range(0.0, 1.0)) = 0.1 |
13 | 16 | }
|
14 |
| - SubShader |
15 |
| - { |
| 17 | + SubShader |
| 18 | + { |
16 | 19 | Tags { "RenderType"="Opaque" }
|
17 | 20 | LOD 200
|
18 |
| - |
| 21 | + |
19 | 22 | CGPROGRAM
|
20 | 23 | // Physically based Standard lighting model, and enable shadows on all light types
|
21 | 24 | #pragma surface surf Standard fullforwardshadows
|
22 | 25 |
|
23 | 26 | // Use shader model 3.0 target, to get nicer looking lighting
|
24 | 27 | #pragma target 3.0
|
25 | 28 |
|
26 |
| - float4 _BaseColor; |
27 |
| - float4 _DetailColor1; |
28 |
| - float4 _DetailColor2; |
| 29 | + float4 _BaseColor; |
| 30 | + float4 _DetailColor1; |
| 31 | + float4 _DetailColor2; |
29 | 32 |
|
30 | 33 | sampler2D _BaseTex;
|
31 |
| - sampler2D _DetailTex1; |
32 |
| - sampler2D _DetailTex2; |
| 34 | + sampler2D _DetailTex1; |
| 35 | + sampler2D _DetailTex2; |
33 | 36 |
|
34 |
| - float _Emission; |
| 37 | + float _Emission; |
35 | 38 |
|
36 |
| - struct Input |
37 |
| - { |
| 39 | + struct Input |
| 40 | + { |
38 | 41 | float2 uv_BaseTex, uv_DetailTex1, uv_DetailTex2;
|
39 | 42 | };
|
40 |
| - |
41 |
| - |
| 43 | + |
| 44 | + |
42 | 45 |
|
43 | 46 | // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
|
44 | 47 | // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
|
45 | 48 | // #pragma instancing_options assumeuniformscaling
|
46 |
| - UNITY_INSTANCING_CBUFFER_START(Props) |
| 49 | + UNITY_INSTANCING_BUFFER_START(Props) |
47 | 50 | // put more per-instance properties here
|
48 |
| - UNITY_INSTANCING_CBUFFER_END |
| 51 | + UNITY_INSTANCING_BUFFER_END(Props) |
| 52 | + |
| 53 | + void surf (Input IN, inout SurfaceOutputStandard o) |
| 54 | + { |
| 55 | + fixed4 baseTexture = tex2D (_BaseTex, IN.uv_BaseTex); |
| 56 | + |
| 57 | + fixed4 detailTexture1 = tex2D (_DetailTex1, IN.uv_DetailTex1); |
| 58 | + fixed4 detailTexture2 = tex2D (_DetailTex2, IN.uv_DetailTex2); |
49 | 59 |
|
50 |
| - void surf (Input IN, inout SurfaceOutputStandard o) |
51 |
| - { |
52 |
| - fixed4 baseTexture = tex2D (_BaseTex, IN.uv_BaseTex); |
53 |
| - |
54 |
| - fixed4 detailTexture1 = tex2D (_DetailTex1, IN.uv_DetailTex1); |
55 |
| - fixed4 detailTexture2 = tex2D (_DetailTex2, IN.uv_DetailTex2); |
| 60 | + fixed4 baseDetail1_Result = lerp(_BaseColor, _DetailColor1, detailTexture1.a); |
56 | 61 |
|
57 |
| - fixed4 baseDetail1_Result = lerp(_BaseColor, _DetailColor1, detailTexture1.a); |
| 62 | + fixed4 detail1Detail2_Result = lerp(baseDetail1_Result, _DetailColor2, detailTexture2.a); |
58 | 63 |
|
59 |
| - fixed4 detail1Detail2_Result = lerp(baseDetail1_Result, _DetailColor2, detailTexture2.a); |
| 64 | + fixed4 c = baseTexture *= detail1Detail2_Result; |
| 65 | + half3 e = c.rgb; |
60 | 66 |
|
61 |
| - fixed4 c = baseTexture *= detail1Detail2_Result; |
62 |
| - half3 e = c.rgb; |
63 |
| - |
64 |
| - o.Albedo = c.rgb; |
65 |
| - o.Emission = e * _Emission; |
66 |
| - o.Alpha = 1.0; |
| 67 | + o.Albedo = c.rgb; |
| 68 | + o.Emission = e * _Emission; |
| 69 | + o.Alpha = 1.0; |
67 | 70 | }
|
68 | 71 | ENDCG
|
69 | 72 | }
|
|
0 commit comments