Skip to content

Commit 5935f75

Browse files
committed
Fixed compatibility issues with shaders
1 parent 8f57a2b commit 5935f75

8 files changed

Lines changed: 107 additions & 79 deletions

File tree

Assets/Prefabs/Viewport.prefab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ MonoBehaviour:
551551
limit: 10
552552
mouse: {x: 0, y: 0}
553553
viewport: {fileID: 0}
554+
position: {x: 0, y: 0, z: 0}
554555
--- !u!114 &114919223755245490
555556
MonoBehaviour:
556557
m_ObjectHideFlags: 1

Assets/Shaders/Clouds.shader

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,31 @@
1818

1919
#pragma vertex vert
2020
#pragma fragment frag
21-
21+
2222
#include "UnityCG.cginc"
2323

24+
sampler2D _MainTex;
25+
float4 _MainTex_ST;
26+
2427
struct appdata {
2528
float4 vertex : POSITION;
2629
float2 uv : TEXCOORD0;
2730
};
2831

2932
struct v2f {
30-
float2 uv : TEXCOORD0;
3133
float4 vertex : SV_POSITION;
34+
float2 uv : TEXCOORD0;
3235
};
3336

34-
sampler2D _MainTex;
35-
float4 _MainTex_ST;
36-
3737
v2f vert(appdata v) {
3838
v2f o;
3939
o.vertex = UnityObjectToClipPos(v.vertex);
40-
o.uv = mul(unity_ObjectToWorld, (TRANSFORM_TEX(v.uv, _MainTex) * 0.015625));
40+
o.uv = (float2)mul(unity_ObjectToWorld, TRANSFORM_TEX(v.uv, _MainTex) * 0.015625);
4141
return o;
4242
}
4343

4444
fixed4 frag(v2f i) : SV_Target {
45-
fixed4 col = tex2D(_MainTex, i.uv);
46-
return col;
45+
return tex2D(_MainTex, i.uv);
4746
}
4847

4948
ENDCG

Assets/Shaders/Curtain.shader

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,31 @@
1919

2020
#pragma vertex vert
2121
#pragma fragment frag
22+
2223
#include "UnityCG.cginc"
2324

2425
fixed4 _Color;
2526
float _Size;
2627

27-
struct fragmentInput {
28-
float4 pos : SV_POSITION;
29-
float2 uv : TEXTCOORD0;
28+
struct appdata {
29+
float4 vertex : POSITION;
30+
float2 uv : TEXCOORD0;
31+
};
32+
33+
struct v2f {
34+
float4 vertex : SV_POSITION;
35+
float2 uv : TEXCOORD0;
3036
};
3137

32-
fragmentInput vert (appdata_base v) {
33-
fragmentInput o;
34-
o.pos = UnityObjectToClipPos(v.vertex);
35-
o.uv = v.texcoord.xy - fixed2(0.5,0.5);
38+
v2f vert (appdata v) {
39+
v2f o;
40+
o.vertex = UnityObjectToClipPos(v.vertex);
41+
o.uv = v.uv.xy - fixed2(0.5, 0.5);
3642
return o;
3743
}
3844

39-
fixed4 frag(fragmentInput i) : SV_Target {
40-
float distance = sqrt(pow(i.uv.x, 2) + pow(i.uv.y,2));
45+
fixed4 frag(v2f i) : SV_Target {
46+
float distance = sqrt(pow(i.uv.x, 2) + pow(i.uv.y, 2));
4147
return (distance > _Size) ? _Color : fixed4(1, 1, 1, 0);
4248
}
4349

Assets/Shaders/Pulse.shader

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Shader "Sprites/Pulse" {
22
Properties {
33
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
4-
_Highlight ("Highlight", Color) = (1,1,1,1)
5-
_Color ("Tint", Color) = (1,1,1,1)
4+
_Highlight ("Highlight", Color) = (1, 1, 1, 1)
5+
_Color ("Tint", Color) = (1, 1, 1, 1)
66
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
77
}
88

99
SubShader {
1010
Tags {
11-
"Queue"="Transparent"
12-
"IgnoreProjector"="True"
13-
"RenderType"="Transparent"
14-
"PreviewType"="Plane"
15-
"CanUseSpriteAtlas"="True"
11+
"Queue" = "Transparent"
12+
"IgnoreProjector" = "True"
13+
"RenderType" = "Transparent"
14+
"PreviewType" = "Plane"
15+
"CanUseSpriteAtlas" = "True"
1616
}
1717

1818
Cull Off
@@ -23,47 +23,49 @@
2323

2424
Pass {
2525
CGPROGRAM
26-
#pragma vertex vert
27-
#pragma fragment frag
28-
#pragma multi_compile DUMMY PIXELSNAP_ON
29-
#include "UnityCG.cginc"
30-
31-
struct appdata_t {
32-
float4 vertex : POSITION;
33-
float4 color : COLOR;
34-
float2 texcoord : TEXCOORD0;
35-
};
3626

37-
struct v2f {
38-
float4 vertex : SV_POSITION;
39-
fixed4 color : COLOR;
40-
half2 texcoord : TEXCOORD0;
41-
};
42-
43-
fixed4 _Color;
44-
fixed4 _Highlight;
27+
#pragma vertex vert
28+
#pragma fragment frag
29+
#pragma multi_compile DUMMY PIXELSNAP_ON
4530

46-
v2f vert(appdata_t IN) {
47-
v2f o;
48-
o.vertex = UnityObjectToClipPos(IN.vertex);
49-
o.texcoord = IN.texcoord;
50-
o.color = IN.color * _Color;
31+
#include "UnityCG.cginc"
5132

52-
#ifdef PIXELSNAP_ON
53-
o.vertex = UnityPixelSnap (o.vertex);
54-
#endif
33+
fixed4 _Color;
34+
fixed4 _Highlight;
35+
sampler2D _MainTex;
5536

56-
return o;
57-
}
37+
struct appdata {
38+
float4 vertex : POSITION;
39+
float4 color : COLOR;
40+
float2 uv : TEXCOORD0;
41+
};
5842

59-
sampler2D _MainTex;
43+
struct v2f {
44+
float4 vertex : SV_POSITION;
45+
fixed4 color : COLOR;
46+
half2 uv : TEXCOORD0;
47+
};
48+
49+
v2f vert(appdata v) {
50+
v2f o;
51+
o.vertex = UnityObjectToClipPos(v.vertex);
52+
o.uv = v.uv;
53+
o.color = v.color * _Color;
54+
55+
#ifdef PIXELSNAP_ON
56+
o.vertex = UnityPixelSnap(o.vertex);
57+
#endif
58+
59+
return o;
60+
}
61+
62+
fixed4 frag(v2f i) : COLOR {
63+
half4 texcol = tex2D(_MainTex, i.uv);
64+
texcol.rgb = lerp(texcol.rgb, _Highlight, (1 - min(1, pow(abs(sin(_Time[0] * 40) * 2), 2))) * _Highlight.a);
65+
texcol = texcol * i.color;
66+
return texcol;
67+
}
6068

61-
fixed4 frag(v2f IN) : COLOR {
62-
half4 texcol = tex2D (_MainTex, IN.texcoord);
63-
texcol.rgb = lerp(texcol.rgb, _Highlight, (1 - min(1, pow(abs(sin(_Time[0] * 40) * 2), 2))) * _Highlight.a);
64-
texcol = texcol * IN.color;
65-
return texcol;
66-
}
6769
ENDCG
6870
}
6971
}

Assets/Shaders/Visibility.shader

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,33 @@
1919

2020
#pragma vertex vert
2121
#pragma fragment frag
22+
2223
#include "UnityCG.cginc"
2324

2425
fixed4 _Color;
2526
float _Size;
2627

27-
struct fragmentInput {
28-
float4 pos : SV_POSITION;
29-
float2 scale : TEXTCOORD1;
30-
float2 uv : TEXTCOORD0;
28+
struct appdata {
29+
float4 vertex : POSITION;
30+
float2 scale : TEXCOORD1;
31+
float2 uv : TEXCOORD0;
32+
};
33+
34+
struct v2f {
35+
float4 vertex : SV_POSITION;
36+
float2 scale : TEXCOORD1;
37+
float2 uv : TEXCOORD0;
3138
};
3239

33-
fragmentInput vert (appdata_base v) {
34-
fragmentInput o;
35-
o.pos = UnityObjectToClipPos (v.vertex);
36-
o.scale = mul(unity_ObjectToWorld, float2(1, 1));
37-
o.uv = v.texcoord.xy - fixed2(0.5,0.5);
40+
v2f vert(appdata v) {
41+
v2f o;
42+
o.vertex = UnityObjectToClipPos(v.vertex);
43+
o.scale = (float2)mul(unity_ObjectToWorld, fixed2(1, 1));
44+
o.uv = v.uv.xy - fixed2(0.5, 0.5);
3845
return o;
3946
}
4047

41-
fixed4 frag(fragmentInput i) : SV_Target {
48+
fixed4 frag(v2f i) : SV_Target {
4249
float distance = sqrt(pow(i.uv.x * i.scale.x, 2) + pow(i.uv.y * i.scale.y, 2));
4350
return (distance > _Size) ? _Color : fixed4(1, 1, 1, 0);
4451
}

ProjectSettings/GraphicsSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GraphicsSettings:
3636
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
3737
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
3838
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
39-
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
39+
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
4040
m_PreloadedShaders: []
4141
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
4242
type: 0}

ProjectSettings/ProjectSettings.asset

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PlayerSettings:
66
serializedVersion: 13
77
productGUID: c79dc950f7ba0c14f898d172f53be115
88
AndroidProfiler: 0
9-
AndroidFilterTouchesWhenObscured: 0
9+
AndroidFilterTouchesWhenObscured: 1
1010
defaultScreenOrientation: 0
1111
targetDevice: 2
1212
useOnDemandResources: 0
@@ -149,12 +149,13 @@ PlayerSettings:
149149
androidMaxAspectRatio: 2.1
150150
applicationIdentifier:
151151
Android: io.munkkeli.thicket
152+
Standalone: io.munkkeli.thicket
152153
iOS: io.munkkeli.thicket
153154
buildNumber: {}
154155
AndroidBundleVersionCode: 1
155156
AndroidMinSdkVersion: 16
156157
AndroidTargetSdkVersion: 0
157-
AndroidPreferredInstallLocation: 1
158+
AndroidPreferredInstallLocation: 0
158159
aotOptions:
159160
stripEngineCode: 1
160161
iPhoneStrippingLevel: 0
@@ -227,7 +228,7 @@ PlayerSettings:
227228
androidSplashScreen: {fileID: 0}
228229
AndroidKeystoreName:
229230
AndroidKeyaliasName:
230-
AndroidTVCompatibility: 1
231+
AndroidTVCompatibility: 0
231232
AndroidIsGame: 1
232233
AndroidEnableTango: 0
233234
androidEnableBanner: 1
@@ -247,7 +248,19 @@ PlayerSettings:
247248
m_Height: 128
248249
m_Kind: 0
249250
m_BuildTargetBatching: []
250-
m_BuildTargetGraphicsAPIs: []
251+
m_BuildTargetGraphicsAPIs:
252+
- m_BuildTarget: AndroidPlayer
253+
m_APIs: 0b0000000800000015000000
254+
m_Automatic: 0
255+
- m_BuildTarget: MacStandaloneSupport
256+
m_APIs: 1000000011000000
257+
m_Automatic: 0
258+
- m_BuildTarget: WindowsStandaloneSupport
259+
m_APIs: 12000000020000000100000015000000
260+
m_Automatic: 0
261+
- m_BuildTarget: LinuxStandaloneSupport
262+
m_APIs: 1100000015000000
263+
m_Automatic: 0
251264
m_BuildTargetVRSettings: []
252265
m_BuildTargetEnableVuforiaSettings: []
253266
openGLRequireES31: 0

ProjectSettings/QualitySettings.asset

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ QualitySettings:
77
m_CurrentQuality: 0
88
m_QualitySettings:
99
- serializedVersion: 2
10-
name: Ultra
11-
pixelLightCount: 4
12-
shadows: 2
13-
shadowResolution: 2
10+
name: Normal
11+
pixelLightCount: 1
12+
shadows: 0
13+
shadowResolution: 3
1414
shadowProjection: 1
1515
shadowCascades: 4
1616
shadowDistance: 150
@@ -24,7 +24,7 @@ QualitySettings:
2424
antiAliasing: 0
2525
softParticles: 1
2626
softVegetation: 1
27-
realtimeReflectionProbes: 1
27+
realtimeReflectionProbes: 0
2828
billboardsFaceCameraPosition: 1
2929
vSyncCount: 1
3030
lodBias: 2

0 commit comments

Comments
 (0)