summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-11-04 01:03:51 -0800
committeryum <yum.food.vr@gmail.com>2024-11-04 01:04:59 -0800
commit964f6fe874363c948e6c91bbeb716ffad3962a23 (patch)
tree42b8604cf1006f2066c1516b56558f5e24256f1f
parent80f5174b732e028854f8f6f7d82f24fdf6404215 (diff)
Begin work adding normals to fog
-rw-r--r--Editor/tooner.cs4
-rw-r--r--fog.cginc17
-rw-r--r--globals.cginc1
-rw-r--r--tooner.shader1
4 files changed, 15 insertions, 8 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs
index 6c5a9f8..6358597 100644
--- a/Editor/tooner.cs
+++ b/Editor/tooner.cs
@@ -2091,6 +2091,10 @@ public class ToonerGUI : ShaderGUI {
TexturePropertySingleLine(
MakeLabel(bc, "Noise"),
bc);
+ bc = FindProperty("_Gimmick_Fog_00_Normal_Noise");
+ TexturePropertySingleLine(
+ MakeLabel(bc, "Normal noise"),
+ bc);
bc = FindProperty("_Gimmick_Fog_00_Emitter_Texture");
TexturePropertySingleLine(
diff --git a/fog.cginc b/fog.cginc
index 960fe81..92fa371 100644
--- a/fog.cginc
+++ b/fog.cginc
@@ -127,7 +127,8 @@ float fog00_map(float3 p, float rid_entropy)
{
float sin_term = sin(rid_entropy*2*TAU+_Time[0]*2)+1.0;
sin_term *= sin_term;
- return length(p)+1.5-rid_entropy*2.3*
+ sin_term *= 0.7;
+ return length(p)+0.7-rid_entropy*2.3*
sin_term*.2;
}
float fog00_map_dr(
@@ -148,10 +149,10 @@ float fog00_map_dr(
float d = 1E9;
float3 which_tmp = which;
-#if 0
- for (uint xi = 0; xi < 1; xi++)
+#if 1
+ for (uint xi = 0; xi < 2; xi++)
for (uint yi = 0; yi < 2; yi++)
- for (uint zi = 0; zi < 1; zi++)
+ for (uint zi = 0; zi < 2; zi++)
#else
uint xi = 0;
uint yi = 0;
@@ -170,8 +171,8 @@ float fog00_map_dr(
(sin(_Time[0] * 2 + (rid_entropy.x + rid_entropy.y + rid_entropy.z) * TAU * .6666) * 2 - 1.0) *
period * 0.5 *
random_dir *
- float3(.1, .1, .1) * .3;
- float cur_d = fog00_map(r, rand3((rid+seed)/100));
+ float3(1, 1, 1) * .3;
+ float cur_d = fog00_map(r, FOG_PERLIN_NOISE((rid+seed)*100));
which_tmp = cur_d < d ? rid : which_tmp;
d = min(d, cur_d);
}
@@ -284,7 +285,7 @@ Fog00PBR getFog00(v2f i) {
#if defined(_GIMMICK_FOG_00_RAY_MARCH_0)
{
float3 period = 3;
- float3 count = 7;
+ float3 count = 9;
float3 which;
float seed = _Gimmick_Fog_00_Ray_March_0_Seed;
float d = fog00_map_dr(p, period, count, seed, which);
@@ -292,7 +293,7 @@ Fog00PBR getFog00(v2f i) {
which.x * count.y * count.z +
which.y * count.z +
which.z;
- float d_falloff = saturate(rcp(max(pow(d, 16), 1E-6)));
+ float d_falloff = saturate(rcp(max(pow(d, 4), 1E-6)));
float brightness = step_size * .5;
#if 1
float3 cur_c_oklch;
diff --git a/globals.cginc b/globals.cginc
index c717cae..d7c35dd 100644
--- a/globals.cginc
+++ b/globals.cginc
@@ -754,6 +754,7 @@ float _Gimmick_Fog_00_Alpha_Cutoff;
float _Gimmick_Fog_00_Ray_Origin_Randomization;
float _Gimmick_Fog_00_Lod_Half_Life;
texture3D _Gimmick_Fog_00_Noise;
+texture3D _Gimmick_Fog_00_Normal_Noise;
#if defined(_GIMMICK_FOG_00_EMITTER_TEXTURE)
texture2D _Gimmick_Fog_00_Emitter_Texture;
float _Gimmick_Fog_00_Emitter_Brightness;
diff --git a/tooner.shader b/tooner.shader
index 5a73809..2d5882e 100644
--- a/tooner.shader
+++ b/tooner.shader
@@ -646,6 +646,7 @@ Shader "yum_food/tooner"
_Gimmick_Fog_00_Enable_Static("Enable fog 00", Float) = 0
_Gimmick_Fog_00_Noise("Noise", 3D) = "black" {}
+ _Gimmick_Fog_00_Normal_Noise("Normal noise", 3D) = "white" {}
_Gimmick_Fog_00_Max_Ray("Max ray", Float) = 25
_Gimmick_Fog_00_Radius("Radius", Float) = 25
_Gimmick_Fog_00_Step_Size_Factor("Step size (meters)", Float) = 1