From a95481afa226d76d671b13515ee2abc59359b87a Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 16 Jul 2024 12:50:12 -0700 Subject: 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 --- tooner_lighting.cginc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tooner_lighting.cginc') 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 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) { -- cgit v1.2.3