Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lots of shaders to singlepass #677

Merged
merged 11 commits into from
Apr 25, 2024
7 changes: 7 additions & 0 deletions Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Category {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand Down Expand Up @@ -81,6 +83,11 @@ Category {

v2f vert (ParticleVertexWithSpread_t v) {
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

v.color = TbVertToSrgb(v.color);
float birthTime = v.texcoord.w;
float rotation = v.texcoord.z;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Resources/Brushes/Basic/CelVinyl/CelVinyl.shader
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ Shader "Brush/Special/CelVinyl" {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
UNITY_FOG_COORDS(1)

UNITY_VERTEX_OUTPUT_STEREO
};

v2f vert (appdata_t v)
Expand All @@ -61,6 +65,10 @@ Shader "Brush/Special/CelVinyl" {

v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
o.color = TbVertToNative(v.color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,29 @@ Category {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 unbloomedColor : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO
};

v2f vert (appdata_t v)
{
PrepForOds(v.vertex);
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
o.color = bloomColor(v.color, _EmissionGain);
Expand Down
8 changes: 8 additions & 0 deletions Assets/Resources/Brushes/Basic/Comet/Comet.shader
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ Category {
fixed4 color : COLOR;
float3 normal : NORMAL;
float3 texcoord : TEXCOORD0;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};


Expand All @@ -68,6 +72,10 @@ Category {
PrepForOds(v.vertex);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.color = TbVertToNative(v.color);

Expand Down
9 changes: 9 additions & 0 deletions Assets/Resources/Brushes/Basic/DanceFloor/DanceFloor.shader
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ Category {
float2 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float3 normal : NORMAL;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float3 worldPos : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -66,6 +70,11 @@ Category {
{
PrepForOds(v.vertex);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

float4 worldPos = mul(unity_ObjectToWorld, v.vertex);
float waveform = 0;

Expand Down
7 changes: 7 additions & 0 deletions Assets/Resources/Brushes/Basic/Dots/Dots.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Category {
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float waveform : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -69,6 +71,11 @@ Category {
{
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

float birthTime = v.texcoord.w;
float rotation = v.texcoord.z;
float halfSize = GetParticleHalfSize(v.corner.xyz, v.center, birthTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ Category {
fixed4 color : COLOR;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1; //per vert offset vector

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)

UNITY_VERTEX_OUTPUT_STEREO
};

v2f vert (appdata_t v)
Expand All @@ -63,6 +67,11 @@ Category {
//

v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

float envelope = sin(v.texcoord0.x * 3.14159);
float widthMultiplier = 1 - envelope;
v.vertex.xyz += -v.texcoord1 * widthMultiplier;
Expand Down
9 changes: 9 additions & 0 deletions Assets/Resources/Brushes/Basic/Electricity/Electricity.shader
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ CGINCLUDE
float3 tangent : TANGENT;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

sampler2D _MainTex;
Expand All @@ -50,6 +52,8 @@ CGINCLUDE
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float3 displacement(float3 pos, float mod) {
Expand Down Expand Up @@ -77,6 +81,11 @@ CGINCLUDE
PrepForOds(v.vertex);
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

float envelope = sin(v.texcoord0.x * (3.14159));
float envelopePow = (1-pow(1 - envelope, 10));

Expand Down
7 changes: 7 additions & 0 deletions Assets/Resources/Brushes/Basic/Embers/Embers.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Category {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand Down Expand Up @@ -103,6 +105,11 @@ Category {
v2f vert (ParticleVertexWithSpread_t v) {
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

// Used as a random-ish seed for various calculations
float seed = v.color.a;
float t01 = fmod(_Time.y*_ScrollRate + seed * 10, 1);
Expand Down
9 changes: 9 additions & 0 deletions Assets/Resources/Brushes/Basic/Fire/Fire.shader
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Category {
float2 texcoord : TEXCOORD0;
#endif
float3 worldPos : TEXCOORD1;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
Expand All @@ -69,6 +71,8 @@ Category {
float2 texcoord : TEXCOORD0;
#endif
float3 worldPos : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -82,6 +86,11 @@ Category {
PrepForOds(v.vertex);
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.color = bloomColor(v.color, _EmissionGain);
o.pos = UnityObjectToClipPos(v.vertex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ Category {
fixed4 color : COLOR;
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -59,6 +63,11 @@ Category {
PrepForOds(v.vertex);

v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.color = TbVertToNative(v.color);
Expand Down
9 changes: 9 additions & 0 deletions Assets/Resources/Brushes/Basic/HyperGrid/HyperGrid.shader
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ Category {
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -66,6 +70,11 @@ Category {
{
v.color = TbVertToSrgb(v.color);
v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

// Subtract out the Canvas space pose to keep the verts from popping around while
// transforming (e.g. apply quantization in an immutable space).
float4 worldPos = mul(unity_ObjectToWorld, v.vertex);
Expand Down
8 changes: 8 additions & 0 deletions Assets/Resources/Brushes/Basic/Plasma/Plasma.shader
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ Category {
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float3 worldPos : TEXCOORD1;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -82,6 +85,11 @@ Category {
PrepForOds(v.vertex);

v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.worldPos = mul(unity_ObjectToWorld, v.vertex);
o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color;
Expand Down
9 changes: 9 additions & 0 deletions Assets/Resources/Brushes/Basic/Rainbow/Rainbow.shader
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ Category {
fixed4 color : COLOR;
float3 normal : NORMAL;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct v2f {
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;

UNITY_VERTEX_OUTPUT_STEREO
};

float4 _MainTex_ST;
Expand All @@ -62,6 +66,11 @@ Category {
v.color = TbVertToSrgb(v.color);

v2f o;

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

o.pos = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.color = v.color;
Expand Down
Loading