summaryrefslogtreecommitdiffstats
path: root/tooner_lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-07-16 12:50:12 -0700
committeryum <yum.food.vr@gmail.com>2024-07-16 12:50:12 -0700
commita95481afa226d76d671b13515ee2abc59359b87a (patch)
tree6dafd93ecf2770e2b1e878bcf193b97ef19934a5 /tooner_lighting.cginc
parentfdcb4dee7e8c5dbc46dc1513b57ed14851876303 (diff)
Add lighting multiplier & reflection probe saturation control
Also: * Shadow caster works with cutout now * Normalize interpolated mesh normal in fragment shader * Indirect specular affects clearcoat * Bugfix: rename v2f vertex to pos in tessellation shader * Hue shift affects outlines
Diffstat (limited to 'tooner_lighting.cginc')
-rw-r--r--tooner_lighting.cginc6
1 files changed, 5 insertions, 1 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index be06d69..e11f0dc 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -1,6 +1,8 @@
#ifndef TOONER_LIGHTING
#define TOONER_LIGHTING
+#include "UnityCG.cginc"
+
#include "audiolink.cginc"
#include "clones.cginc"
#include "eyes.cginc"
@@ -203,7 +205,7 @@ tess_factors patch_constant(InputPatch<tess_data, 3> patch)
tess_factors f;
#if defined(_TESSELLATION)
- float3 worldPos = mul(unity_ObjectToWorld, patch[0].vertex);
+ float3 worldPos = mul(unity_ObjectToWorld, patch[0].pos);
float factor = _Tess_Factor;
if (_Tess_Dist_Cutoff > 0 && length(_WorldSpaceCameraPos - worldPos) > _Tess_Dist_Cutoff) {
factor = 1;
@@ -782,6 +784,8 @@ float4 effect(inout v2f i)
float iddx = ddx(i.uv.x) * _Mip_Multiplier;
float iddy = ddx(i.uv.y) * _Mip_Multiplier;
const float3 view_dir = normalize(_WorldSpaceCameraPos - i.worldPos);
+ // Not necessarily normalized after interpolation.
+ i.normal = normalize(i.normal);
#if defined(_TROCHOID)
{