Skip to content

Commit 7003690

Browse files
committed
Upgraded the project to Unity 2017 and fixed the subshader tags that were changed since 5.6 and had broken it. The scripts still work with 5.6 (just not the project/scenes), though I've decided to move ahead since 2017 seems to be the default version supported by Unity. Future changes may lead to ending support for 5.5 and 5.6, but they haven't changed it enough yet to require that.
1 parent 8138da4 commit 7003690

File tree

139 files changed

+187
-31261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+187
-31261
lines changed
0 Bytes
Binary file not shown.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Shader "Custom/Vegetation"
2+
{
3+
Properties
4+
{
5+
_MainTex ("Base Color", 2D) = "white" {}
6+
[Normal] [NoScaleOffset]
7+
_NormalMap ("Normal Map", 2D) = "bump" {}
8+
_Metallic ("Metallic", Range(0, 1)) = 0
9+
_Gloss ("Gloss", Range(0, 1)) = 0.1336244
10+
11+
[Space(10)] [NoScaleOffset]
12+
_WindNoise ("Wind Noise", 2D) = "gray" {}
13+
_WindNoiseScale ("Wind Noise Position Scale", Float ) = .1
14+
_WindNoiseSpeed ("Wind Noise Speed", Float ) = .1
15+
_WindNoiseStrength ("Wind Noise Strength", Range(0,10)) = .3
16+
17+
[Space(10)]
18+
_Wind_Direction ("Wind_Direction", Vector) = (1,0,1,0)
19+
_WindFrequency ("Wind Frequency", Float ) = 1.5
20+
_WindAmplitude ("Wind Amplitude", Float ) = 0.03
21+
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
22+
23+
[Space(10)]
24+
_Phong ("Phong Strengh", Range(0,1)) = 0.5
25+
_Tess ("Tessellation", Range(1,32)) = 4
26+
}
27+
SubShader
28+
{
29+
Tags { "RenderType" = "TreeTransparentCutout" }
30+
LOD 200
31+
32+
CGPROGRAM
33+
#pragma surface surf Standard vertex:vert alphatest:_Cutoff addshadow fullforwardshadows tessellate:tessDistance tessphong:_Phong nolightmap
34+
#include "Tessellation.cginc"
35+
#pragma target 5.0
36+
37+
sampler2D _MainTex;
38+
sampler2D _NormalMap;
39+
sampler2D _WindNoise;
40+
41+
struct appdata
42+
{
43+
float4 vertex : POSITION;
44+
float3 normal : NORMAL;
45+
float4 tangent : TANGENT;
46+
float4 color : COLOR;
47+
float2 texcoord : TEXCOORD0;
48+
};
49+
50+
struct Input
51+
{
52+
float4 pos : SV_POSITION;
53+
float2 uv_MainTex : TEXCOORD0;
54+
};
55+
56+
float _Phong;
57+
float _Tess;
58+
59+
float4 tessDistance(appdata v0, appdata v1, appdata v2)
60+
{
61+
float minDist = 7.5;
62+
float maxDist = 25.0;
63+
return UnityDistanceBasedTess(v0.vertex, v1.vertex, v2.vertex, minDist, maxDist, _Tess);
64+
}
65+
66+
67+
fixed4 _Wind_Direction;
68+
half _Metallic;
69+
half _Gloss;
70+
float _WindNoiseScale;
71+
float _WindNoiseSpeed;
72+
float _WindNoiseStrength;
73+
74+
float _WindFrequency;
75+
float _WindAmplitude;
76+
77+
void vert(inout appdata v)
78+
{
79+
float3 pos = mul(v.vertex, unity_ObjectToWorld);
80+
float noiseA = tex2Dlod(_WindNoise, float4(pos.xz * _WindNoiseScale + _Time.x * float2(_WindNoiseSpeed, _WindNoiseSpeed), 0.0, 0.0)).r * _WindNoiseStrength;
81+
82+
v.vertex.xyz += (mul(_Wind_Direction.xyz, unity_WorldToObject) * v.color.r * sin(v.color.b*3.141592654 + (_Time.y + noiseA) *_WindFrequency) *_WindAmplitude);
83+
}
84+
85+
void surf(Input IN, inout SurfaceOutputStandard o)
86+
{
87+
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
88+
o.Albedo = c.rgb;
89+
90+
o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
91+
o.Metallic = _Metallic;
92+
o.Smoothness = _Gloss;
93+
o.Alpha = c.a;
94+
}
95+
ENDCG
96+
}
97+
FallBack "Diffuse"
98+
}

Assets/PCSS/Demo/Demo Assets/Palm Trees/Shaders/Vegetation Tesselation.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Assets/PCSS/Demo/Demo Assets/Scripts/FrameRate.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ private void UpdateUI ()
7474
graphicsAPIText.text = string.Format("Graphics API: {0}", SystemInfo.graphicsDeviceType);
7575
string vysncText = (QualitySettings.vSyncCount > 0) ? "Enabled" : "Disabled";
7676
vsyncStatusText.text = string.Format("VSync: {0}", vysncText);
77-
frameRateText.text = string.Format("Frame Rate: Avg {0} | Min {1} | Max {2}", avgFPS.TS(), minFPS.TS(), maxFPS.TS());
77+
frameRateText.text = string.Format("Average Frame Rate: {0} FPS", avgFPS.TS());
78+
//frameRateText.text = string.Format("Frame Rate: Avg {0} | Min {1} | Max {2}", avgFPS.TS(), minFPS.TS(), maxFPS.TS());
7879
//frameRateText.text = string.Format("Frame Rate: Avg {0} | Min {1} | Max {2} | Low {3} | High {4}", avgFPS.TS(), minFPS.TS(), maxFPS.TS(), lowFPS.TS(), highFPS.TS());
7980
Invoke("UpdateUI", updateInterval);
8081
}

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/RollerBall.meta

Lines changed: 0 additions & 6 deletions
This file was deleted.

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/RollerBall/Materials.meta

Lines changed: 0 additions & 6 deletions
This file was deleted.

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/RollerBall/Materials/RollerBallGrey.mat

Lines changed: 0 additions & 173 deletions
This file was deleted.

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/RollerBall/Materials/RollerBallGrey.mat.meta

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)