Laggy volumetric lighting

I think I coded at least one thing wrong.

Works by having multiple planes in front of camera with high transparency and evenly spaced apart. Shadows then project on all of the planes, this is very laggy, you can edit the place if you want.

(since it only works when you look away from light source i also added godrays)

screenshots:


if u code, please tell me if i did anything wrong

Update: Tried to make it more performant by making the whole thing a model instead of applying CFrame stuff to all the planes. Laggier but for some reason it also works when you look at the sun. Should adjust planes this time according to fov. Heres some screenshots:


(don’t use this for a game and don’t try to implement it yourself into a game because it will be really laggy)

12 Likes