Dirt or Dust lens effect

I see a lot of games that have a dust or dirt lens effect. Its where the smudges or (dust / dirt) on the camera lens become visible when looking towards a light source, or with the rays of sunlight.
Something like this
image

I was wondering if there is any way to give a similar effect in Roblox. I was thinking maybe using rays to determine at what angle the sun might be shining on the camera, that along with time of day. Perhaps have the ‘dust’ spots be individual smaller images, so that I can adjust their transparency based on some sort of information about where a ‘sun ray’ might be hitting the camera?

Does anyone have any ideas or maybe tried something similar?

Thanks.

4 Likes

I think what you said is the best option, even though it would be a bit difficult. Good luck!

This is really interesting, and I’ll see if I can make it. You probably abandoned this idea long ago, but I like a challenge! I’m going to see if I can do it, and then reply with the freemodel. I’m going to see if I can use sun direction and look vector to do it.

It was actually surprisingly easy to make. I just used :GetSunDirection() and camera position and make it screen spaces. I also use raycasts to see if there’s any objects in the way of the sun, excluding objects with transparency 0.7 and higher and water. Anyways here’s the freemodel as promised.

DirtyLens - Creator Store

Here’s some images of it in my WIP game:


would love to take a look at this but I get a 404 when looking at the model’s page

Wow, that really looks nice. There is an issue with the link however.
I didn’t really abandon the idea, more just put it on hold.
I was getting lost in the math and a bit frustrated with it all.

Thanks for working it out.

Also, nice to learn about :GetSunDirection() , I didn’t think about that.