shader updating to 1.21

hi i have this shader which works on 1.20.1 but not 1.21 i have tried to fix it by changing the fog_distace from 3 inputs to just the 2 required but teh output is glitchy and can only see it from some angles https://github.com/bradleyq/light_painter is where i got my code from

Continue to help post