diff options
| author | yum <yum.food.vr@gmail.com> | 2026-07-20 16:35:51 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-07-20 16:35:51 -0700 |
| commit | da12f242c6d8da930aa3c2e90fd21a637cd1f195 (patch) | |
| tree | eaf266606ad6bffed657f2a7f2b5953fb199f23f /lighting.cginc | |
| parent | 2808677625ebec6d9342363ba97af00a9c11bfcd (diff) | |
Add glitter normal map override option
Diffstat (limited to 'lighting.cginc')
| -rwxr-xr-x | lighting.cginc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lighting.cginc b/lighting.cginc index 4330562..8642c1d 100755 --- a/lighting.cginc +++ b/lighting.cginc @@ -285,9 +285,17 @@ void GetLighting(v2f i, Pbr pbr, out LightData data) { #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 |
