diff --git a/John Lim's Blend Modes/Add.shader b/John Lim's Blend Modes/Add.shader index 6b05e31..c2488a7 100644 --- a/John Lim's Blend Modes/Add.shader +++ b/John Lim's Blend Modes/Add.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Add" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Add" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Add(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Add.shader.meta b/John Lim's Blend Modes/Add.shader.meta index c8d9d7a..8cc9ae8 100644 --- a/John Lim's Blend Modes/Add.shader.meta +++ b/John Lim's Blend Modes/Add.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4269f28aa41dde64fb9cf98a4f711c4a +guid: 0ae724cf80d801b43b140517e4bbb12f ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/CGIncludes.meta b/John Lim's Blend Modes/CGIncludes.meta index b522bb0..045a0b3 100644 --- a/John Lim's Blend Modes/CGIncludes.meta +++ b/John Lim's Blend Modes/CGIncludes.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6d5c86c2a129b7e4cac3613a44e57596 +guid: edc6b21aef727c14bb42932e92c7be29 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/John Lim's Blend Modes/CGIncludes/PhotoshopBlendModes.cginc.meta b/John Lim's Blend Modes/CGIncludes/PhotoshopBlendModes.cginc.meta index 7e67a9c..7b7c9c8 100644 --- a/John Lim's Blend Modes/CGIncludes/PhotoshopBlendModes.cginc.meta +++ b/John Lim's Blend Modes/CGIncludes/PhotoshopBlendModes.cginc.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 228885d6905654f47bd7a4978c6cdc92 +guid: eb4ec4a0e81584343b972b2a25f96bc2 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Color.shader b/John Lim's Blend Modes/Color.shader index 2b14d00..804e028 100644 --- a/John Lim's Blend Modes/Color.shader +++ b/John Lim's Blend Modes/Color.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Color" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Color" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Color(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Color.shader.meta b/John Lim's Blend Modes/Color.shader.meta index 3b3b787..d446c74 100644 --- a/John Lim's Blend Modes/Color.shader.meta +++ b/John Lim's Blend Modes/Color.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7af9ec333add27d47bec30fa9d6828f1 +guid: bb85841f8c67d2442b800ab4be4ecae5 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/ColorBurn.shader b/John Lim's Blend Modes/ColorBurn.shader index c1e56a5..b6d3cf7 100644 --- a/John Lim's Blend Modes/ColorBurn.shader +++ b/John Lim's Blend Modes/ColorBurn.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/ColorBurn" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/ColorBurn" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = ColorBurn(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/ColorBurn.shader.meta b/John Lim's Blend Modes/ColorBurn.shader.meta index 66413a5..62564eb 100644 --- a/John Lim's Blend Modes/ColorBurn.shader.meta +++ b/John Lim's Blend Modes/ColorBurn.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: abe00f06292456c4dad3ba0c64c0db20 +guid: da5b85daa127ed043af5579d10e6e49d ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/ColorDodge.shader b/John Lim's Blend Modes/ColorDodge.shader index 4d5ca3b..1b4b366 100644 --- a/John Lim's Blend Modes/ColorDodge.shader +++ b/John Lim's Blend Modes/ColorDodge.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/ColorDodge" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/ColorDodge" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = ColorDodge(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/ColorDodge.shader.meta b/John Lim's Blend Modes/ColorDodge.shader.meta index d20efb8..7be8e75 100644 --- a/John Lim's Blend Modes/ColorDodge.shader.meta +++ b/John Lim's Blend Modes/ColorDodge.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2e9dab63ad757554aaf44f7aa2df13f2 +guid: a1c1848ac45b3724483467a3f2f10326 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/DarkerColor.shader b/John Lim's Blend Modes/DarkerColor.shader index 0769c4b..ad48d48 100644 --- a/John Lim's Blend Modes/DarkerColor.shader +++ b/John Lim's Blend Modes/DarkerColor.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/DarkerColor" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/DarkerColor" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = DarkerColor(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/DarkerColor.shader.meta b/John Lim's Blend Modes/DarkerColor.shader.meta index c1ef3ab..b665e06 100644 --- a/John Lim's Blend Modes/DarkerColor.shader.meta +++ b/John Lim's Blend Modes/DarkerColor.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4b3cdaba99bcc0748aa1f0bad2412e3c +guid: d0090e6d378db134baa8c6bf62a4a607 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Difference.shader b/John Lim's Blend Modes/Difference.shader index 90c4360..33a37ca 100644 --- a/John Lim's Blend Modes/Difference.shader +++ b/John Lim's Blend Modes/Difference.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Difference" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Difference" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Difference(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Difference.shader.meta b/John Lim's Blend Modes/Difference.shader.meta index f5d7aeb..cd018ee 100644 --- a/John Lim's Blend Modes/Difference.shader.meta +++ b/John Lim's Blend Modes/Difference.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a603d7e39dcaaf64daf1a6b00d7c5a5d +guid: 74ccff3d254d9644fa54c55127b3646d ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Divide.shader b/John Lim's Blend Modes/Divide.shader index f5448d8..b75e4c9 100644 --- a/John Lim's Blend Modes/Divide.shader +++ b/John Lim's Blend Modes/Divide.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Divide" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Divide" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Divide(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Divide.shader.meta b/John Lim's Blend Modes/Divide.shader.meta index 4b26aa1..6391a34 100644 --- a/John Lim's Blend Modes/Divide.shader.meta +++ b/John Lim's Blend Modes/Divide.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: da2b3ab57c5633e4793a80b65d9c0eb0 +guid: 075fe556031b1174e8d6ca9369753b6d ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Exclusion.shader b/John Lim's Blend Modes/Exclusion.shader index f65e369..5b6f711 100644 --- a/John Lim's Blend Modes/Exclusion.shader +++ b/John Lim's Blend Modes/Exclusion.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Exclusion" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Exclusion" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Exclusion(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Exclusion.shader.meta b/John Lim's Blend Modes/Exclusion.shader.meta index cde2a2d..e13c54e 100644 --- a/John Lim's Blend Modes/Exclusion.shader.meta +++ b/John Lim's Blend Modes/Exclusion.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e4fd45f88262d324c97dde29b3fcfd0b +guid: d292d32bbf4832745a23aa6a3a06b1de ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/HardLight.shader b/John Lim's Blend Modes/HardLight.shader index e0e20b1..5b7ec19 100644 --- a/John Lim's Blend Modes/HardLight.shader +++ b/John Lim's Blend Modes/HardLight.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/HardLight" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/HardLight" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = HardLight(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/HardLight.shader.meta b/John Lim's Blend Modes/HardLight.shader.meta index 463219d..2360601 100644 --- a/John Lim's Blend Modes/HardLight.shader.meta +++ b/John Lim's Blend Modes/HardLight.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 938906999eee4244cb946ece9dacd6a2 +guid: fe63576204204b1428a23c825667e2a9 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/HardMix.shader b/John Lim's Blend Modes/HardMix.shader index 3c54de7..edabfcd 100644 --- a/John Lim's Blend Modes/HardMix.shader +++ b/John Lim's Blend Modes/HardMix.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/HardMix" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/HardMix" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = HardMix(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/HardMix.shader.meta b/John Lim's Blend Modes/HardMix.shader.meta index 4d6c573..80c79fa 100644 --- a/John Lim's Blend Modes/HardMix.shader.meta +++ b/John Lim's Blend Modes/HardMix.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d9e7483ac1e145a4092064690b7c7bf8 +guid: 4dc9a51c26a36e044904b7e3a5a87c51 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Hue.shader b/John Lim's Blend Modes/Hue.shader index f4b0c27..b14077e 100644 --- a/John Lim's Blend Modes/Hue.shader +++ b/John Lim's Blend Modes/Hue.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Hue" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Hue" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Hue(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Hue.shader.meta b/John Lim's Blend Modes/Hue.shader.meta index 04bd6d9..d942299 100644 --- a/John Lim's Blend Modes/Hue.shader.meta +++ b/John Lim's Blend Modes/Hue.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 66afe08a6005d074d8f381ba84d04c9c +guid: ac709b7b6ba995046b2e357657ce6e8a ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Lighten.shader b/John Lim's Blend Modes/Lighten.shader index b2734c1..5cb05ca 100644 --- a/John Lim's Blend Modes/Lighten.shader +++ b/John Lim's Blend Modes/Lighten.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Lighten" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Lighten" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Lighten(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Lighten.shader.meta b/John Lim's Blend Modes/Lighten.shader.meta index b3a67d7..f13f7d5 100644 --- a/John Lim's Blend Modes/Lighten.shader.meta +++ b/John Lim's Blend Modes/Lighten.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cb11aca31f4fd0e4680de6d443238eb0 +guid: af52445a55f450d488ad19f3f0f7b2c6 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/LighterColor.shader b/John Lim's Blend Modes/LighterColor.shader index e492b24..f0d7813 100644 --- a/John Lim's Blend Modes/LighterColor.shader +++ b/John Lim's Blend Modes/LighterColor.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/LighterColor" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/LighterColor" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = LighterColor(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/LighterColor.shader.meta b/John Lim's Blend Modes/LighterColor.shader.meta index 7ab3bcf..d152508 100644 --- a/John Lim's Blend Modes/LighterColor.shader.meta +++ b/John Lim's Blend Modes/LighterColor.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 28e958a6637ccd544bf67f5992702caf +guid: 8c3ff3424a6646142b77fd44709ac344 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/LinearBurn.shader b/John Lim's Blend Modes/LinearBurn.shader index d56d2d4..fc68954 100644 --- a/John Lim's Blend Modes/LinearBurn.shader +++ b/John Lim's Blend Modes/LinearBurn.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/LinearBurn" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/LinearBurn" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = LinearBurn(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/LinearBurn.shader.meta b/John Lim's Blend Modes/LinearBurn.shader.meta index 8824bff..c4fec43 100644 --- a/John Lim's Blend Modes/LinearBurn.shader.meta +++ b/John Lim's Blend Modes/LinearBurn.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0c5c9da179b91134ba4cc1293beae1c5 +guid: 0cce16f4622c09c47918eeaa45e90221 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/LinearDodge.shader b/John Lim's Blend Modes/LinearDodge.shader index 820a67e..ad4370c 100644 --- a/John Lim's Blend Modes/LinearDodge.shader +++ b/John Lim's Blend Modes/LinearDodge.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/LinearDodge" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/LinearDodge" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = LinearDodge(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/LinearDodge.shader.meta b/John Lim's Blend Modes/LinearDodge.shader.meta index 3cf9501..de1e238 100644 --- a/John Lim's Blend Modes/LinearDodge.shader.meta +++ b/John Lim's Blend Modes/LinearDodge.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 120d169b25e14bc4aa4a86ccab630e95 +guid: 57c2408124f76304286601e694c90cd9 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/LinearLight.shader b/John Lim's Blend Modes/LinearLight.shader index bf63a5b..b7f7f49 100644 --- a/John Lim's Blend Modes/LinearLight.shader +++ b/John Lim's Blend Modes/LinearLight.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/LinearLight" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/LinearLight" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = LinearLight(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/LinearLight.shader.meta b/John Lim's Blend Modes/LinearLight.shader.meta index 3b44acd..f13b9f2 100644 --- a/John Lim's Blend Modes/LinearLight.shader.meta +++ b/John Lim's Blend Modes/LinearLight.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4e590f89e298249448ed2ff5752b6d5e +guid: b2d75a74e3683154db45a2a4191be880 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Luminosity.shader b/John Lim's Blend Modes/Luminosity.shader index a15fffd..7fb18ef 100644 --- a/John Lim's Blend Modes/Luminosity.shader +++ b/John Lim's Blend Modes/Luminosity.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Luminosity" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Luminosity" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Luminosity(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Luminosity.shader.meta b/John Lim's Blend Modes/Luminosity.shader.meta index 10c050a..6940d39 100644 --- a/John Lim's Blend Modes/Luminosity.shader.meta +++ b/John Lim's Blend Modes/Luminosity.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 155c4b13f0ffa41419a5c0f8322f1717 +guid: fce1c8cc491cb9949990727c4b160df1 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Overlay.shader b/John Lim's Blend Modes/Overlay.shader index 50a1c99..3e20753 100644 --- a/John Lim's Blend Modes/Overlay.shader +++ b/John Lim's Blend Modes/Overlay.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Overlay" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Overlay" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Overlay(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Overlay.shader.meta b/John Lim's Blend Modes/Overlay.shader.meta index 7a3a2f0..195564c 100644 --- a/John Lim's Blend Modes/Overlay.shader.meta +++ b/John Lim's Blend Modes/Overlay.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f6b7d6f374c7743439ab16cee7a18236 +guid: 2ffc151e4b55f1e468e1a7fd115dc8f8 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/PinLight.shader b/John Lim's Blend Modes/PinLight.shader index ac33f9f..a205f46 100644 --- a/John Lim's Blend Modes/PinLight.shader +++ b/John Lim's Blend Modes/PinLight.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/PinLight" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/PinLight" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = PinLight(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/PinLight.shader.meta b/John Lim's Blend Modes/PinLight.shader.meta index 3f433d1..e604509 100644 --- a/John Lim's Blend Modes/PinLight.shader.meta +++ b/John Lim's Blend Modes/PinLight.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ab759648eeab4a14abb5005df6d65f94 +guid: f78ab9a11343ac647b0fd6e24af945df ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Saturation.shader b/John Lim's Blend Modes/Saturation.shader index 42fb792..1089d01 100644 --- a/John Lim's Blend Modes/Saturation.shader +++ b/John Lim's Blend Modes/Saturation.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Saturation" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Saturation" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Saturation(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Saturation.shader.meta b/John Lim's Blend Modes/Saturation.shader.meta index 6648970..2b6cdb5 100644 --- a/John Lim's Blend Modes/Saturation.shader.meta +++ b/John Lim's Blend Modes/Saturation.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c6c7aaf6ca16f1c438ab4824f5093f48 +guid: 9da612291cb24ba4f8ed18d8ad9ab609 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Screen.shader b/John Lim's Blend Modes/Screen.shader index afed11a..1d3de4a 100644 --- a/John Lim's Blend Modes/Screen.shader +++ b/John Lim's Blend Modes/Screen.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Screen" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Screen" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Screen(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Screen.shader.meta b/John Lim's Blend Modes/Screen.shader.meta index fc08e7b..a21b35e 100644 --- a/John Lim's Blend Modes/Screen.shader.meta +++ b/John Lim's Blend Modes/Screen.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c8165dab8c68f34428380d7f7082e4f5 +guid: 2b7011eeda59694449ddcd78ad15ba20 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/SoftLight.shader b/John Lim's Blend Modes/SoftLight.shader index 590a4ae..93a2228 100644 --- a/John Lim's Blend Modes/SoftLight.shader +++ b/John Lim's Blend Modes/SoftLight.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/SoftLight" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/SoftLight" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = SoftLight(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/SoftLight.shader.meta b/John Lim's Blend Modes/SoftLight.shader.meta index 4bbdff5..b6bb3a4 100644 --- a/John Lim's Blend Modes/SoftLight.shader.meta +++ b/John Lim's Blend Modes/SoftLight.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: aa68668435f85de4b97960aa74facec7 +guid: 9c5c0203c153de344acd602adb1210bb ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/Subtract.shader b/John Lim's Blend Modes/Subtract.shader index 03d9faa..1efcbba 100644 --- a/John Lim's Blend Modes/Subtract.shader +++ b/John Lim's Blend Modes/Subtract.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/Subtract" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/Subtract" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = Subtract(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/Subtract.shader.meta b/John Lim's Blend Modes/Subtract.shader.meta index 14b5730..9e6c7b3 100644 --- a/John Lim's Blend Modes/Subtract.shader.meta +++ b/John Lim's Blend Modes/Subtract.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8ff82bd7adbcce143920a3e59b3266c4 +guid: dad2fab4a5cb39846a52481a503e6d11 ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/John Lim's Blend Modes/VividLight.shader b/John Lim's Blend Modes/VividLight.shader index 79ca9a8..9096d2d 100644 --- a/John Lim's Blend Modes/VividLight.shader +++ b/John Lim's Blend Modes/VividLight.shader @@ -57,12 +57,15 @@ Shader "Blendmodes/VividLight" { float4 vertex : POSITION; float2 uv : TEXCOORD0; + float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; + float4 color : COLOR; + float2 bguv : TEXCOORD1; }; sampler2D _MainTex; @@ -78,15 +81,18 @@ Shader "Blendmodes/VividLight" v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + o.bguv = ComputeGrabScreenPos(o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { - fixed4 mainColor = tex2D(_BackgroundTexture, i.uv); - fixed4 blendColor = tex2D(_MainTex, i.uv); + fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv); + fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color; blendColor.xyz += _Tint1.xyz * _Tint1.a; + // perform blend mainColor.xyz = VividLight(mainColor.xyz, blendColor.xyz); mainColor.xyz += _Tint2.xyz * _Tint2.a; diff --git a/John Lim's Blend Modes/VividLight.shader.meta b/John Lim's Blend Modes/VividLight.shader.meta index d2402bb..cb58b4f 100644 --- a/John Lim's Blend Modes/VividLight.shader.meta +++ b/John Lim's Blend Modes/VividLight.shader.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6b2f862719c9dd345a1b1f27a62c467a +guid: bef33988c68cc854780ec0424181377e ShaderImporter: externalObjects: {} defaultTextures: [] diff --git a/README.md b/README.md index b3059ce..0139232 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Each shader applies given texture from sprite renderer to the texture from Unity ![alt text](https://raw.githubusercontent.com/penandlim/JL-s-Unity-Blend-Modes/master/preview.png "Preview") -The texture assigned to sprite renderer **must have same dimensions/ratio as Screen width and height.** + Built for screen space effect but feel free to modify it by replacing GrabPass to other textures.