summaryrefslogtreecommitdiffstats
path: root/Editor/tooner.cs
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-10-11 18:39:50 -0700
committeryum <yum.food.vr@gmail.com>2024-10-11 18:39:50 -0700
commit0e39a7ef25e7938b84736519057c06c8d84856cc (patch)
tree7af1f8822572aa13747e913fbd8b5ca7d5a82819 /Editor/tooner.cs
parente193c86c869b84dfaaa26465c0e6fb923a27631c (diff)
Fog performance optimizations
* Rename albedo cutoff to alpha cutoff * Add LODs for calculating fog density * Use 3D noise texture to speed up density calculation * Eliminate low impact octaves from density calculation * Add support for multiple emitters
Diffstat (limited to 'Editor/tooner.cs')
-rw-r--r--Editor/tooner.cs46
1 files changed, 40 insertions, 6 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index fdcb678..3c0b951 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -2033,10 +2033,16 @@ public class ToonerGUI : ShaderGUI {
FloatProperty(bc, "Noise exponent");
bc = FindProperty("_Gimmick_Fog_00_Normal_Cutoff");
RangeProperty(bc, "Normal cutoff");
- bc = FindProperty("_Gimmick_Fog_00_Albedo_Cutoff");
- RangeProperty(bc, "Albedo cutoff");
+ bc = FindProperty("_Gimmick_Fog_00_Alpha_Cutoff");
+ RangeProperty(bc, "Alpha cutoff");
bc = FindProperty("_Gimmick_Fog_00_Ray_Origin_Randomization");
RangeProperty(bc, "Ray origin randomization");
+ bc = FindProperty("_Gimmick_Fog_00_Lod_Half_Life");
+ FloatProperty(bc, "LOD half life");
+ bc = FindProperty("_Gimmick_Fog_00_Noise");
+ TexturePropertySingleLine(
+ MakeLabel(bc, "Noise"),
+ bc);
bc = FindProperty("_Gimmick_Fog_00_Emitter_Texture");
TexturePropertySingleLine(
@@ -2046,16 +2052,44 @@ public class ToonerGUI : ShaderGUI {
if (bc.textureValue) {
EditorGUI.indentLevel += 1;
- bc = FindProperty("_Gimmick_Fog_00_Emitter_Location");
+ bc = FindProperty("_Gimmick_Fog_00_Emitter0_Location");
VectorProperty(bc, "Location (world)");
- bc = FindProperty("_Gimmick_Fog_00_Emitter_Normal");
+ bc = FindProperty("_Gimmick_Fog_00_Emitter0_Normal");
VectorProperty(bc, "Normal (world)");
- bc = FindProperty("_Gimmick_Fog_00_Emitter_Scale_X");
+ bc = FindProperty("_Gimmick_Fog_00_Emitter0_Scale_X");
FloatProperty(bc, "Scale (x)");
- bc = FindProperty("_Gimmick_Fog_00_Emitter_Scale_Y");
+ bc = FindProperty("_Gimmick_Fog_00_Emitter0_Scale_Y");
FloatProperty(bc, "Scale (y)");
+
bc = FindProperty("_Gimmick_Fog_00_Emitter_Brightness");
FloatProperty(bc, "Brightness");
+ bc = FindProperty("_Gimmick_Fog_00_Emitter_Lod_Half_Life");
+ FloatProperty(bc, "LOD half life");
+
+ for (int i = 0; i < 2; i++) {
+ bc = FindProperty($"_Gimmick_Fog_00_Emitter{i+1}_Enable_Static");
+ enabled = (bc.floatValue != 0.0);
+ EditorGUI.BeginChangeCheck();
+ enabled = Toggle($"Enable emitter {i+1}", enabled);
+ EditorGUI.EndChangeCheck();
+ bc.floatValue = enabled ? 1.0f : 0.0f;
+ SetKeyword($"_GIMMICK_FOG_00_EMITTER_{i+1}", enabled);
+
+ if (enabled) {
+ EditorGUI.indentLevel += 1;
+
+ bc = FindProperty($"_Gimmick_Fog_00_Emitter{i+1}_Location");
+ VectorProperty(bc, "Location (world)");
+ bc = FindProperty($"_Gimmick_Fog_00_Emitter{i+1}_Normal");
+ VectorProperty(bc, "Normal (world)");
+ bc = FindProperty($"_Gimmick_Fog_00_Emitter{i+1}_Scale_X");
+ FloatProperty(bc, "Scale (x)");
+ bc = FindProperty($"_Gimmick_Fog_00_Emitter{i+1}_Scale_Y");
+ FloatProperty(bc, "Scale (y)");
+
+ EditorGUI.indentLevel -= 1;
+ }
+ }
EditorGUI.indentLevel -= 1;
}