What a great first episode of *Matt's adventures into things he has no clue how to do but really wanted to figure out and make a video about* ! This video reminded me about the small considerations that go into making an experience, and even the seemingly smallest of aspects can really add to it. Great video, looking forward to what's to come!
"This video reminded me about the small considerations that go into making an experience, and even the seemingly smallest of aspects can really add to it." My bugs remind me of that every day.
There's nothing quite as satisfying as watching a roughed-out experiment with new mechanics turn into a polished experience. Loved watching this evolve.
That was superb. I found this as I was looking for "how to do depth of field in Unity". It was far easier than I expected. I'm at the stage of trying things out and testing stuff, before I work on the actual product.
well Brackeys, Sebastian League, Mix and Jam, Makin Stuff Look Good and now Game Dev Guide...... my go to guys for any problem in unity !!! Damn good, short and on point with a little entertainment (just perfect) keep posting and take your time mate. ♥
Not going to lie, THIS added to a concept I'm Pre-Deving right now would add just that tinny little hint of realism that I'm looking for. It would defiantly be a 'finishing and polish' element, but I love this idea of yours. You, Sir, get a thumbs up and subscribe from this one.
Loved the video as usual. The moment you mentioned an escape room style game my heart skipped a beat. I've been working on something like that behind the scenes for months using the First Person Exploration Kit by While Fun Games on the Asset Store. Really nice work sir, keep it up!
Lovely I did a similar experiment exactly a year ago xD The only addition was that I also lerped between the origanl and the final object rotation which added more beauty to it But your code certainly looks neater :) Great job
Very nice video - I have had the exact same idea and the my idea was also exactly as your about calculation the focus point - except I haven't actual done it yet. But the result here looks awesome and I will definitely try it out in my game. Thanks for sharing. Oh, I hit the subscribe button by the way :D
I enjoy coding adventure videos, been watching Sebastian lauges videos. Now I found this so gonna subscribe and add these vids, thank you for the entertainment!
It appears things have changed since this video. If people are having difficulty finding the Post Processing Profile. The process as of this post goes like this. 1) Make sure HDRP is in your project with no conflicts or errors. 2) Make sure you have the HDRP asset in your project. 3) Create an empty game object in your seen 4) Add the Volume component it this object. 5) Click the New button next to Profile field in the Volume component 6) Double click the new profile you created, it should appear in the Profile field in the volume component. 7) Click the Add Override button when the profile opens 8) Now click Post Processing or the feature you are looking for. This took me hours to figure out. I do not see any documentation or tutorial that covers these steps. Hope this helps.
@@GameDevGuide For HDRP this is what I came up with: using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; VolumeParameter volumeParameter; public Volume volume; private void Start() { for (int i = 0; i < volume.profile.components.Count; i++) { if (volume.profile.components[i].name == "DepthOfField(Clone)") { volumeParameter = volume.profile.components[i].parameters[1]; volumeParameter.SetValue(new MinFloatParameter(15, 12, true)); } } } void FixedUpdate() { float distanceToFocus = Vector3.Distance(transform.position, focus.transform.position); volumeParameter.SetValue(new MinFloatParameter(distanceToFocus - 15f, distanceToFocus + 15f, true)); }
@@BrianBakerCA Thanks for sharing! Unfortunately, it doesn't work in unity 2019.3: Volume.cs(4,17): error CS0116: A namespace cannot directly contain members such as fields or methods
5:55 What if you slightly increased the intensity of a reflection while looking at it? I think this effect could also be achieved with ray-casting and would resemble how our eyes adjust to looking directly at bright lights/reflections. Great video by the way.
Great video! Could you follow this up with a tutorial on adding the items you pickup to your inventory and then being able to placing those items down within a room?
A really great and simple way of doing this. In the Book of the Dead HDRP Demo Project Unity uses the Depthbuffer(I think) to control the DoF, so you can focus on non Collision Objects like the Grass, but I never understood how exactly the calculations work. Also I cant figure out how to change any settings in the new URP PP Stack, the values are changing in the editor but nothing happens in rendering. Would be nice If you can explore this stuff :)
soo i switched to urp a few hours ago and post process profiles don't work for some reason. the script you made needed a postProcess profile but i can only use volume component. How do i fix this?
I am using URP to make a level design on unity (2021.1.17f1 version) with visual 2019 and the library "using UnityEngine.Rendering.PostProcessing;" and "PostProcessVolume" is no recognized, what can i do?
nevermind I found the solution... well whoever have the same problem may be change "UnityEngine.Rendering.PostProcessing;" for "using UnityEngine.Rendering.Universal;" and "using UnityEngine.Rendering;" then "Volume" is now as reserved word so you don't have to use "PosProcessVolume" and last but no least use "volume.GetComponent(); volume.profile.TryGet(out depthOfField);" and thats it :D
Game idea: use the Dynamic Depth of Field(DoF) to simulate how someone with bad vision sees, where stuff is intentionally blury, and use the DoF as a part of gameplay
This is amazing but i this there's something i think we're missing... important focus points, i would make a checkerboard and look for important points. If you look at GTA V, focal point shifts as you do here but if you're looking at a tree and a person is closer than the tree but not in front, it'll automatically focus on the character instead of the tree. maybe assign some kind of tag to an object and focus important objects around the midpoint first and if there's nothing more important to show, or most points are closer things... you could make something really good about that, let's just say for a escape room game. Great video!
Is the it possible to get this script on GitHub? Im new to coding and this would make the visuals much better and I can't seem to recreate the script your showing 😅
@@vjanomolee First of all, cool demo! Every lens (at every aperture) has a hyperfocal distance. If you focus on that distance you get the maximum depth of field. Although I don't remmeber why I recomended that 8 months ago..
Now I remember: There is no point in focusing beyond the hyerfocal distance, the image quality only goes down from there. But I doubt Unity simulates defocus blur at that level of fidelity..
Instead of lerping you could have set a speed at which the focus length changes... That would fix the fast transition on the background and might feel a little more natural
Love the idea. Love your way of presenting the stuff. Keep on going. If you could paste important parts of your code somewhere to play around - this would be awsome!
hey Game Dev, I've tried doing this but it's not working at all, is it possible you could make a video on the actual interaction with the game object and deselection of the object where it returns back to the original position. Would be grateful thanks.
Hello, does anyone know how I would go about making frosted glass in Unity? I know how transparency+blur works but the deal with frosted glass is that the effect is based on the distance between THE GLASS and THE OBJECTS behind it rather than just the CAMERA-OBJECTS. This mean that it would be some sort of DoF that considers CAMERA, GLASS and OBJECTS behind it. A double DoF? I don't know, my head hurts if I think too much about it :D Any help is welcome.
Great video, looks fantastic! Any chance of you expanding on this to play with camera field of view and zoom to pull of the "Jaws" effect with a camera in game?
The "push-pull " effect, can likely use a very similar principle pulling the target at the beginning of the video. As in the real world, it's just the dolly moving backwards/forwards and the Camera Focal Length forwards/backwards respectively, simultaneously. This alongside the "Link FOV to Physical Camera" checked, so that when the focal length is changed in the camera it keeps the aperture in play and a physically-based DoF So long as the dolly action is predetermined in say, Timeline or Cinemachine, should be pretty straight forward to do if you code and understand a camera.
Brilliant. Loved the narrative wrapped style of delivery. I'd like to know what your thoughts were/are on Unity's physical camera and HDRP. Have you tried the same ArchViz scene in HDRP and Unity 2019.3.9. The post processing stack is now a "Volume" and I think the whole physical camera implementation is mucked up. My thoughts here: forum.unity.com/threads/the-unity-physical-camera-and-how-to-improve-it.877540/ I'd love to know if you'd be able to make the dynamic DoF script work for HDRP considering the Physical camera in HDRP would have physically accurate modeled Bokeh (claimed) and capture Volumetric atmospherics.
Hi, I know that you released this at the beginning of the year and probably have no interest in answering any further questions but, I am trying to recreate this in the URP and everything was going great until I had to try and get a public Volume. For some reason, it doesn't exist through script even though it does in HDRP... It's mind-bogglingly annoying because there is no documentation on it either.
Everytime I watch one of your video, I always wonder... WHY LERP?! It's a linear interpolation from point a to point b based on t that is [0, 1]... What you're doing is a trick to achieve a move toward but really screwed up because of the interpolation problem from the zeno paradox. Well, it's not a huge problem but I found it so messed up.
Don't use time as interpolator term in a damping formula like yours. Here's why. The expression a = lerp(a, b, t) is actually a First Order Low-Pass Exponential Moving Average Infinite Impulse Response filter where b is the input signal, a is the filtered output signal and t is approximating the cutoff frequency of the filter. It's "low-pass" because it actually removes the high frequency content of a. It's "infinite" because given an initial amount in a and a cutoff frequency lower than 1, a will never actually reach b mathematically. It's "exponential" because t is not actually the linear cutoff frequency, but rather approximates the cutoff frequency if used in a c^t form, thus changing it linearly yields a logarithmic cutoff frequency, so using deltaTime as a term of t makes very little sense. T should be set as a constant and regarded as a between 0.0 (complete cutoff - 'a' never changes) and 1.0 (instant transfer - no frequency cutoff or cutoff fq equals the nyquist frequency of the signal). If you wish to give t a linear meaning and try to compensate for variable framerate, at least write t as a function of deltaTime and a constant, but in a normalized exponentiated form like t = pow(c, deltaT) / (normTerm), where c is a constant, time-invariant "focus speed" and normTerm is the max value of c^dT, so that t stays in the unit range 0 to 1. Hope that makes a bit more sense.
Getting some major Sebastian Lague vibes from this style of video. LOVE IT! Keep it up man. I love these exploring Unity videos :)
100% agree! Loved the video style, very enjoyable :)
What a great first episode of *Matt's adventures into things he has no clue how to do but really wanted to figure out and make a video about* !
This video reminded me about the small considerations that go into making an experience, and even the seemingly smallest of aspects can really add to it. Great video, looking forward to what's to come!
"This video reminded me about the small considerations that go into making an experience, and even the seemingly smallest of aspects can really add to it."
My bugs remind me of that every day.
I hope that this channel gets the recognition it deserves. Thank you for the in-depth tutorials and I hope to see more from you in the future.
Wow. Just watching a couple of your videos got me more excited about the future of gaming than any game trailer I've ever seen in my life.
You always trigger the creative GameDev inside me and I start thinking coz I am out of ideas currently. Thx for the videos dude :)
There's nothing quite as satisfying as watching a roughed-out experiment with new mechanics turn into a polished experience. Loved watching this evolve.
That was superb. I found this as I was looking for "how to do depth of field in Unity". It was far easier than I expected.
I'm at the stage of trying things out and testing stuff, before I work on the actual product.
well Brackeys, Sebastian League, Mix and Jam, Makin Stuff Look Good and now Game Dev Guide...... my go to guys for any problem in unity !!!
Damn good, short and on point with a little entertainment (just perfect) keep posting and take your time mate. ♥
This is absolutely gorgeous!
Not going to lie, THIS added to a concept I'm Pre-Deving right now would add just that tinny little hint of realism that I'm looking for. It would defiantly be a 'finishing and polish' element, but I love this idea of yours. You, Sir, get a thumbs up and subscribe from this one.
So calming to watch these videos
Loved the video as usual. The moment you mentioned an escape room style game my heart skipped a beat. I've been working on something like that behind the scenes for months using the First Person Exploration Kit by While Fun Games on the Asset Store. Really nice work sir, keep it up!
this interaction is the best! Additionally , I think VR like movement in non - VR game is super as well
Amazing! Truly good work with your videos. As a senior developer but Unity rookie this is truly a source of knowledge!
Got exactly what I needed, so funny, since I joined your Patreon and googling questions you have a video already about the topic.
OMG ive been banging my head for at least 5 to get my drone's Focus distance to change depending on how far it is THX so much!!
5:32 *Is that euler that I smell?*
7:45 * Dies from gimbal lock *
Now, seriously, please use true Quaternions
But quaternions are hard :(
@@BlackMesaEmployee you could just think of them as a magic box, with Quaternion.AngleAxis and multiplying them to add rotations together
Or you just use Debug.DrawLine everytime you work with them to figure out where what is pointing and get even more confused😂
That's beautiful, man.
"yep, that's a plate" - I spilled my coffee :).
Amazing content dude, please keep posting you have a real talent for teaching and entertaining at the same time.
The quality is awesome! Very informative video, thanks for sharing
An escape room done this way would be AMAZING! That is *genius*!
You deserve more subscribers! Your videos are really helpful and we'll explained. Really loved your channel
Really cool, thanks for sharing Matt
Literally at this point in my project for my startup!
Great video Matt! Cool experiment and technique.
great stuff man, keep it up, subbed after 2 videos. love your work
manyy possibilities! thanks for this
This is very great! The game feels a bit more realistic. Thanks for sharing this ;D
Really informative! Thank you very much.
Nice - you could adjust the lerp time based on sqrt(abs(ray cast-current distance)) to simulate how fast the human lens can adjust focus.
really, top quality video. keep up the good work!
Lovely
I did a similar experiment exactly a year ago xD
The only addition was that I also lerped between the origanl and the final object rotation which added more beauty to it
But your code certainly looks neater :) Great job
u r a talented guy!!keep up the good work bro!!
This project is screaming "VR!"... cool man, very cool...
i don't think dynamic DoF is something that ever should be mixed with vr.... It would be really really really disorienting.
maybe with eye tracking tho, could be used as a way to hide rendering a lower resolution on parts you're not looking at.
Beautiful
Very nice video - I have had the exact same idea and the my idea was also exactly as your about calculation the focus point - except I haven't actual done it yet.
But the result here looks awesome and I will definitely try it out in my game. Thanks for sharing.
Oh, I hit the subscribe button by the way :D
Thank you sooo much, ive been trying to do this for 2 days
Excellent!
This is so a great idea ♥, it really helped me thanks.
I enjoy coding adventure videos, been watching Sebastian lauges videos. Now I found this so gonna subscribe and add these vids, thank you for the entertainment!
It appears things have changed since this video. If people are having difficulty finding the Post Processing Profile. The process as of this post goes like this.
1) Make sure HDRP is in your project with no conflicts or errors.
2) Make sure you have the HDRP asset in your project.
3) Create an empty game object in your seen
4) Add the Volume component it this object.
5) Click the New button next to Profile field in the Volume component
6) Double click the new profile you created, it should appear in the Profile field in the volume component.
7) Click the Add Override button when the profile opens
8) Now click Post Processing or the feature you are looking for.
This took me hours to figure out. I do not see any documentation or tutorial that covers these steps.
Hope this helps.
Yeah for what it's worth I'm not using the HDRP here, I'm using Built-In, which is why you encountered a different workflow.
@@GameDevGuide For HDRP this is what I came up with:
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
VolumeParameter volumeParameter;
public Volume volume;
private void Start()
{
for (int i = 0; i < volume.profile.components.Count; i++)
{
if (volume.profile.components[i].name == "DepthOfField(Clone)")
{
volumeParameter = volume.profile.components[i].parameters[1];
volumeParameter.SetValue(new MinFloatParameter(15, 12, true));
}
}
}
void FixedUpdate()
{
float distanceToFocus = Vector3.Distance(transform.position, focus.transform.position);
volumeParameter.SetValue(new MinFloatParameter(distanceToFocus - 15f, distanceToFocus + 15f, true));
}
@@BrianBakerCA Thanks for sharing! Unfortunately, it doesn't work in unity 2019.3: Volume.cs(4,17): error CS0116: A namespace cannot directly contain members such as fields or methods
5:55 What if you slightly increased the intensity of a reflection while looking at it? I think this effect could also be achieved with ray-casting and would resemble how our eyes adjust to looking directly at bright lights/reflections.
Great video by the way.
Cinemachine actually comes with a feature similar to this as a volume override where you can assign a gameobject to keep in focus.
Is your Dynamic DoF script available to purchase from the Asset Store?
Very futuristic
Great video
Very Nice!
Great video! Could you follow this up with a tutorial on adding the items you pickup to your inventory and then being able to placing those items down within a room?
this is very interesting
awesome!
This video just blew my mind off..
A really great and simple way of doing this. In the Book of the Dead HDRP Demo Project Unity uses the Depthbuffer(I think) to control the DoF, so you can focus on non Collision Objects like the Grass, but I never understood how exactly the calculations work.
Also I cant figure out how to change any settings in the new URP PP Stack, the values are changing in the editor but nothing happens in rendering.
Would be nice If you can explore this stuff :)
Make sure that you have the RP asset loaded in the graphics settings.
Cool, How'd you create the shader for outlining the object of interest?
Nice vid
soo i switched to urp a few hours ago and post process profiles don't work for some reason. the script you made needed a postProcess profile but i can only use volume component. How do i fix this?
I am using URP to make a level design on unity (2021.1.17f1 version) with visual 2019 and the library "using UnityEngine.Rendering.PostProcessing;" and "PostProcessVolume" is no recognized, what can i do?
nevermind I found the solution...
well
whoever have the same problem
may be change "UnityEngine.Rendering.PostProcessing;" for "using UnityEngine.Rendering.Universal;" and
"using UnityEngine.Rendering;"
then
"Volume" is now as reserved word so you don't have to use "PosProcessVolume"
and last but no least
use
"volume.GetComponent();
volume.profile.TryGet(out depthOfField);"
and thats it
:D
@@oxylol6983 Thanks! This really helped me out!
@@laundryjx 🫡
Game idea: use the Dynamic Depth of Field(DoF) to simulate how someone with bad vision sees, where stuff is intentionally blury, and use the DoF as a part of gameplay
I have a question, why did you use Vector3.distance for "focus distance" rather than just getting the hit.distance?
This is amazing but i this there's something i think we're missing... important focus points, i would make a checkerboard and look for important points. If you look at GTA V, focal point shifts as you do here but if you're looking at a tree and a person is closer than the tree but not in front, it'll automatically focus on the character instead of the tree. maybe assign some kind of tag to an object and focus important objects around the midpoint first and if there's nothing more important to show, or most points are closer things... you could make something really good about that, let's just say for a escape room game. Great video!
Is the it possible to get this script on GitHub? Im new to coding and this would make the visuals much better and I can't seem to recreate the script your showing 😅
you should clamp the focus distance to the hyperfocal distance.
hyperfocal distance?
@@vjanomolee First of all, cool demo! Every lens (at every aperture) has a hyperfocal distance. If you focus on that distance you get the maximum depth of field. Although I don't remmeber why I recomended that 8 months ago..
Now I remember: There is no point in focusing beyond the hyerfocal distance, the image quality only goes down from there. But I doubt Unity simulates defocus blur at that level of fidelity..
Instead of lerping you could have set a speed at which the focus length changes... That would fix the fast transition on the background and might feel a little more natural
Hi Game Dev Guide,
Is this code (without the bought package ofc) available somewhere for learning purposes? :)
Hello! Great video!
Please do a tutorial about how to make a realistic car controller!
i need the script how can i get it ?
I feel like this could be used for a horror story game maybe.
Hi! Would you please share the script? Would like to try it! - thanks!
Love the idea. Love your way of presenting the stuff. Keep on going. If you could paste important parts of your code somewhere to play around - this would be awsome!
How to do this on HDRP i'm able to DOF reference but what do i change there's so much Physical based Stuff With camera itself.
PLS HELP!!!!
hey Game Dev, I've tried doing this but it's not working at all, is it possible you could make a video on the actual interaction with the game object and deselection of the object where it returns back to the original position. Would be grateful thanks.
Fucking amazing!! My God...
Would you like to share your solution? Meaning the PROJECT? So we can try it on our own? THANKS!!!
Plz make a tutorial on making advance parkour and climbing system like assassin creed
Hello, does anyone know how I would go about making frosted glass in Unity? I know how transparency+blur works but the deal with frosted glass is that the effect is based on the distance between THE GLASS and THE OBJECTS behind it rather than just the CAMERA-OBJECTS. This mean that it would be some sort of DoF that considers CAMERA, GLASS and OBJECTS behind it. A double DoF? I don't know, my head hurts if I think too much about it :D
Any help is welcome.
Great video, looks fantastic!
Any chance of you expanding on this to play with camera field of view and zoom to pull of the "Jaws" effect with a camera in game?
The "push-pull " effect, can likely use a very similar principle pulling the target at the beginning of the video.
As in the real world, it's just the dolly moving backwards/forwards and the Camera Focal Length forwards/backwards respectively, simultaneously.
This alongside the "Link FOV to Physical Camera" checked, so that when the focal length is changed in the camera it keeps the aperture in play and a physically-based DoF
So long as the dolly action is predetermined in say, Timeline or Cinemachine, should be pretty straight forward to do if you code and understand a camera.
Brilliant. Loved the narrative wrapped style of delivery. I'd like to know what your thoughts were/are on Unity's physical camera and HDRP.
Have you tried the same ArchViz scene in HDRP and Unity 2019.3.9. The post processing stack is now a "Volume" and I think the whole physical camera implementation is mucked up. My thoughts here: forum.unity.com/threads/the-unity-physical-camera-and-how-to-improve-it.877540/
I'd love to know if you'd be able to make the dynamic DoF script work for HDRP considering the Physical camera in HDRP would have physically accurate modeled Bokeh (claimed) and capture Volumetric atmospherics.
It would be great if you upload the script, so we don't need to copy it and get errors because of not seeing a line of code
Dynamic Depth of Field AND Fov. What do you think about that?
Hey man, nice video!
Can you do this in Universal render pipeline?
yuh
Hi, I know that you released this at the beginning of the year and probably have no interest in answering any further questions but, I am trying to recreate this in the URP and everything was going great until I had to try and get a public Volume. For some reason, it doesn't exist through script even though it does in HDRP... It's mind-bogglingly annoying because there is no documentation on it either.
Ah yes, gorgeous houses probably none of us will ever actually live in. *sigh*
Brother, will you make a tutorial about this?
Has anyone come up with an efficient way to handle out of focus objects in the foreground without hard edges?
Everytime I watch one of your video, I always wonder... WHY LERP?! It's a linear interpolation from point a to point b based on t that is [0, 1]... What you're doing is a trick to achieve a move toward but really screwed up because of the interpolation problem from the zeno paradox. Well, it's not a huge problem but I found it so messed up.
Enjoyable vid. Also i guess this is a kinda promo vid for ArchViz?
Nope! Needed a scene and paid for it out of pocket. I'll always disclose if a video is sponsored!
@@GameDevGuide Ah ok, a lot of folks doing that so thats why i guessed that. Keep up the good vids!
I Think Its Outdated, How Can I Use It in HDRP ?
is it possible to share the code ?
you can provide the script please?
good to follow you on insta :D
so confused right now :D
Me wanna a download link
hı can you share project file with us , it will help us to better understand
Don't use time as interpolator term in a damping formula like yours. Here's why.
The expression a = lerp(a, b, t) is actually a First Order Low-Pass Exponential Moving Average Infinite Impulse Response filter where b is the input signal, a is the filtered output signal and t is approximating the cutoff frequency of the filter.
It's "low-pass" because it actually removes the high frequency content of a.
It's "infinite" because given an initial amount in a and a cutoff frequency lower than 1, a will never actually reach b mathematically.
It's "exponential" because t is not actually the linear cutoff frequency, but rather approximates the cutoff frequency if used in a c^t form, thus changing it linearly yields a logarithmic cutoff frequency, so using deltaTime as a term of t makes very little sense.
T should be set as a constant and regarded as a between 0.0 (complete cutoff - 'a' never changes) and 1.0 (instant transfer - no frequency cutoff or cutoff fq equals the nyquist frequency of the signal).
If you wish to give t a linear meaning and try to compensate for variable framerate, at least write t as a function of deltaTime and a constant, but in a normalized exponentiated form like t = pow(c, deltaT) / (normTerm), where c is a constant, time-invariant "focus speed" and normTerm is the max value of c^dT, so that t stays in the unit range 0 to 1.
Hope that makes a bit more sense.
Please Script)))