summaryrefslogtreecommitdiffstats
path: root/lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-07-20 16:53:54 -0700
committeryum <yum.food.vr@gmail.com>2026-07-20 16:53:55 -0700
commit0425eadf188ebac3c370942dd55f9ba8e0f5afa9 (patch)
treeb66eb5ce6981e88d91ca317c545783e3dad9fc2d /lighting.cginc
parentda12f242c6d8da930aa3c2e90fd21a637cd1f195 (diff)
Clanker glitter cleanups
GPT-5.6 sol medium. Asked it to spot any issues, gave it the Kemppinen et. al. paper and their source code as reference.
Diffstat (limited to 'lighting.cginc')
-rwxr-xr-xlighting.cginc6
1 files changed, 5 insertions, 1 deletions
diff --git a/lighting.cginc b/lighting.cginc
index 8642c1d..db9cee0 100755
--- a/lighting.cginc
+++ b/lighting.cginc
@@ -286,8 +286,12 @@ void GetLighting(v2f i, Pbr pbr, out LightData data) {
float glitter_roughness = pbr.roughness;
#endif
#if defined(_GLITTER_NORMAL_OVERRIDE)
- float3 glitter_normal = _Glitter_Normal_Override.Sample(bilinear_clamp_s, i.uv01.xy) * 2 - 1;
+ float2 glitter_normal_uv = UV_SCOFF(i, _Glitter_Normal_Override_ST,
+ _Glitter_UV_Channel);
+ float3 glitter_normal = _Glitter_Normal_Override.Sample(
+ bilinear_clamp_s, glitter_normal_uv).xyz * 2 - 1;
glitter_normal = glitter_normal.xzy * float3(-1, 1, -1);
+ glitter_normal = UnityObjectToWorldNormal(glitter_normal);
float3x3 tbn = tbn_from_normal_tangent(glitter_normal, i.tangent);
#else
float3 glitter_normal = pbr.normal;