The cool applications of Depth Of Field effect!

I was messing around with the depth of field effect in CloneTroopers modded studio.
Using this there are probably hundreds of ways that this can be applied in games.
So this is what I created at first (based of a shader from minecraft) anyways…

Image 1

How did I create the first video?
So I started off with a local script in “StarterCharacterScripts” and then cast a Ray from the players head to about 5 studs out. Next, I checked if the ray was interacting with a part and if it did I activated the effect. I also put a for loop to make the transition more seem less.

I realised that glass actually removes the effect (Makes sense becuase thats how it works for people with glasses IRL)

Image 2

Final Result: All I did was put a glass cylinder in the scope

Image 3

I am going to try and implement this into boatbomber’s [Dual Render Scope] and see how that turns out.

25 Likes

Looks cool! I like the 3rd image/video where the gun isn’t blurred but everything is. Anyway it’s cool that DepthOfField exists on roblox for more realistic view.

Nice job.

2 Likes

Anyone know when this is set to release? I’m looking forward to add this setting to my shooter game.

5 Likes

Unfortunately I don’t think it’d be usable for scopes even if it does if your maps have any transparent parts in it (due to the still occurring glass bug)

1 Like

I find said “bug” very useful for making things like one-way glass. Maybe Roblox could add an option to toggle “Ignore Transparent Parts”?

Anyways, this showcase is really nice! I hope it comes out soon.

1 Like

I find it extremely not useful for my game, because I want normal glass, but that’s neither here nor there.

1 Like

That’s awesome! My dual render scope used the BlurEffect, so even the gun model got blurred. A DoF effect looks so much cooler! I wish that existed back when I was making it.

Because my scope is a ScreenGui, you don’t even need to rely on the Glass material bug! You can just set the DoF and my scope would stay clear.

4 Likes
1 Like

This is AMAZING, man, this literally the perfect time for DepthOfField to finally work for some of my projects

1 Like