summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fog.cginc11
-rw-r--r--interpolators.cginc2
-rw-r--r--tooner_lighting.cginc4
3 files changed, 14 insertions, 3 deletions
diff --git a/fog.cginc b/fog.cginc
index 8f81e09..3b41d7e 100644
--- a/fog.cginc
+++ b/fog.cginc
@@ -156,7 +156,16 @@ Fog00PBR getFog00(v2f i) {
// is visible with no factor.
float step_size = rcp(_Gimmick_Fog_00_Density) * _Gimmick_Fog_00_Step_Size_Factor;
step_size = clamp(step_size, 1E-2, 10);
- float dither = rand2(screen_uv*10) * step_size * _Gimmick_Fog_00_Ray_Origin_Randomization;
+ int2 screen_uv_round = floor(screen_uv * _ScreenParams.xy);
+ float dither_seed = rand2(float2(screen_uv_round.x, screen_uv_round.y)*.001);
+ // Smoothly vary over time. Use a triangle wave since it distributes points
+ // evenly. A sin wave would bunch points up at boundaries.
+ #if 1
+ dither_seed = frac(dither_seed + _Time[0]*2);
+ dither_seed *= 2; // Map onto [0, 2]
+ dither_seed = abs(dither_seed - 1); // Shape into triangle wave ranging from 0 to 1
+ #endif
+ float dither = dither_seed * step_size * _Gimmick_Fog_00_Ray_Origin_Randomization;
ro += rd * (0.1 + dither);
float world_pos_depth_hit_l = length(world_pos_depth_hit - ro);
diff --git a/interpolators.cginc b/interpolators.cginc
index 57b78e4..43e69e9 100644
--- a/interpolators.cginc
+++ b/interpolators.cginc
@@ -84,7 +84,9 @@ struct v2f
float2 uv7 : TEXCOORD7;
#endif
float2 fogCoord: TEXCOORD8;
+#if !defined(LIGHTMAP_ON)
unityShadowCoord4 _ShadowCoord : TEXCOORD9;
+#endif
float3 normal : TEXCOORD10;
float4 tangent : TEXCOORD11;
float3 worldPos : TEXCOORD12;
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index 093a5af..f771f4a 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -174,7 +174,7 @@ v2f vert(appdata v)
o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
o.uv0 = v.uv0;
o.uv1 = v.uv1;
-#if defined(_WORLD_INTERPOLATORS)
+#if defined(LIGHTMAP_ON)
o.uv2 = v.uv2 * unity_LightmapST.xy + unity_LightmapST.zw;
UNITY_TRANSFER_LIGHTING(o, v.uv2);
#else
@@ -547,7 +547,7 @@ float2 get_uv_by_channel(v2f i, uint which_channel) {
case 1:
return i.uv1;
break;
-#if !defined(_WORLD_INTERPOLATORS)
+#if !defined(LIGHTMAP_ON)
case 2:
return i.uv2;
break;