diff options
| -rw-r--r-- | Editor/tooner.cs | 26 | ||||
| -rw-r--r-- | audiolink.cginc | 2 | ||||
| -rw-r--r-- | feature_macros.cginc | 2 | ||||
| -rw-r--r-- | globals.cginc | 9 | ||||
| -rw-r--r-- | tooner.shader | 3 | ||||
| -rw-r--r-- | tooner_lighting.cginc | 20 |
6 files changed, 52 insertions, 10 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index dedc28c..9dc90c6 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -860,6 +860,32 @@ public class ToonerGUI : ShaderGUI { MakeLabel(bc, "Mask"), bc); + bc = FindProperty("_Gimmick_Quantize_Location_Audiolink_Enable_Static"); + enabled = (bc.floatValue != 0.0); + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle("Audiolink", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + SetKeyword("_GIMMICK_QUANTIZE_LOCATION_AUDIOLINK", enabled); + + if (enabled) { + EditorGUI.indentLevel += 1; + + bc = FindProperty("_Gimmick_Quantize_Location_Audiolink_Enable_Dynamic"); + enabled = (bc.floatValue != 0.0); + EditorGUI.BeginChangeCheck(); + enabled = EditorGUILayout.Toggle("Enable (runtime switch)", enabled); + EditorGUI.EndChangeCheck(); + bc.floatValue = enabled ? 1.0f : 0.0f; + + bc = FindProperty("_Gimmick_Quantize_Location_Audiolink_Strength"); + editor.FloatProperty( + bc, + "Strength"); + + EditorGUI.indentLevel -= 1; + } + EditorGUI.indentLevel -= 1; } diff --git a/audiolink.cginc b/audiolink.cginc index 06bbec7..200c2bc 100644 --- a/audiolink.cginc +++ b/audiolink.cginc @@ -3,7 +3,7 @@ #ifndef __AUDIOLINK #define __AUDIOLINK -#if defined (_AUDIOLINK) +#if defined (_GIMMICK_QUANTIZE_LOCATION_AUDIOLINK) #include "Packages/com.llealloo.audiolink/Runtime/Shaders/AudioLink.cginc" diff --git a/feature_macros.cginc b/feature_macros.cginc index 73353c2..9e95569 100644 --- a/feature_macros.cginc +++ b/feature_macros.cginc @@ -86,7 +86,7 @@ #pragma shader_feature_local _ _AMBIENT_OCCLUSION #pragma shader_feature_local _ _GIMMICK_FLAT_COLOR #pragma shader_feature_local _ _GIMMICK_QUANTIZE_LOCATION -#pragma shader_feature_local _ _GIMMICK_VERTEX_NORMAL_SLIDE +#pragma shader_feature_local _ _GIMMICK_QUANTIZE_LOCATION_AUDIOLINK #endif // __FEATURE_MACROS_INC diff --git a/globals.cginc b/globals.cginc index f243da3..ed6b209 100644 --- a/globals.cginc +++ b/globals.cginc @@ -304,12 +304,11 @@ float _Gimmick_Quantize_Location_Precision; float _Gimmick_Quantize_Location_Direction; float _Gimmick_Quantize_Location_Multiplier; texture2D _Gimmick_Quantize_Location_Mask; +#if defined(_GIMMICK_QUANTIZE_LOCATION) +float _Gimmick_Quantize_Location_Audiolink_Enable_Static; +float _Gimmick_Quantize_Location_Audiolink_Enable_Dynamic; +float _Gimmick_Quantize_Location_Audiolink_Strength; #endif - -#if defined(_GIMMICK_VERTEX_NORMAL_SLIDE) -float _Gimmick_Vertex_Normal_Slide_Enable_Static; -float _Gimmick_Vertex_Normal_Slide_Enable_Dynamic; -float _Gimmick_Vertex_Normal_Slide_Distance; #endif #endif diff --git a/tooner.shader b/tooner.shader index 88a148f..011f616 100644 --- a/tooner.shader +++ b/tooner.shader @@ -243,6 +243,9 @@ Shader "yum_food/tooner" _Gimmick_Quantize_Location_Direction("quantize location direction", Float) = 1.0 _Gimmick_Quantize_Location_Multiplier("quantize location multiplier", Range(0.01, 4)) = 1.0 _Gimmick_Quantize_Location_Mask("Mask", 2D) = "white" {} + _Gimmick_Quantize_Location_Audiolink_Enable_Static("Audiolink static", Float) = 0.0 + _Gimmick_Quantize_Location_Audiolink_Enable_Dynamic("Audiolink dynamic", Float) = 0.0 + _Gimmick_Quantize_Location_Audiolink_Strength("Strength", Float) = 1.0 _Gimmick_Vertex_Normal_Slide_Enable_Static("Enable vertex normal slide", Float) = 0.0 _Gimmick_Vertex_Normal_Slide_Enable_Dynamic("Enable vertex normal slide", Float) = 0.0 diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 136fdeb..3c033bc 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -64,13 +64,27 @@ v2f vert(appdata v) #if defined(_GIMMICK_QUANTIZE_LOCATION) if (_Gimmick_Quantize_Location_Enable_Dynamic) { - float q = _Gimmick_Quantize_Location_Precision / _Gimmick_Quantize_Location_Multiplier; + float q = _Gimmick_Quantize_Location_Precision / + _Gimmick_Quantize_Location_Multiplier; +#if defined(_GIMMICK_QUANTIZE_LOCATION_AUDIOLINK) + // christ what a fucking variable name + if (_Gimmick_Quantize_Location_Audiolink_Enable_Dynamic && + AudioLinkIsAvailable()) { + // x is lowest frequency, w is highest + float4 bands = AudioLinkData(ALPASS_AUDIOLINK).xyzw; + + float e = q *= 1 + (bands.x + bands.y * 0.5) * + _Gimmick_Quantize_Location_Audiolink_Strength * 0.1; + } +#endif float3 v_new0 = floor(v.vertex * q) / q; float3 d = v_new0 - v.vertex; float3 v_new1 = v.vertex - d; - bool flip_dir = (sign(dot(d, v.normal)) != sign(_Gimmick_Quantize_Location_Direction)); + bool flip_dir = (sign(dot(d, v.normal)) != + sign(_Gimmick_Quantize_Location_Direction)); float3 v_q = lerp(v_new0, v_new1, flip_dir); - float mask = _Gimmick_Quantize_Location_Mask.SampleLevel(linear_repeat_s, v.uv0.xy, /*lod=*/0); + float mask = _Gimmick_Quantize_Location_Mask.SampleLevel(linear_repeat_s, + v.uv0.xy, /*lod=*/0); v.vertex.xyz = lerp(v.vertex.xyz, v_q, mask); } #endif |
