- Unreal Engine 4 Shaders and Effects Cookbook
- Brais Brenlla Ramos John P. Doran
- 1026字
- 2021-06-24 14:12:11
How to do it...
Once you open the 02_04_CameraDepthOfField level, you should find yourself looking at the already familiar level that we are using throughout this chapter. There's nothing new under there! However true that may be, things will start to change if you look through the camera we have in our level. Let's take a look through it:

Wow! You should be able to see that the rendered image is completely out of focus. Getting it back to something more pleasing to our eyes is what our task is going to be, so let's get started!:
- For our first step, let's take a look at the Cine Camera Actor details panel. The name I've given to said camera is Camera01, if you want to select it from the world outliner. If you collapse each section in that panel, you should be looking at something such as this:

As you can see, many of the different options available to us through this actor are very similar to what we have already seen in the post process volume. In fact, they share almost the same amount of settings except for two main categories. With the camera, we are able to control which type we are using and certain intrinsic settings – the aperture of the lens, the diaphragm blade count or the FStop, among others. With the post process volume, we don't control those exact same settings, but we have access to more specific parameters that determine things the priority of the selected volume or how it blends with any adjacent ones.
- The first issue we want to solve is the blurriness that we see at the moment in the picture. With the camera selected, open up the Current Camera Settings section in the Details panel and scroll down to the Focus Settings area. Look for the Draw Debug Focus Plane and tick the checkbox on:

With that setting enabled, we should now be seeing a purple plane as in the previous screenshot. That element is there as a visual cue for us to know where the focus plane is, that is, the area that is clearly visible. We need to modify its position so that the elements that we want to see clearly are at the same distance as that plane is from the camera.
- Take a look at the Manual Focus Distance entry box and change its current value until it overlaps the candles. A value of 62.5 seems to be working in this case: You can now disable the focus plane if you want, as we've made sure that the area in focus is where we want it to be. That was the most fundamental value we needed to change – let's take a look now at what other options we can play with.
- As we want the candle to be the protagonist of this shot, let's increase the value Current Focal Length. Locate that setting and change the current value of 55 to something like 120. This should make the candle occupy a bigger space in our screens:

As things stand now, we have our main element in focus whilst the rest of the scene has been been blurred. We can play with the aperture of the camera to increase or decrease this effect.
- Head over to the Current Aperture value. As it stands, the value we can find in the adjacent box should be 2.8. This means that most of the objects that are placed before or after the focus plane will be out of focus—so let's play around with that number to make the effect a bit more subtle. I've chosen a value of 10, but make sure to set it to whatever you like!:

And having done that we've pretty much covered all of the settings that you need to be aware of in order to manually set up a cinematic camera depth of field effect. The main fields that we need to adjust are the Focal Length, the Aperture and the Focus Distance, much like in a real-world camera. We don't take the ISO into account as we don't have to deal with that problem in Unreal. Something I'd like to mention before we move on is the availability of other post process effects within the camera actor. Even though we've mentioned that before, let's tweak one of these values just to demonstrate how to control them within this actor.
- Still on the Details panel for the Camera01, scroll down to the section named Rendering Features. Even though we haven't covered this section yet, I feel as if we could enhance the look of this scene by modifying one of the values that can be found within it. In particular, expand the Ambient Occlusion category and set the following settings as per the next screenshot:

Don't worry for now about understanding how all of the previous settings work—we'll come back to them in one of the next recipes. What we are doing at this stage is showing how different post process effects can be used outside of the post process volume actor. This setting is particularly useful for our cinematic camera, as we are defining the impact that the ambient occlusion has in this particular shot, which might not be the same amount we would like to use throughout the rest of the scene. Let's finally check one last image to see what the difference is after we've applied the effect:

The changes are subtle, but if you look closely at the area where the bottom of the candle and the table surface meet you can see that it's slightly darker than it used to be. This effect, used moderately, can enhance the look of a scene by making it a bit more believable. We'll explore it further later down the road.
- Spring Cloud Alibaba核心技術與實戰案例
- Learning C++ Functional Programming
- Flink SQL與DataStream入門、進階與實戰
- Visual Basic程序設計(第3版):學習指導與練習
- Java開發入行真功夫
- C/C++常用算法手冊(第3版)
- 深入淺出Android Jetpack
- 琢石成器:Windows環境下32位匯編語言程序設計
- Building RESTful Python Web Services
- Python數據結構與算法(視頻教學版)
- Delphi開發典型模塊大全(修訂版)
- Arduino機器人系統設計及開發
- Scratch從入門到精通
- 算法秘籍
- WordPress Search Engine Optimization(Second Edition)