From da12f242c6d8da930aa3c2e90fd21a637cd1f195 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 20 Jul 2026 16:35:51 -0700 Subject: Add glitter normal map override option --- lighting.cginc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lighting.cginc') diff --git a/lighting.cginc b/lighting.cginc index 4330562..8642c1d 100755 --- a/lighting.cginc +++ b/lighting.cginc @@ -284,10 +284,18 @@ void GetLighting(v2f i, Pbr pbr, out LightData data) { float glitter_roughness = _Glitter_Base_Roughness_Override; #else 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; + glitter_normal = glitter_normal.xzy * float3(-1, 1, -1); + float3x3 tbn = tbn_from_normal_tangent(glitter_normal, i.tangent); +#else + float3 glitter_normal = pbr.normal; + float3x3 tbn = pbr.tbn; #endif data.glitter = GetGlitterLighting( _Glitter_Amount, _Glitter_Roughness, _Glitter_Angular_Cells, - _Glitter_Filter_Size, UV_SCOFF(i, _Glitter_Mask_ST, _Glitter_UV_Channel), pbr.tbn, glitter_roughness, pbr.normal, + _Glitter_Filter_Size, UV_SCOFF(i, _Glitter_Mask_ST, _Glitter_UV_Channel), tbn, glitter_roughness, glitter_normal, data.common.V, data.direct.H, glitter_indirect_dir); #endif -- cgit v1.2.3