From 17c5f581851799676af414ae7f35bc20b295e0b2 Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 18 Jul 2024 16:52:34 -0700 Subject: Fix glitter again Flickering got worse. Use rcp() as suggested in shader dev discord. When I originally fixed this, I could still get away with using a normal divide. --- tooner_lighting.cginc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 8215ea8..2040c6d 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -438,7 +438,7 @@ float get_glitter(float2 uv, float3 worldPos, // A regular divide here causes flickering. The leading guess is that NVIDIA // hardware implements the divide instruction slightly differently on // different cores. - precise float idensity = 1.0 / density; + precise float idensity = rcp(density); float glitter = rand2(floor(uv * density) * idensity); float thresh = 1 - amount / 100; -- cgit v1.2.3