diff --git a/Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader b/Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader index 195b4bf398..dd1789fce6 100644 --- a/Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader +++ b/Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader @@ -20,7 +20,6 @@ Properties { _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 _SpreadRate ("Spread Rate", Range(0.3, 5)) = 1.539 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -50,7 +49,6 @@ Category { #pragma multi_compile __ SELECTION_ON #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Particles.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" @@ -59,8 +57,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -134,9 +132,10 @@ Category { fixed4 frag (v2f i) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 tex = tex2D(_MainTex, i.texcoord); diff --git a/Assets/Resources/Brushes/Basic/CelVinyl/CelVinyl.shader b/Assets/Resources/Brushes/Basic/CelVinyl/CelVinyl.shader index beb5cbd726..581dc1dacf 100644 --- a/Assets/Resources/Brushes/Basic/CelVinyl/CelVinyl.shader +++ b/Assets/Resources/Brushes/Basic/CelVinyl/CelVinyl.shader @@ -46,8 +46,8 @@ Shader "Brush/Special/CelVinyl" { fixed4 _Color; float _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -89,9 +89,10 @@ Shader "Brush/Special/CelVinyl" { fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, i.texcoord) * i.color; UNITY_APPLY_FOG(i.fogCoord, tex); diff --git a/Assets/Resources/Brushes/Basic/ChromaticWave/ChromaticWave.shader b/Assets/Resources/Brushes/Basic/ChromaticWave/ChromaticWave.shader index 3908ce9d33..89dc3f06d6 100644 --- a/Assets/Resources/Brushes/Basic/ChromaticWave/ChromaticWave.shader +++ b/Assets/Resources/Brushes/Basic/ChromaticWave/ChromaticWave.shader @@ -16,7 +16,6 @@ Shader "Brush/Visualizer/RainbowTube" { Properties { _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -49,15 +48,14 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -100,9 +98,11 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif // Envelope float envelope = sin(i.texcoord.x * 3.14159); diff --git a/Assets/Resources/Brushes/Basic/Comet/Comet.shader b/Assets/Resources/Brushes/Basic/Comet/Comet.shader index f81221f411..114ef25865 100644 --- a/Assets/Resources/Brushes/Basic/Comet/Comet.shader +++ b/Assets/Resources/Brushes/Basic/Comet/Comet.shader @@ -19,7 +19,6 @@ Properties { _Speed ("Animation Speed", Range (0,1)) = 1 _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -47,8 +46,8 @@ Category { #pragma multi_compile __ HDR_EMULATED HDR_SIMPLE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #pragma multi_compile __ SELECTION_ON + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -60,8 +59,8 @@ Category { float _Speed; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -109,9 +108,10 @@ Category { fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif // Set up some staggered scrolling for "fire" effect #ifdef AUDIO_REACTIVE diff --git a/Assets/Resources/Brushes/Basic/DanceFloor/DanceFloor.shader b/Assets/Resources/Brushes/Basic/DanceFloor/DanceFloor.shader index 438011b820..aadff6fb13 100644 --- a/Assets/Resources/Brushes/Basic/DanceFloor/DanceFloor.shader +++ b/Assets/Resources/Brushes/Basic/DanceFloor/DanceFloor.shader @@ -17,7 +17,7 @@ Properties { _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) _MainTex ("Particle Texture", 2D) = "white" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -46,8 +46,8 @@ Category { #pragma multi_compile __ HDR_EMULATED HDR_SIMPLE #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" @@ -55,8 +55,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -123,9 +123,10 @@ Category { fixed4 frag (v2f i) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif //float waveform = tex2D(_WaveFormTex, float2(fmod(i.worldPos.x * 0.1f + GetTime().y,1),0) ).r - .5f; //i.texcoord.y += waveform; diff --git a/Assets/Resources/Brushes/Basic/DiamondHull/DiamondHull.shader b/Assets/Resources/Brushes/Basic/DiamondHull/DiamondHull.shader index d67d448bd9..ece57e1856 100644 --- a/Assets/Resources/Brushes/Basic/DiamondHull/DiamondHull.shader +++ b/Assets/Resources/Brushes/Basic/DiamondHull/DiamondHull.shader @@ -16,7 +16,7 @@ Shader "Brush/Special/DiamondHull" { Properties { _MainTex("Texture", 2D) = "white" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -39,15 +39,15 @@ Shader "Brush/Special/DiamondHull" { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #pragma multi_compile __ SELECTION_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -182,8 +182,10 @@ Shader "Brush/Special/DiamondHull" { // Input color is srgb void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.vertex.xy) >= _Dissolve) discard; + #endif // Hardcode some shiny specular values o.Smoothness = .8; diff --git a/Assets/Resources/Brushes/Basic/Disco/Disco.shader b/Assets/Resources/Brushes/Basic/Disco/Disco.shader index ad3482517d..5b7f6d473f 100644 --- a/Assets/Resources/Brushes/Basic/Disco/Disco.shader +++ b/Assets/Resources/Brushes/Basic/Disco/Disco.shader @@ -20,7 +20,7 @@ Shader "Brush/Disco" { _MainTex ("Base (RGB) TransGloss (A)", 2D) = "white" {} _BumpMap ("Normalmap", 2D) = "bump" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -38,8 +38,9 @@ Shader "Brush/Disco" { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #pragma multi_compile __ SELECTION_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" + #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/MobileSelection.cginc" struct Input { @@ -69,8 +70,8 @@ Shader "Brush/Disco" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert (inout appdata_full_plus_id v, out Input o) { @@ -103,8 +104,10 @@ Shader "Brush/Disco" { // Input color is _native_ void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = tex.rgb * _Color.rgb * IN.color.rgb; diff --git a/Assets/Resources/Brushes/Basic/Dots/Dots.shader b/Assets/Resources/Brushes/Basic/Dots/Dots.shader index 6cc7fbea21..fd5e1a5a07 100644 --- a/Assets/Resources/Brushes/Basic/Dots/Dots.shader +++ b/Assets/Resources/Brushes/Basic/Dots/Dots.shader @@ -56,8 +56,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct v2f { @@ -112,9 +112,11 @@ Category { // Input color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif #ifdef AUDIO_REACTIVE // Deform uv's by waveform displacement amount vertically diff --git a/Assets/Resources/Brushes/Basic/DoubleTaperedFlat/DiffuseNoTextureDoubleSided.shader b/Assets/Resources/Brushes/Basic/DoubleTaperedFlat/DiffuseNoTextureDoubleSided.shader index bc7e8b7547..f4795716f3 100644 --- a/Assets/Resources/Brushes/Basic/DoubleTaperedFlat/DiffuseNoTextureDoubleSided.shader +++ b/Assets/Resources/Brushes/Basic/DoubleTaperedFlat/DiffuseNoTextureDoubleSided.shader @@ -37,8 +37,8 @@ SubShader { fixed4 _Color; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -80,8 +80,10 @@ SubShader { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = _Color; o.Normal = float3(0,0,IN.vface); diff --git a/Assets/Resources/Brushes/Basic/DoubleTaperedMarker/DoubleTaperedMarker.shader b/Assets/Resources/Brushes/Basic/DoubleTaperedMarker/DoubleTaperedMarker.shader index dec3645ad4..1a48824675 100644 --- a/Assets/Resources/Brushes/Basic/DoubleTaperedMarker/DoubleTaperedMarker.shader +++ b/Assets/Resources/Brushes/Basic/DoubleTaperedMarker/DoubleTaperedMarker.shader @@ -43,8 +43,8 @@ Category { sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -94,8 +94,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif UNITY_APPLY_FOG(i.fogCoord, i.color.rgb); float4 color = float4(i.color.rgb, 1); diff --git a/Assets/Resources/Brushes/Basic/Electricity/Electricity.shader b/Assets/Resources/Brushes/Basic/Electricity/Electricity.shader index 466d6e5464..23b0753cdb 100644 --- a/Assets/Resources/Brushes/Basic/Electricity/Electricity.shader +++ b/Assets/Resources/Brushes/Basic/Electricity/Electricity.shader @@ -18,7 +18,7 @@ Properties { _DisplacementIntensity("Displacement", Float) = .1 _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -31,8 +31,8 @@ Properties { CGINCLUDE #pragma multi_compile __ SELECTION_ON #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -59,8 +59,8 @@ CGINCLUDE half _DisplacementIntensity; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct v2f { @@ -164,9 +164,11 @@ CGINCLUDE // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // interior procedural line #if SHARP_AND_BLOOMY diff --git a/Assets/Resources/Brushes/Basic/Embers/Embers.shader b/Assets/Resources/Brushes/Basic/Embers/Embers.shader index 0f5a0bc5ce..506845f448 100644 --- a/Assets/Resources/Brushes/Basic/Embers/Embers.shader +++ b/Assets/Resources/Brushes/Basic/Embers/Embers.shader @@ -22,7 +22,7 @@ Properties { _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 _SpreadRate ("Spread Rate", Range(0.3, 5)) = 1.539 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -53,7 +53,6 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/Particles.cginc" @@ -63,8 +62,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct v2f { @@ -180,9 +179,11 @@ Category { // i.color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - // It's hard to get alpha curves right so use dithering for hdr shaders - if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + // It's hard to get alpha curves right so use dithering for hdr shaders + if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 texCol = tex2D(_MainTex, i.texcoord); float4 color = 2.0f * i.color * _TintColor * texCol; diff --git a/Assets/Resources/Brushes/Basic/Fire/Fire.shader b/Assets/Resources/Brushes/Basic/Fire/Fire.shader index 71f8f02e69..30d0c8d359 100644 --- a/Assets/Resources/Brushes/Basic/Fire/Fire.shader +++ b/Assets/Resources/Brushes/Basic/Fire/Fire.shader @@ -20,7 +20,7 @@ Properties { _DisplacementIntensity("Displacement", Float) = .1 _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -51,7 +51,6 @@ Category { #pragma multi_compile __ SELECTION_ON #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -93,8 +92,8 @@ Category { half _DisplacementIntensity; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata_t v) @@ -118,9 +117,11 @@ Category { // Note: input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - // It's hard to get alpha curves right so use dithering for hdr shaders - if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + // It's hard to get alpha curves right so use dithering for hdr shaders + if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif half2 displacement; float procedural_line = 0; diff --git a/Assets/Resources/Brushes/Basic/Highlighter/AdditiveCutout.shader b/Assets/Resources/Brushes/Basic/Highlighter/AdditiveCutout.shader index f7e6cfcf2b..ee3fb81238 100644 --- a/Assets/Resources/Brushes/Basic/Highlighter/AdditiveCutout.shader +++ b/Assets/Resources/Brushes/Basic/Highlighter/AdditiveCutout.shader @@ -65,8 +65,8 @@ Category { float4 _MainTex_ST; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -89,8 +89,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif half4 c = tex2D(_MainTex, i.texcoord ); diff --git a/Assets/Resources/Brushes/Basic/HyperGrid/HyperGrid.shader b/Assets/Resources/Brushes/Basic/HyperGrid/HyperGrid.shader index fdd05873a8..9ab4f98a99 100644 --- a/Assets/Resources/Brushes/Basic/HyperGrid/HyperGrid.shader +++ b/Assets/Resources/Brushes/Basic/HyperGrid/HyperGrid.shader @@ -17,7 +17,7 @@ Properties { _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) _MainTex ("Particle Texture", 2D) = "white" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -48,8 +48,8 @@ Category { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #pragma multi_compile __ SELECTION_ON + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" @@ -58,8 +58,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -126,8 +126,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif float4 c = i.color * _TintColor * tex2D(_MainTex, i.texcoord); c = encodeHdr(c.rgb * c.a); diff --git a/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorDoubleSided.shader b/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorDoubleSided.shader index 69c4840325..d6974349d5 100644 --- a/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorDoubleSided.shader +++ b/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorDoubleSided.shader @@ -21,7 +21,7 @@ Properties { _BumpMap ("Normalmap", 2D) = "bump" {} _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -43,7 +43,7 @@ Properties { #pragma multi_compile __ SELECTION_ON // Faster compiles #pragma skip_variants INSTANCING_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -75,8 +75,8 @@ Properties { half _Shininess; fixed _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert (inout appdata v, out Input o) { @@ -101,8 +101,10 @@ Properties { void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); diff --git a/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorSingleSided.shader b/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorSingleSided.shader index 6db54386a2..c65ecaf758 100644 --- a/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorSingleSided.shader +++ b/Assets/Resources/Brushes/Basic/Hypercolor/HypercolorSingleSided.shader @@ -21,7 +21,7 @@ Properties { _BumpMap ("Normalmap", 2D) = "bump" {} _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -36,7 +36,7 @@ Properties { #pragma surface surf StandardSpecular vertex:vert alphatest:_Cutoff addshadow #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM - #include "Assets/Shaders/Include/TimeOverride.cginc" + #include "Assets/Shaders/Include/Brush.cginc" struct Input { diff --git a/Assets/Resources/Brushes/Basic/LightWire/LightWire.shader b/Assets/Resources/Brushes/Basic/LightWire/LightWire.shader index d0406b2b22..1dd5be958e 100644 --- a/Assets/Resources/Brushes/Basic/LightWire/LightWire.shader +++ b/Assets/Resources/Brushes/Basic/LightWire/LightWire.shader @@ -20,7 +20,7 @@ Shader "Brush/Special/LightWire" { _MainTex ("Base (RGB) TransGloss (A)", 2D) = "white" {} _BumpMap ("Normalmap", 2D) = "bump" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -38,7 +38,7 @@ Shader "Brush/Special/LightWire" { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #pragma multi_compile __ SELECTION_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -54,8 +54,8 @@ Shader "Brush/Special/LightWire" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_full_plus_id { @@ -95,8 +95,10 @@ Shader "Brush/Special/LightWire" { // Input color is srgb void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif float envelope = sin ( fmod ( IN.uv_MainTex.x*2, 1.0f) * 3.14159); float lights = envelope < .1 ? 1 : 0; diff --git a/Assets/Resources/Brushes/Basic/Petal/Petal.shader b/Assets/Resources/Brushes/Basic/Petal/Petal.shader index a60fc4dd56..7d1db9eb35 100644 --- a/Assets/Resources/Brushes/Basic/Petal/Petal.shader +++ b/Assets/Resources/Brushes/Basic/Petal/Petal.shader @@ -46,8 +46,8 @@ Shader "Brush/Special/Petal" { half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_full_plus_id { @@ -72,8 +72,10 @@ Shader "Brush/Special/Petal" { void surf(Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif // Fade from center outward (dark to light) float4 darker_color = IN.color; diff --git a/Assets/Resources/Brushes/Basic/Plasma/Plasma.shader b/Assets/Resources/Brushes/Basic/Plasma/Plasma.shader index c611fa338d..f954911730 100644 --- a/Assets/Resources/Brushes/Basic/Plasma/Plasma.shader +++ b/Assets/Resources/Brushes/Basic/Plasma/Plasma.shader @@ -25,7 +25,7 @@ Properties { _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -58,15 +58,14 @@ Category { #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -124,8 +123,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // Workaround for b/30500118, caused by b/30504121 i.color.a = saturate(i.color.a); diff --git a/Assets/Resources/Brushes/Basic/Rainbow/Rainbow.shader b/Assets/Resources/Brushes/Basic/Rainbow/Rainbow.shader index 19bdbedb2a..0cedd8b18d 100644 --- a/Assets/Resources/Brushes/Basic/Rainbow/Rainbow.shader +++ b/Assets/Resources/Brushes/Basic/Rainbow/Rainbow.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -42,16 +42,16 @@ Category { #pragma multi_compile __ SELECTION_ON #pragma target 3.0 + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -188,9 +188,11 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif i.color.a = 1; //ignore incoming vert alpha #ifdef AUDIO_REACTIVE diff --git a/Assets/Resources/Brushes/Basic/Smoke/Smoke.shader b/Assets/Resources/Brushes/Basic/Smoke/Smoke.shader index 7055391ded..37fda1d097 100644 --- a/Assets/Resources/Brushes/Basic/Smoke/Smoke.shader +++ b/Assets/Resources/Brushes/Basic/Smoke/Smoke.shader @@ -18,7 +18,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _ScrollRate("Scroll Rate", Float) = 1.0 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -48,7 +48,6 @@ Category { #pragma multi_compile __ SELECTION_ON #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Particles.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" @@ -69,8 +68,8 @@ Category { float4 _MainTex_ST; float _ScrollRate; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -137,8 +136,10 @@ Category { fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif float4 c = tex2D(_MainTex, i.texcoord); c *= i.color * _TintColor; diff --git a/Assets/Resources/Brushes/Basic/Snow/Snow.shader b/Assets/Resources/Brushes/Basic/Snow/Snow.shader index a752ec5e91..e6d8d92359 100644 --- a/Assets/Resources/Brushes/Basic/Snow/Snow.shader +++ b/Assets/Resources/Brushes/Basic/Snow/Snow.shader @@ -22,7 +22,7 @@ Properties { _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 _SpreadRate ("Spread Rate", Range(0.3, 5)) = 1.539 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -53,7 +53,6 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Particles.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -61,8 +60,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -127,8 +126,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 texCol = tex2D(_MainTex, i.texcoord); float4 color = SrgbToNative(2.0f * i.color * _TintColor * texCol); diff --git a/Assets/Resources/Brushes/Basic/SoftHighlighter/SoftHighlighter.shader b/Assets/Resources/Brushes/Basic/SoftHighlighter/SoftHighlighter.shader index 8ad50bde6d..aa3178d341 100644 --- a/Assets/Resources/Brushes/Basic/SoftHighlighter/SoftHighlighter.shader +++ b/Assets/Resources/Brushes/Basic/SoftHighlighter/SoftHighlighter.shader @@ -44,8 +44,8 @@ Category { sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -98,8 +98,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif float4 c = tex2D(_MainTex, i.texcoord ); c *= i.color; diff --git a/Assets/Resources/Brushes/Basic/Stars/Stars.shader b/Assets/Resources/Brushes/Basic/Stars/Stars.shader index c15b692d47..5abc88db94 100644 --- a/Assets/Resources/Brushes/Basic/Stars/Stars.shader +++ b/Assets/Resources/Brushes/Basic/Stars/Stars.shader @@ -18,7 +18,7 @@ Properties { _SparkleRate ("Sparkle Rate", Float) = 2.5 _SpreadRate ("Spread Rate", Range(0.3, 5)) = 1.539 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -50,7 +50,6 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/Particles.cginc" @@ -61,8 +60,8 @@ Category { float _SparkleRate; float _SpreadRate; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct v2f { @@ -114,9 +113,11 @@ Category { // Input color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - // It's hard to get alpha curves right so use dithering for hdr shaders - if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + // It's hard to get alpha curves right so use dithering for hdr shaders + if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 texCol = tex2D(_MainTex, i.texcoord); float4 color = i.color * texCol; diff --git a/Assets/Resources/Brushes/Basic/Streamers/Streamers.shader b/Assets/Resources/Brushes/Basic/Streamers/Streamers.shader index 23ffd28872..bd8a0c6680 100644 --- a/Assets/Resources/Brushes/Basic/Streamers/Streamers.shader +++ b/Assets/Resources/Brushes/Basic/Streamers/Streamers.shader @@ -20,7 +20,7 @@ Properties { _DisplacementIntensity("Displacement", Float) = .1 _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -52,15 +52,14 @@ Category { #pragma target 3.0 // Required -> compiler error: too many instructions for SM 2.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -117,9 +116,11 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif // Create parametric flowing UV's half2 uvs = i.texcoord; diff --git a/Assets/Resources/Brushes/Basic/Toon/Toon.shader b/Assets/Resources/Brushes/Basic/Toon/Toon.shader index 5b9c820a80..128d7f3e22 100644 --- a/Assets/Resources/Brushes/Basic/Toon/Toon.shader +++ b/Assets/Resources/Brushes/Basic/Toon/Toon.shader @@ -36,8 +36,8 @@ CGINCLUDE float4 _MainTex_ST; float _OutlineMax; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -133,8 +133,10 @@ CGINCLUDE fixed4 fragBlack (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif float4 color = float4(0,0,0,1); UNITY_APPLY_FOG(i.fogCoord, color); @@ -144,8 +146,10 @@ CGINCLUDE fixed4 fragColor (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif UNITY_APPLY_FOG(i.fogCoord, i.color); FRAG_MOBILESELECT(i.color) diff --git a/Assets/Resources/Brushes/Basic/TubeToonInverted/TubeToonInverted.shader b/Assets/Resources/Brushes/Basic/TubeToonInverted/TubeToonInverted.shader index 408f3f14ba..ed2b442bba 100644 --- a/Assets/Resources/Brushes/Basic/TubeToonInverted/TubeToonInverted.shader +++ b/Assets/Resources/Brushes/Basic/TubeToonInverted/TubeToonInverted.shader @@ -31,8 +31,8 @@ CGINCLUDE sampler2D _MainTex; float4 _MainTex_ST; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -90,15 +90,19 @@ CGINCLUDE fixed4 fragBlack (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif return float4(0,0,0,1); } fixed4 fragColor (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif return i.color; } diff --git a/Assets/Resources/Brushes/Basic/VelvetInk/VelvetInk.shader b/Assets/Resources/Brushes/Basic/VelvetInk/VelvetInk.shader index 3acdde3747..8f8b992377 100644 --- a/Assets/Resources/Brushes/Basic/VelvetInk/VelvetInk.shader +++ b/Assets/Resources/Brushes/Basic/VelvetInk/VelvetInk.shader @@ -44,8 +44,8 @@ Category { sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -96,8 +96,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif half4 c = tex2D(_MainTex, i.texcoord ); c = i.color * c; diff --git a/Assets/Resources/Brushes/Basic/Waveform/Waveform.shader b/Assets/Resources/Brushes/Basic/Waveform/Waveform.shader index 98160ddf3c..dcc6441ac5 100644 --- a/Assets/Resources/Brushes/Basic/Waveform/Waveform.shader +++ b/Assets/Resources/Brushes/Basic/Waveform/Waveform.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -49,7 +49,6 @@ Category { #pragma multi_compile __ SELECTION_ON #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -58,8 +57,8 @@ Category { float4 _MainTex_ST; float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -103,9 +102,11 @@ Category { // Input colors are srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif // Envelope float envelope = sin(i.texcoord.x * 3.14159); diff --git a/Assets/Resources/Brushes/Basic/WaveformFFT/WaveformFFT.shader b/Assets/Resources/Brushes/Basic/WaveformFFT/WaveformFFT.shader index e575ee03fd..39e74e1cd9 100644 --- a/Assets/Resources/Brushes/Basic/WaveformFFT/WaveformFFT.shader +++ b/Assets/Resources/Brushes/Basic/WaveformFFT/WaveformFFT.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -48,7 +48,6 @@ Category { #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" @@ -56,8 +55,8 @@ Category { float4 _MainTex_ST; float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -99,9 +98,10 @@ Category { fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // Envelope float envelope = 1; //sin(i.texcoord.x * 3.14159); diff --git a/Assets/Resources/Brushes/Basic/WaveformParticles/WaveformParticles.shader b/Assets/Resources/Brushes/Basic/WaveformParticles/WaveformParticles.shader index 85b21b8fcb..123a518f96 100644 --- a/Assets/Resources/Brushes/Basic/WaveformParticles/WaveformParticles.shader +++ b/Assets/Resources/Brushes/Basic/WaveformParticles/WaveformParticles.shader @@ -17,7 +17,7 @@ Properties { _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) _MainTex ("Particle Texture", 2D) = "white" {} - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -47,8 +47,8 @@ Category { #pragma multi_compile __ HDR_EMULATED HDR_SIMPLE #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" @@ -57,8 +57,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -129,8 +129,10 @@ Category { fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 c = i.color * _TintColor * tex2D(_MainTex, i.texcoord); c = encodeHdr(c.rgb * c.a); diff --git a/Assets/Resources/Brushes/Basic/WaveformPulse/NeonPulse.shader b/Assets/Resources/Brushes/Basic/WaveformPulse/NeonPulse.shader index b3906f4d81..1f975b1dfd 100644 --- a/Assets/Resources/Brushes/Basic/WaveformPulse/NeonPulse.shader +++ b/Assets/Resources/Brushes/Basic/WaveformPulse/NeonPulse.shader @@ -15,14 +15,11 @@ Shader "Brush/Visualizer/WaveformPulse" { Properties { - _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - - [Toggle] _OverrideTime ("Overriden Time", Float) = 1.0 + _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 - - _Dissolve("Dissolve", Range(0, 1)) = 1 + _Dissolve("Dissolve", Range(0, 1)) = 1 _ClipStart("Clip Start", Float) = 0 _ClipEnd("Clip End", Float) = -1 } @@ -42,7 +39,6 @@ SubShader { // Faster compiles #pragma skip_variants INSTANCING_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -70,8 +66,8 @@ SubShader { float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert (inout appdata i, out Input o) { @@ -84,9 +80,11 @@ SubShader { // Input color is srgb void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif o.Smoothness = .8; o.Specular = .05; diff --git a/Assets/Resources/Brushes/Basic/WaveformTube/WaveformTube.shader b/Assets/Resources/Brushes/Basic/WaveformTube/WaveformTube.shader index 93ea86e00e..05b83472cd 100644 --- a/Assets/Resources/Brushes/Basic/WaveformTube/WaveformTube.shader +++ b/Assets/Resources/Brushes/Basic/WaveformTube/WaveformTube.shader @@ -48,8 +48,8 @@ Category { float4 _MainTex_ST; float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -90,9 +90,10 @@ Category { fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif i.texcoord.x -= _BeatOutputAccum.x; i.texcoord.y += i.texcoord.x; diff --git a/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteDoubleSided.shader b/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteDoubleSided.shader index e829df35f3..95426c5fe9 100644 --- a/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteDoubleSided.shader +++ b/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteDoubleSided.shader @@ -18,7 +18,7 @@ Shader "Brush/Special/WigglyGraphiteDoubleSided" { _SecondaryTex("Diffuse Tex", 2D) = "white" {} _Cutoff("Alpha cutoff", Range(0,1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -41,7 +41,6 @@ Shader "Brush/Special/WigglyGraphiteDoubleSided" { // Faster compiles #pragma skip_variants INSTANCING_ON - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" #include "Assets/Shaders/Include/MobileSelection.cginc" @@ -70,8 +69,8 @@ Shader "Brush/Special/WigglyGraphiteDoubleSided" { sampler2D _MainTex; float _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert(inout appdata i, out Input o) { @@ -84,8 +83,10 @@ Shader "Brush/Special/WigglyGraphiteDoubleSided" { void surf(Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed2 scrollUV = IN.uv_MainTex; diff --git a/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteSingleSided.shader b/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteSingleSided.shader index f3b7d5e52c..dec6a156de 100644 --- a/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteSingleSided.shader +++ b/Assets/Resources/Brushes/Basic/WigglyGraphite/WigglyGraphiteSingleSided.shader @@ -18,7 +18,7 @@ Shader "Brush/Special/WigglyGraphiteSingleSided" { _SecondaryTex("Diffuse Tex", 2D) = "white" {} _Cutoff("Alpha cutoff", Range(0,1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -34,7 +34,6 @@ Shader "Brush/Special/WigglyGraphiteSingleSided" { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" diff --git a/Assets/Resources/Brushes/Basic/Wireframe/Wireframe.shader b/Assets/Resources/Brushes/Basic/Wireframe/Wireframe.shader index 981eb3707f..e43ff9ead0 100644 --- a/Assets/Resources/Brushes/Basic/Wireframe/Wireframe.shader +++ b/Assets/Resources/Brushes/Basic/Wireframe/Wireframe.shader @@ -58,8 +58,8 @@ Category { float4 _MainTex_ST; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -82,8 +82,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif half w = 0; #ifdef AUDIO_REACTIVE diff --git a/Assets/Resources/Brushes/Shared/Shaders/Additive.shader b/Assets/Resources/Brushes/Shared/Shaders/Additive.shader index 3ee5719b67..d59711f492 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Additive.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Additive.shader @@ -47,8 +47,8 @@ Category { sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -96,8 +96,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif half4 c = tex2D(_MainTex, i.texcoord); c = i.color * c; diff --git a/Assets/Resources/Brushes/Shared/Shaders/Bloom.shader b/Assets/Resources/Brushes/Shared/Shaders/Bloom.shader index d51a4fd13b..3670aa2901 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Bloom.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Bloom.shader @@ -47,8 +47,8 @@ Category { float4 _MainTex_ST; float _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -92,9 +92,11 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; // It's hard to get alpha curves right so use dithering for hdr shaders if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif float4 color = i.color * tex2D(_MainTex, i.texcoord); color = float4(color.rgb * color.a, 1.0); diff --git a/Assets/Resources/Brushes/Shared/Shaders/DiffuseDoubleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/DiffuseDoubleSided.shader index c4efa18eb9..72f92f5212 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/DiffuseDoubleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/DiffuseDoubleSided.shader @@ -42,8 +42,8 @@ sampler2D _MainTex; fixed4 _Color; fixed _Cutoff; -uniform float _ClipStart; -uniform float _ClipEnd; +uniform half _ClipStart; +uniform half _ClipEnd; uniform half _Dissolve; struct appdata { @@ -90,8 +90,10 @@ void vert (inout appdata_full_plus_id v, out Input o) { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; @@ -123,8 +125,8 @@ CGPROGRAM sampler2D _MainTex; fixed4 _Color; -uniform float _ClipStart; -uniform float _ClipEnd; +uniform half _ClipStart; +uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -158,8 +160,10 @@ void vert (inout appdata_full_plus_id v, out Input o) { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; diff --git a/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueDoubleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueDoubleSided.shader index c069b57670..155cb6f768 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueDoubleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueDoubleSided.shader @@ -39,8 +39,8 @@ SubShader { fixed4 _Color; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata { @@ -74,8 +74,10 @@ SubShader { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif o.Albedo = _Color * IN.color.rgb; o.Normal = float3(0,0,IN.vface); diff --git a/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueSingleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueSingleSided.shader index 6dee007223..093df8ad99 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueSingleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/DiffuseOpaqueSingleSided.shader @@ -37,8 +37,8 @@ SubShader { #include "Assets/Shaders/Include/MobileSelection.cginc" fixed4 _Color; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -69,8 +69,10 @@ SubShader { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif o.Albedo = _Color * IN.color.rgb; SURF_FRAG_MOBILESELECT(o); diff --git a/Assets/Resources/Brushes/Shared/Shaders/DiffuseSingleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/DiffuseSingleSided.shader index c80c47899f..6004a7989e 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/DiffuseSingleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/DiffuseSingleSided.shader @@ -39,8 +39,8 @@ CGPROGRAM sampler2D _MainTex; fixed4 _Color; -uniform float _ClipStart; -uniform float _ClipEnd; +uniform half _ClipStart; +uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -72,8 +72,10 @@ void vert (inout appdata_full_plus_id v, out Input o) { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; @@ -99,8 +101,8 @@ CGPROGRAM sampler2D _MainTex; fixed4 _Color; -uniform float _ClipStart; -uniform float _ClipEnd; +uniform half _ClipStart; +uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -133,8 +135,10 @@ void vert (inout appdata_full_plus_id v, out Input o) { void surf (Input IN, inout SurfaceOutput o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; diff --git a/Assets/Resources/Brushes/Shared/Shaders/Multiplicative.shader b/Assets/Resources/Brushes/Shared/Shaders/Multiplicative.shader index 1b7e5690c4..9e4d7b697e 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Multiplicative.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Multiplicative.shader @@ -62,8 +62,8 @@ Category { float4 _MainTex_ST; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -86,8 +86,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif half4 c = tex2D(_MainTex, i.texcoord ); c = i.color * c; diff --git a/Assets/Resources/Brushes/Shared/Shaders/Special/AdditiveScrolling.shader b/Assets/Resources/Brushes/Shared/Shaders/Special/AdditiveScrolling.shader index 47635e2f38..0b035fa1f6 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Special/AdditiveScrolling.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Special/AdditiveScrolling.shader @@ -22,7 +22,7 @@ Properties { _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 _FalloffPower("Falloff Power", Float) = 2.0 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -43,7 +43,6 @@ Category { #pragma fragment frag #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" sampler2D _MainTex; diff --git a/Assets/Resources/Brushes/Shared/Shaders/Special/Faceted.shader b/Assets/Resources/Brushes/Shared/Shaders/Special/Faceted.shader index fb9f347b05..40162a495a 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Special/Faceted.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Special/Faceted.shader @@ -42,8 +42,8 @@ SubShader { fixed4 _ColorY; fixed4 _ColorZ; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -85,8 +85,10 @@ SubShader { fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float3 n = normalize(cross(ddy(i.worldPos), ddx(i.worldPos))); i.color.xyz = float3( diff --git a/Assets/Resources/Brushes/Shared/Shaders/StandardDoubleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/StandardDoubleSided.shader index c0839c6ab2..9d0f9bb766 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/StandardDoubleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/StandardDoubleSided.shader @@ -69,8 +69,8 @@ Properties { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert (inout appdata_full_plus_id i, out Input o) { @@ -82,9 +82,10 @@ Properties { } void surf (Input IN, inout SurfaceOutputStandardSpecular o) { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = tex.rgb * _Color.rgb * IN.color.rgb; @@ -150,8 +151,8 @@ Properties { fixed _Cutoff; half _MipScale; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; float ComputeMipLevel(float2 uv) { @@ -179,9 +180,10 @@ Properties { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = tex2D(_MainTex, i.uv).a * col.a; @@ -262,8 +264,8 @@ Properties { half _Shininess; fixed _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata v) { @@ -286,9 +288,10 @@ Properties { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - + if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = tex2D(_MainTex, i.uv).a * col.a; @@ -382,8 +385,8 @@ Properties { fixed _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata v) { @@ -404,9 +407,10 @@ Properties { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - + if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = tex2D(_MainTex, i.uv).a * col.a; @@ -478,8 +482,8 @@ Properties { fixed _Cutoff; half _MipScale; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; float ComputeMipLevel(float2 uv) { @@ -499,9 +503,10 @@ Properties { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a *= tex2D(_MainTex, i.uv).a; @@ -575,8 +580,8 @@ Properties { fixed _Cutoff; half _MipScale; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; float ComputeMipLevel(float2 uv) { @@ -596,9 +601,10 @@ Properties { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = 1; @@ -634,8 +640,8 @@ Properties { sampler2D _MainTex; fixed4 _Color; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -665,9 +671,10 @@ Properties { } void surf (Input IN, inout SurfaceOutput o) { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; diff --git a/Assets/Resources/Brushes/Shared/Shaders/StandardSingleSided.shader b/Assets/Resources/Brushes/Shared/Shaders/StandardSingleSided.shader index 1474ef518d..1394ef8d1e 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/StandardSingleSided.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/StandardSingleSided.shader @@ -68,8 +68,8 @@ Shader "Brush/StandardSingleSided" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; void vert (inout appdata_full_plus_id i, out Input o) { @@ -81,9 +81,10 @@ Shader "Brush/StandardSingleSided" { } void surf (Input IN, inout SurfaceOutputStandardSpecular o) { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = tex.rgb * _Color.rgb * IN.color.rgb; @@ -147,8 +148,8 @@ Shader "Brush/StandardSingleSided" { fixed _Cutoff; half _MipScale; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; float ComputeMipLevel(float2 uv) { @@ -176,9 +177,10 @@ Shader "Brush/StandardSingleSided" { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = tex2D(_MainTex, i.uv).a * col.a; @@ -259,8 +261,8 @@ Shader "Brush/StandardSingleSided" { half _Shininess; fixed _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata v) { @@ -283,9 +285,10 @@ Shader "Brush/StandardSingleSided" { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; - + if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a = tex2D(_MainTex, i.uv).a * col.a; @@ -365,8 +368,8 @@ Shader "Brush/StandardSingleSided" { fixed _Cutoff; half _MipScale; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; float ComputeMipLevel(float2 uv) { @@ -386,9 +389,10 @@ Shader "Brush/StandardSingleSided" { } fixed4 frag (v2f i, fixed vface : VFACE) : SV_Target { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 col = i.color; col.a *= tex2D(_MainTex, i.uv).a; @@ -426,8 +430,8 @@ Shader "Brush/StandardSingleSided" { sampler2D _MainTex; fixed4 _Color; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -441,9 +445,10 @@ Shader "Brush/StandardSingleSided" { } void surf (Input IN, inout SurfaceOutput o) { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb * IN.color.rgb; diff --git a/Assets/Resources/Brushes/Shared/Shaders/Unlit.shader b/Assets/Resources/Brushes/Shared/Shaders/Unlit.shader index 6039a691b3..8ecd38a693 100644 --- a/Assets/Resources/Brushes/Shared/Shaders/Unlit.shader +++ b/Assets/Resources/Brushes/Shared/Shaders/Unlit.shader @@ -42,8 +42,8 @@ SubShader { sampler2D _MainTex; float _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -85,8 +85,10 @@ SubShader { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif fixed4 c; UNITY_APPLY_FOG(i.fogCoord, i.color); diff --git a/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua b/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua new file mode 100644 index 0000000000..b867da84ae --- /dev/null +++ b/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua @@ -0,0 +1,29 @@ +Settings = { + description="Creates a missile that follows a ballistic trajectory", + space="canvas" +} + +Parameters = { + initialSpeed={label="Initial Speed", type="float", min=0.1, max=5, default=2}, + gravity={label="Gravity", type="float", min=0.01, max=1, default=0.1}, +} + +function Main() + if Brush.triggerPressedThisFrame then + -- Store initial position, rotation, and velocity + currentPos = Brush.position + currentRotation = Brush.rotation + velocity = Brush.direction * Parameters.initialSpeed + elseif Brush.triggerIsPressed then + -- Apply gravity to velocity + velocity = velocity - Vector3.up * Parameters.gravity + + -- Update position based on velocity + currentPos = currentPos + velocity + + -- Update rotation to face the direction of movement + currentRotation = Quaternion.LookRotation(velocity.normalized, Vector3.up) + + return Transform:New(currentPos, currentRotation) + end +end \ No newline at end of file diff --git a/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua.meta b/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua.meta new file mode 100644 index 0000000000..da9be5e748 --- /dev/null +++ b/Assets/Resources/LuaScriptExamples/PointerScript.BallisticMissile.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 67d150dc995f2d740bbba7c440cbfad5 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 2d1920d65e755cf4f98a93b4a4e952e5, type: 3} diff --git a/Assets/Resources/X/Brushes/BubbleWand/BubbleWand.shader b/Assets/Resources/X/Brushes/BubbleWand/BubbleWand.shader index 338e39a0b4..c0b71c7e9e 100644 --- a/Assets/Resources/X/Brushes/BubbleWand/BubbleWand.shader +++ b/Assets/Resources/X/Brushes/BubbleWand/BubbleWand.shader @@ -19,7 +19,7 @@ Properties { _ScrollJitterIntensity("Scroll Jitter Intensity", Float) = 1.0 _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -40,8 +40,8 @@ Properties { #pragma surface surf StandardSpecular vertex:vert #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" sampler2D _MainTex; @@ -50,8 +50,8 @@ Properties { float _ScrollJitterIntensity; float _ScrollJitterFrequency; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -121,8 +121,10 @@ Properties { // Input color is srgb void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif // Hardcode some shiny specular values o.Smoothness = .9; diff --git a/Assets/Resources/X/Brushes/Digital/Digital.shader b/Assets/Resources/X/Brushes/Digital/Digital.shader index 8ab6e269e5..7c7ceb06de 100644 --- a/Assets/Resources/X/Brushes/Digital/Digital.shader +++ b/Assets/Resources/X/Brushes/Digital/Digital.shader @@ -50,8 +50,8 @@ Category { sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -108,8 +108,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float stroke_width = .1; float antialias_feather_px = 4; diff --git a/Assets/Resources/X/Brushes/Drafting/Drafting.shader b/Assets/Resources/X/Brushes/Drafting/Drafting.shader index 37be3af96b..a1d4210d0b 100644 --- a/Assets/Resources/X/Brushes/Drafting/Drafting.shader +++ b/Assets/Resources/X/Brushes/Drafting/Drafting.shader @@ -47,8 +47,8 @@ Shader "Brush/Special/Drafting" { uniform float _DraftingVisibility01; sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -89,8 +89,10 @@ Shader "Brush/Special/Drafting" { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif half4 c = i.color * tex2D(_MainTex, i.texcoord ); c = encodeHdr(c.rgb * c.a * _Opacity); diff --git a/Assets/Resources/X/Brushes/Fairy/Fairy.shader b/Assets/Resources/X/Brushes/Fairy/Fairy.shader index 5a4f78d857..8b3a4652df 100644 --- a/Assets/Resources/X/Brushes/Fairy/Fairy.shader +++ b/Assets/Resources/X/Brushes/Fairy/Fairy.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -46,15 +46,14 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" sampler2D _MainTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -100,9 +99,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; - + #endif float scale1 = 3; float scale2 = 3; diff --git a/Assets/Resources/X/Brushes/Fire 2/Fire2.shader b/Assets/Resources/X/Brushes/Fire 2/Fire2.shader index 0f08f81fb5..19c1a7f17b 100644 --- a/Assets/Resources/X/Brushes/Fire 2/Fire2.shader +++ b/Assets/Resources/X/Brushes/Fire 2/Fire2.shader @@ -25,7 +25,7 @@ Properties { _FlameFadeMin ("Fade Flame Min", Float) = 1 _FlameFadeMax ("Fade Flame Max", Float) = 30 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -55,15 +55,14 @@ Category { #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" sampler2D _MainTex; sampler2D _DisplaceTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -127,9 +126,10 @@ Category { // Note: input color is srgb fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif half2 displacement; float procedural_line = 0; diff --git a/Assets/Resources/X/Brushes/KeijiroTube/KeijiroTube.shader b/Assets/Resources/X/Brushes/KeijiroTube/KeijiroTube.shader index c5cd3cf05f..f0ccd39d9a 100644 --- a/Assets/Resources/X/Brushes/KeijiroTube/KeijiroTube.shader +++ b/Assets/Resources/X/Brushes/KeijiroTube/KeijiroTube.shader @@ -18,7 +18,7 @@ Properties { _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 0) _Shininess ("Shininess", Range (0.01, 1)) = 0.078125 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -37,14 +37,13 @@ Properties { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/Brush.cginc" fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -85,8 +84,10 @@ Properties { void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif o.Albedo = _Color.rgb * IN.color.rgb; o.Smoothness = _Shininess; diff --git a/Assets/Resources/X/Brushes/Lacewing/Lacewing.shader b/Assets/Resources/X/Brushes/Lacewing/Lacewing.shader index 8b081638a6..11d1a802ea 100644 --- a/Assets/Resources/X/Brushes/Lacewing/Lacewing.shader +++ b/Assets/Resources/X/Brushes/Lacewing/Lacewing.shader @@ -22,7 +22,7 @@ Shader "Brush/Special/Lacewing" { _BumpMap("Normalmap", 2D) = "bump" {} _Cutoff("Alpha cutoff", Range(0,1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -37,12 +37,13 @@ Shader "Brush/Special/Lacewing" { LOD 100 CGPROGRAM -#pragma target 4.0 -#pragma surface surf StandardSpecular vertex:vert alphatest:_Cutoff addshadow -#pragma multi_compile __ AUDIO_REACTIVE -#pragma multi_compile __ ODS_RENDER ODS_RENDER_CM -#include "Assets/Shaders/Include/TimeOverride.cginc" -#include "Assets/Shaders/Include/Brush.cginc" + + #pragma target 4.0 + #pragma surface surf StandardSpecular vertex:vert alphatest:_Cutoff addshadow + #pragma multi_compile __ AUDIO_REACTIVE + #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM + + #include "Assets/Shaders/Include/Brush.cginc" struct Input { float2 uv_MainTex; @@ -60,8 +61,8 @@ Shader "Brush/Special/Lacewing" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_full_plus_id { @@ -100,8 +101,10 @@ Shader "Brush/Special/Lacewing" { void surf(Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 spectex = tex2D(_SpecTex, IN.uv_SpecTex); fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); diff --git a/Assets/Resources/X/Brushes/LeakyPen/LeakyPen.shader b/Assets/Resources/X/Brushes/LeakyPen/LeakyPen.shader index 3fcf858d82..de8bb40e40 100644 --- a/Assets/Resources/X/Brushes/LeakyPen/LeakyPen.shader +++ b/Assets/Resources/X/Brushes/LeakyPen/LeakyPen.shader @@ -40,8 +40,8 @@ Shader "Brush/Special/LeakyPen" { sampler2D _MainTex; sampler2D _SecondaryTex; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -74,8 +74,10 @@ Shader "Brush/Special/LeakyPen" { void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif float3 secondary_tex = tex2D(_MainTex, IN.uv_SecondaryTex).rgb; diff --git a/Assets/Resources/X/Brushes/LoftedHueShift/LoftedHueShift.shader b/Assets/Resources/X/Brushes/LoftedHueShift/LoftedHueShift.shader index 6be32c1bde..939805ea91 100644 --- a/Assets/Resources/X/Brushes/LoftedHueShift/LoftedHueShift.shader +++ b/Assets/Resources/X/Brushes/LoftedHueShift/LoftedHueShift.shader @@ -47,8 +47,8 @@ Shader "Brush/LoftedHueShift" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_full_plus_id { @@ -72,8 +72,10 @@ Shader "Brush/LoftedHueShift" { void surf(Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 tex = tex2D(_MainTex, IN.uv_MainTex) * IN.color; diff --git a/Assets/Resources/X/Brushes/MarbledRainbow/MarbledRainbow.shader b/Assets/Resources/X/Brushes/MarbledRainbow/MarbledRainbow.shader index ed7c94994c..2b64bb3f3a 100644 --- a/Assets/Resources/X/Brushes/MarbledRainbow/MarbledRainbow.shader +++ b/Assets/Resources/X/Brushes/MarbledRainbow/MarbledRainbow.shader @@ -54,8 +54,8 @@ Shader "Brush/Special/MarbledRainbow" { fixed4 _Color; half _Shininess; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_full_plus_id { @@ -92,8 +92,10 @@ Shader "Brush/Special/MarbledRainbow" { void surf(Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif fixed4 spectex = tex2D(_SpecTex, IN.uv_SpecTex); fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); diff --git a/Assets/Resources/X/Brushes/MylarTube/MylarTube.shader b/Assets/Resources/X/Brushes/MylarTube/MylarTube.shader index 3f39c97c24..fa5730f665 100644 --- a/Assets/Resources/X/Brushes/MylarTube/MylarTube.shader +++ b/Assets/Resources/X/Brushes/MylarTube/MylarTube.shader @@ -20,7 +20,7 @@ Properties { _Shininess ("Shininess", Range (0.01, 1)) = 0.078125 _SqueezeAmount("Squeeze Amount", Range(0.0,1)) = 0.825 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -39,8 +39,8 @@ Category { #pragma surface surf StandardSpecular vertex:vert addshadow #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/ThirdParty/Shaders/Noise.cginc" sampler2D _MainTex; @@ -48,8 +48,8 @@ Category { half _Shininess; half _SqueezeAmount; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct Input { @@ -96,8 +96,10 @@ Category { // Input color is srgb void surf (Input IN, inout SurfaceOutputStandardSpecular o) { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy / IN.screenPos.w * _ScreenParams) >= _Dissolve) discard; + #endif o.Albedo = _Color.rgb * IN.color.rgb; //o.Emission = _Color.rgb * IN.color.rgb; diff --git a/Assets/Resources/X/Brushes/Race/Race.shader b/Assets/Resources/X/Brushes/Race/Race.shader index 49bcb4b154..1fb9d88072 100644 --- a/Assets/Resources/X/Brushes/Race/Race.shader +++ b/Assets/Resources/X/Brushes/Race/Race.shader @@ -73,8 +73,8 @@ Category { float4 _MainTex_ST; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -99,8 +99,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // copied from Digital.shader with a modification on the chance // that a tile will connect with its neighbor diff --git a/Assets/Resources/X/Brushes/Rain/Rain.shader b/Assets/Resources/X/Brushes/Rain/Rain.shader index 515c804378..2d6e5d7755 100644 --- a/Assets/Resources/X/Brushes/Rain/Rain.shader +++ b/Assets/Resources/X/Brushes/Rain/Rain.shader @@ -19,7 +19,7 @@ Properties { _Speed("Speed", Float) = 1 _Bulge("Displacement Amount", Float) = 2.25 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -51,8 +51,7 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" sampler2D _MainTex; @@ -61,8 +60,8 @@ Category { float _Speed; float _Bulge; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -124,8 +123,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float u_scale = _Speed; float t = fmod(GetTime().y * 4 * u_scale, u_scale); diff --git a/Assets/Resources/X/Brushes/RisingBubbles/RisingBubbles.shader b/Assets/Resources/X/Brushes/RisingBubbles/RisingBubbles.shader index af297bdaeb..7f2d9f9780 100644 --- a/Assets/Resources/X/Brushes/RisingBubbles/RisingBubbles.shader +++ b/Assets/Resources/X/Brushes/RisingBubbles/RisingBubbles.shader @@ -22,7 +22,7 @@ Properties { _ScrollJitterFrequency("Scroll Jitter Frequency", Float) = 1.0 _SpreadRate ("Spread Rate", Range(0.3, 5)) = 1.539 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -53,7 +53,6 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/Particles.cginc" @@ -62,8 +61,8 @@ Category { sampler2D _MainTex; fixed4 _TintColor; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -154,8 +153,10 @@ Category { // i.color is srgb fixed4 frag (v2f i) : SV_Target { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float4 tex = tex2D(_MainTex, i.texcoord); diff --git a/Assets/Resources/X/Brushes/Slice/Slice.shader b/Assets/Resources/X/Brushes/Slice/Slice.shader index 38e663520a..f7b9b70bf1 100644 --- a/Assets/Resources/X/Brushes/Slice/Slice.shader +++ b/Assets/Resources/X/Brushes/Slice/Slice.shader @@ -65,8 +65,8 @@ Category { float4 _MainTex_ST; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -92,8 +92,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif //float rubbishRand = random(i.texcoord.xz); //clip(rubbishRand-.9); diff --git a/Assets/Resources/X/Brushes/Space/Space.shader b/Assets/Resources/X/Brushes/Space/Space.shader index e2afd70eb0..641c5721f6 100644 --- a/Assets/Resources/X/Brushes/Space/Space.shader +++ b/Assets/Resources/X/Brushes/Space/Space.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Particle Texture", 2D) = "white" {} _EmissionGain ("Emission Gain", Range(0, 1)) = 0.5 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -46,7 +46,6 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" #include "Assets/Shaders/Include/ColorSpace.cginc" @@ -77,8 +76,8 @@ Category { float4 _MainTex_ST; half _EmissionGain; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata_t v) @@ -102,9 +101,10 @@ Category { // Input color is srgb fixed4 frag (v2f i) : COLOR { - + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif float analog_spread = .1; // how far the analogous hues are from the primary float gain = 10; diff --git a/Assets/Resources/X/Brushes/Sparks/Sparks.shader b/Assets/Resources/X/Brushes/Sparks/Sparks.shader index 2e55e5ade0..c8a12058a9 100644 --- a/Assets/Resources/X/Brushes/Sparks/Sparks.shader +++ b/Assets/Resources/X/Brushes/Sparks/Sparks.shader @@ -22,7 +22,7 @@ Properties { _NumSides ("Number of Sides", Float) = 5 _Speed ("Speed", Float) = 1 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -53,8 +53,7 @@ Category { #pragma target 3.0 #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" sampler2D _MainTex; @@ -86,8 +85,8 @@ Category { float _NumSides; float _Speed; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; v2f vert (appdata_t v) @@ -126,8 +125,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // Distort U coord to taste. This makes the effect to "slow down" towards the end of the stroke // by clumping UV's closer together toward the beginning of the stroke diff --git a/Assets/Resources/X/Brushes/TaperedHueShift/TaperedHueShift.shader b/Assets/Resources/X/Brushes/TaperedHueShift/TaperedHueShift.shader index d0418d9c49..3b67ee36bf 100644 --- a/Assets/Resources/X/Brushes/TaperedHueShift/TaperedHueShift.shader +++ b/Assets/Resources/X/Brushes/TaperedHueShift/TaperedHueShift.shader @@ -41,8 +41,8 @@ SubShader { sampler2D _MainTex; float _Cutoff; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata_t { @@ -85,8 +85,10 @@ SubShader { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif UNITY_APPLY_FOG(i.fogCoord, i.color); fixed4 c = tex2D(_MainTex, i.texcoord) * i.color; diff --git a/Assets/Resources/X/Brushes/Wind/Wind.shader b/Assets/Resources/X/Brushes/Wind/Wind.shader index 047c999d09..5300903a0a 100644 --- a/Assets/Resources/X/Brushes/Wind/Wind.shader +++ b/Assets/Resources/X/Brushes/Wind/Wind.shader @@ -17,7 +17,7 @@ Properties { _MainTex ("Texture", 2D) = "white" {} _Speed ("Animation Speed", Range (0,1)) = 1 - [Toggle] _OverrideTime ("Overriden Time", Float) = 0.0 + _TimeOverrideValue("Time Override Value", Vector) = (0,0,0,0) _TimeBlend("Time Blend", Float) = 0 _TimeSpeed("Time Speed", Float) = 1.0 @@ -45,9 +45,9 @@ Category { #pragma multi_compile __ AUDIO_REACTIVE #pragma multi_compile __ HDR_EMULATED HDR_SIMPLE #pragma multi_compile __ ODS_RENDER ODS_RENDER_CM + #include "UnityCG.cginc" - #include "Assets/Shaders/Include/TimeOverride.cginc" - #include "Assets/Shaders/Include/Brush.cginc" + #include "Assets/Shaders/Include/Brush.cginc" #include "Assets/Shaders/Include/Hdr.cginc" sampler2D _MainTex; @@ -55,8 +55,8 @@ Category { float4 _MainTex_ST; float _Speed; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; uniform half _Opacity; @@ -98,8 +98,10 @@ Category { fixed4 frag (v2f i) : COLOR { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard; + #endif // Simple scrollin' float time = GetTime().y * _Speed; diff --git a/Assets/Scripts/API/ApiManager.cs b/Assets/Scripts/API/ApiManager.cs index 422590dcee..1ba113f0d2 100644 --- a/Assets/Scripts/API/ApiManager.cs +++ b/Assets/Scripts/API/ApiManager.cs @@ -908,5 +908,16 @@ public void EndUndo() } ActiveUndo = null; } + + public static bool ParameterRequiresScriptingKeyword(string parameter) + { + return parameter is + "_ClipStart" or + "_ClipEnd" or + "_Dissolve" or + "_TimeOverrideValue" or + "_TimeBlend" or + "_TimeSpeed"; + } } } diff --git a/Assets/Scripts/API/Lua/Wrappers/LayerApiWrapper.cs b/Assets/Scripts/API/Lua/Wrappers/LayerApiWrapper.cs index 8c0f244cc8..c7640d0422 100644 --- a/Assets/Scripts/API/Lua/Wrappers/LayerApiWrapper.cs +++ b/Assets/Scripts/API/Lua/Wrappers/LayerApiWrapper.cs @@ -271,6 +271,7 @@ public void SetShaderClipping(float clipStart, float clipEnd) { float startIndex = clipStart * batch.Geometry.NumVerts; float endIndex = clipEnd * batch.Geometry.NumVerts; + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); batch.InstantiatedMaterial.SetFloat("_ClipStart", startIndex); batch.InstantiatedMaterial.SetFloat("_ClipEnd", endIndex); } @@ -290,6 +291,7 @@ public void SetShaderClipping(string brushType, float clipStart, float clipEnd) { float startIndex = clipStart * batch.Geometry.NumVerts; float endIndex = clipEnd * batch.Geometry.NumVerts; + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); batch.InstantiatedMaterial.SetFloat("_ClipStart", startIndex); batch.InstantiatedMaterial.SetFloat("_ClipEnd", endIndex); } @@ -304,6 +306,10 @@ public void SetShaderFloat(string parameter, float value) { foreach (var batch in _CanvasScript.BatchManager.AllBatches()) { + if (ApiManager.ParameterRequiresScriptingKeyword(parameter)) + { + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); + } if (!batch.InstantiatedMaterial.HasFloat(parameter)) continue; batch.InstantiatedMaterial.SetFloat(parameter, value); } @@ -320,6 +326,10 @@ public void SetShaderFloat(string brushType, string parameter, float value) if (desc == null || !desc.Material.HasFloat(parameter)) return; foreach (var batch in _GetBatches(desc)) { + if (ApiManager.ParameterRequiresScriptingKeyword(parameter)) + { + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); + } batch.InstantiatedMaterial.SetFloat(parameter, value); } } diff --git a/Assets/Scripts/Stroke.cs b/Assets/Scripts/Stroke.cs index 6f9c0f1e21..c0dee6b736 100644 --- a/Assets/Scripts/Stroke.cs +++ b/Assets/Scripts/Stroke.cs @@ -495,6 +495,7 @@ public void SetShaderClipping(float clipStart, float clipEnd) } float startIndex = clipStart * batch.Geometry.NumVerts; float endIndex = clipEnd * batch.Geometry.NumVerts; + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); batch.InstantiatedMaterial.SetFloat("_ClipStart", startIndex); batch.InstantiatedMaterial.SetFloat("_ClipEnd", endIndex); } @@ -503,12 +504,16 @@ public void SetShaderFloat(string parameter, float value) { _CheckValidLayerState(); var batch = m_BatchSubset.m_ParentBatch; + if (ApiManager.ParameterRequiresScriptingKeyword(parameter)) + { + batch.InstantiatedMaterial.EnableKeyword("SHADER_SCRIPTING_ON"); + } var material = batch.InstantiatedMaterial; if (!material.HasFloat(parameter)) { throw new StrokeShaderModifierException($"Brush material {material.name} does not have a float parameter named {parameter}"); } - batch.InstantiatedMaterial.SetFloat(parameter, value); + material.SetFloat(parameter, value); } public void SetShaderColor(string parameter, ColorApiWrapper color) diff --git a/Assets/Shaders/FlatLit.shader b/Assets/Shaders/FlatLit.shader index d50b5a87f9..317188ef40 100644 --- a/Assets/Shaders/FlatLit.shader +++ b/Assets/Shaders/FlatLit.shader @@ -49,8 +49,8 @@ SubShader { sampler2D _MainTex; float4 _MainTex_ST; - uniform float _ClipStart; - uniform float _ClipEnd; + uniform half _ClipStart; + uniform half _ClipEnd; uniform half _Dissolve; struct appdata { @@ -117,8 +117,10 @@ SubShader { float4 frag(v2f i) : SV_TARGET { + #ifdef SHADER_SCRIPTING_ON if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard; if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard; + #endif // Apply shadows UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos); diff --git a/Assets/Shaders/Include/Brush.cginc b/Assets/Shaders/Include/Brush.cginc index 5099bdfa77..5b73c9b7b9 100644 --- a/Assets/Shaders/Include/Brush.cginc +++ b/Assets/Shaders/Include/Brush.cginc @@ -15,22 +15,16 @@ // -*- c -*- // Canvas transform. +#pragma multi_compile __ SHADER_SCRIPTING_ON + +#include "Assets/Shaders/Include/TimeOverride.cginc" + uniform float4x4 xf_CS; // Inverse canvas transform. uniform float4x4 xf_I_CS; uniform uint _BatchID; // NOTOOLKIT #include "Ods.cginc" // NOTOOLKIT -float4 GetTime() { - #ifdef TIME_OVERRIDES_DEFINED - if (_OverrideTime) - { - return lerp(_Time * _TimeSpeed, _TimeOverrideValue, _TimeBlend); - } - #endif - return _Time; -} - // Unity only guarantees signed 2.8 for fixed4. // In practice, 2*exp(_EmissionGain * 10) = 180, so we need to use float4 float4 bloomColor(float4 color, float gain) { @@ -49,7 +43,7 @@ float4 bloomColor(float4 color, float gain) { // Used by various shaders to animate selection outlines // Needs to be visible even when the color is black float4 GetAnimatedSelectionColor( float4 color) { - return color + sin(GetTime().w*2)*.1 + .2f; + return color + sin(_Time.w*2)*.1 + .2f; } // diff --git a/Assets/Shaders/Include/TimeOverride.cginc b/Assets/Shaders/Include/TimeOverride.cginc index fe59f678de..044a662257 100644 --- a/Assets/Shaders/Include/TimeOverride.cginc +++ b/Assets/Shaders/Include/TimeOverride.cginc @@ -1,5 +1,17 @@ -#define TIME_OVERRIDES_DEFINED -uniform float _OverrideTime = 0.0; -uniform float4 _TimeOverrideValue = float4(0,0,0,0); -uniform float _TimeBlend = 0.0; -uniform float _TimeSpeed = 1.0; +#ifdef SHADER_SCRIPTING_ON + + uniform float4 _TimeOverrideValue = float4(0,0,0,0); + uniform half _TimeBlend = 0.0; + uniform half _TimeSpeed = 1.0; + + float4 GetTime() { + return lerp(_Time * _TimeSpeed, _TimeOverrideValue, _TimeBlend); + } + +#else + + float4 GetTime() { + return _Time; + } +#endif +