Make a Realistic Depth of Field System in Unreal Engine 5

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 47

  • @jackengels5077
    @jackengels5077 3 หลายเดือนก่อน +8

    Late to the party but these videos are really great! I'd love to add a few things, some which I believe are shortcomings that should be fixed and others that are just minor improvements, so there they are:
    - Focus stuck to close when looking at the sky.
    After the Branch to check if something was hit, there's nothing in the false route, which makes it so that if your focus is set to close range and you look in the sky, it'll stay that way. To fix this, on the False route Set the Focus Location to infinity (0). Then, since we can't plug 2 different floats into the MakePostProcessSettings input node, we can add the "Select Float" node. the True route's float goes into A, False route float into B, and we can use the same boolean from the line trace node to determine whether we want A or B to go into the Focal DIstance Input.
    - You can't Focus other Pawns/Character
    If you put a debug sphere on the hit location, you'll see that characters and pawn wont be hit by the raytracing line. To fix this, we can swap the Line Trace By Channel Node with a Line Trace For Object node. Drag from the "Object Types" input and select "Make Array". We can now add custom enum values of things we want to be hit by the trace line but by default there's already what we need: add 3 pins with WorldStatic, WorldDynamic and Pawn. Now Characters and Pawns will affect the depth of field too.
    Note: an Aperture of 1.0 is quite extreme and the depth of field will be extremely narrow. Increase it to 2.8 or more so that three dimensional object cen be in focus entirely.
    - It's barely noticeable but the the focusing is always immediate and not really smooth. This can technically be done by using the "FInterp" To node

  • @johnterpack3940
    @johnterpack3940 4 หลายเดือนก่อน +10

    I did it a little differently. Instead of all the math after the line trace, I just pulled off the "Distance" pin of the Break straight to the "Manual Focus Distance" pin of the "Make CameraFocusSettings" node. Well, I routed it through a "Select Float" with a huge number on the B pin. The bool pin on the hit trace triggers the selection. That way I can stare at the sun without the focus going to zero. You do have to add a "Set CameraFocusSettings" node after the Make node. But that exposes other stuff you can tinker with. Added a few other nodes so I can change focal length, sensor size, and aperture from the blueprint. Planning to be able to adjust the camera for different situations or to create different effects. Probably doesn't matter, but I prefer to do this sort of stuff in-camera and save the post-processing for environmental stuff.

    • @GrumpyGamer11
      @GrumpyGamer11 3 หลายเดือนก่อน

      But this doesn't work with a normal non-cinematic camera, right?

    • @khris1977
      @khris1977 3 หลายเดือนก่อน

      can you share the picture blueprint?

    • @johnterpack3940
      @johnterpack3940 3 หลายเดือนก่อน +1

      @@khris1977 I uninstalled UE. But nothing really to share. Same as in the video except for the change I made.

  • @UnrealShack
    @UnrealShack 9 วันที่ผ่านมา +1

    Looks awesome! thanks!

    • @codethings
      @codethings  9 วันที่ผ่านมา

      Of course! Glad it could help :)

  • @ryanrockwelliscool
    @ryanrockwelliscool 22 วันที่ผ่านมา

    you are a life saver, your videos are amazing

  • @minusnine5036
    @minusnine5036 4 หลายเดือนก่อน +1

    Love RE mechanics tutorials. For how successful the franchise is I never see anyone make UE tutorials for it.

  • @蔡奕霏
    @蔡奕霏 3 หลายเดือนก่อน

    This is really cool, thanks for the lesson!

  • @satepilorad3860
    @satepilorad3860 22 วันที่ผ่านมา

    Hi! Everything looks cool and works, it would be great to know how to fix camera clipping to walls when camera penetrates through object when in close contact with any object.

  • @RAM_industrial_death_metal
    @RAM_industrial_death_metal 15 วันที่ผ่านมา

    At 6:55 what is the whole "event begin play" tree? In which tutorial is that? Also, thank you for an amazing tutorial.

  • @Axlayy
    @Axlayy 3 หลายเดือนก่อน +2

    is there a way to fix body and hands being blurred?

  • @iratemusic4575
    @iratemusic4575 10 หลายเดือนก่อน +2

    This is newest code for UE 5 in 2024.😳 This is lot better than collision detection.
    Code Things - Thank You for this new code.

    • @codethings
      @codethings  10 หลายเดือนก่อน +1

      Of course, I'm very happy to hear that it helped you! Goodluck in your game deveopment journey :)

  • @coleculler166
    @coleculler166 หลายเดือนก่อน

    This was a great tutorial, please keep up the great work! One question.... after implementing this, my map has gotten very bright. I know it's because of the f-stop effects we are adding to the first person camera, but this add more light into the camera lens. How do we counteract this so our map lighting stays as desired?

  • @netkra
    @netkra หลายเดือนก่อน

    Hello
    Thank you for making a great tutorial.
    As a beginner in game development, I have a question.
    I don't know where to ask questions, so I'm asking here first.
    Do you use Lumen at the end when you make the game? Or I wonder if you use the old method.
    I'm not sure how to start writing when I first make a game.

  • @RushedYT
    @RushedYT หลายเดือนก่อน

    I got everything working but is there a way to set the character model to not be affected by the camera depth of field? Right now the model is blurred if i look down or if im sprinting the hands are out of focus which looks a bit off, wondering if theres a way to make sure this mesh is always in focus?

    • @drayecare
      @drayecare หลายเดือนก่อน

      me too

  • @blacies2166
    @blacies2166 28 วันที่ผ่านมา

    There's no execute when I make input mapping collapsed graph. Any solution?

  • @duckness3242
    @duckness3242 3 หลายเดือนก่อน +1

    Unfortunately I had to scrap the code because it blurs the weapons and your arms

  • @poxh
    @poxh 28 วันที่ผ่านมา

    I have the issue that my character mesh has the dof effect

  • @khris1977
    @khris1977 3 หลายเดือนก่อน

    Hi Sir good day i how to adjust the boundary from wall to mannequin, because when i try hit the wall same from video i show the another side or inside the wall. Thanks

  • @storyteller.2024
    @storyteller.2024 6 หลายเดือนก่อน +4

    just notice that my gun is blur how can i fix it?

    • @codethings
      @codethings  6 หลายเดือนก่อน +3

      You can add a custom material to your gun that will make it displaced and thus not affected by the depth of field, however I have not done this in a while and forget exactly how to do it. Once I make my gun system however I will be figuring this out :)

  • @Joseph_Richard
    @Joseph_Richard 3 หลายเดือนก่อน

    The "Add Input Mapping" nodes from the 6:46 minute are gone in UE 5.4 :( Is there any way around that?

  • @Karrlow
    @Karrlow 10 หลายเดือนก่อน +1

    Learned quite a bit from your tutorials so far, thanks! I just have one question, I have set the first-person camera on the x-axis behind the head to prevent clipping and seeing through walls when close to them, this makes the body very blurry when viewing down.

    • @codethings
      @codethings  10 หลายเดือนก่อน +1

      Hm that’s pretty interesting. I haven’t tried this, but I will later today when I get the chance. I would presume it’s one of two things for why the feet are still blurry. It could either be that the distance for which things become focused is not a big enough value (the feet aren’t close enough to be focused) or potentially the mesh has an issue with the hit result and so it isn’t detected as a hit… I think the first one is more likely true

    • @Karrlow
      @Karrlow 10 หลายเดือนก่อน

      @@codethings Apologies if what I'm about to ask does not make sense but I was wondering if it would be possible to configure the DOF in a way where if it for example hits a mesh like a flashlight (that is close to the first-person camera) it would not apply the effect or it would focus. If that makes sense :)

    • @codethings
      @codethings  10 หลายเดือนก่อน

      hmm im sure there is a way but I have never tinkered with it before. however, i have found a few articles and a video here that might help. best of luck! Also, if i do figure it out when i try to do something like this, i will make a video on it!
      forums.unrealengine.com/t/exclude-objects-from-post-processing/420929
      forums.unrealengine.com/t/how-to-exclude-a-mesh-from-depth-of-field/153544
      th-cam.com/video/zRXFlPxRJHk/w-d-xo.html

  • @drackloud3596
    @drackloud3596 3 หลายเดือนก่อน

    So, I have a problem. When I use this with a dirt mask, the dirt mask just disappears. Is there a way to fix that?

  • @storyteller.2024
    @storyteller.2024 6 หลายเดือนก่อน +1

    great content, keep it up! could you do a tutorial on how to do a body cam like unrecord?

    • @codethings
      @codethings  6 หลายเดือนก่อน +2

      I 100% plan on doing one!

  • @sharpdev
    @sharpdev 9 หลายเดือนก่อน

    Can we increase the strength of DOF and Decrease?

  • @RammAndTheLamb
    @RammAndTheLamb 6 หลายเดือนก่อน

    Hey man, these tutorials are fantastic! I had a quick question. I currently have a sharpening post process material and a fish lens post process material in my first person camera that seem to get cancelled out when I implement any kind of auto depth of field (including your method). Is there some way to make them compatible?

  • @TommyTheHeist
    @TommyTheHeist 4 หลายเดือนก่อน

    It seems I might be doing something wrong.. I believe I followed your tutorial but when I try this out, results are inverted. Wall in front of me gets blurred and background is in focus. Do I need to invert something somewhere?.. :/

    • @codethings
      @codethings  4 หลายเดือนก่อน

      Hmm, im not too sure but im sure its something very simple. If you want to, you can join our discord community and we can try to solve in our code-help section :)

    • @TommyTheHeist
      @TommyTheHeist 4 หลายเดือนก่อน

      @@codethings yeah i will join in the evening!

    • @acsuperletalis
      @acsuperletalis 4 หลายเดือนก่อน

      Did you guys found out why its inverted? And how to fix it? I have the same problem

    • @TommyTheHeist
      @TommyTheHeist 4 หลายเดือนก่อน +2

      @@acsuperletalis hi, yes, i found it myself. For me it was on timer when you set up so it will check every 0.2 seconds, looping was not ticked

    • @acsuperletalis
      @acsuperletalis 4 หลายเดือนก่อน

      @@TommyTheHeist Thanks for the help!

  • @pashamelnik2299
    @pashamelnik2299 3 หลายเดือนก่อน

    Why don't you respond to my other comments under your other videos? It's no secret to you that on the topic
    "Field system"
    there are already videos on TH-cam with approximately the same mechanics and they came out before yours LOL.

  • @pashamelnik2299
    @pashamelnik2299 3 หลายเดือนก่อน

    You should at least not be caught that you are copying someone's lesson, the defocus works only when you set the settings to Epic! And why are the hands in defocus? If you are already copying someone else's lesson, then at least fix the bugs! And how to make it work at low settings????

    • @codethings
      @codethings  3 หลายเดือนก่อน +4

      None of my lessons/tutorials are “copied” the settings in this tutorial for the oscillation, rotation, etc settings I found online and they seemed good before recording. The process of making the system I thought of on my own. The hands are in focus because of the focal length, you can set the material of the character to not be affected by depth of field, which will fix it (or the pawn itself). This will make it so it is not effected by depth of field and thus cannot be focused. This same logic would apply if you were holding a weapon or some item. You could alternatively check to see if you’re holding a weapon and if you are toggle a boolean which can be used to check whether you should utilize the DOF or not. There are many ways to fix this issue.