- Unreal Engine 4 Shaders and Effects Cookbook
- Brais Brenlla Ramos John P. Doran
- 1051字
- 2021-06-24 14:12:17
How to do it...
Let's start this recipe by looking through the camera's lens. This is something we have usually done throughout the current chapter, and we've always done that with the hope that certain effects that we are going to use will be better visualized if they are seen from that particular camera location. This is still the case in the current recipe, since we are going to explore screen space reflections and we need to make sure that they are visible. With that said, this is the image we should be seeing once we are looking through the camera:

Having that image as a reference will let us check many of the post processing effects we are about to introduce. Let's start with the first one—choosing the default Anti Aliasing method:
- Head over to Edit | Project Settings. In there, navigate to the Rendering section under the Engine category. Once inside, scroll even further down to the panel called Default Settings and look for the anti-aliasing method. Make sure that it's set to Temporal AA, which should be by default. You can keep that value throughout the rest of this recipe, or try to change it if you want to see a difference. We'll be exploring this further in the How it works... section, but we need to have something at this point for the next steps to happen:

The quality of the anti aliasing can be controlled via console commands, both in game and in the editor.
- Open up the command console by tapping the tilde key in your keyboard. Type r.PostProcessAAQuality 6 to set the quality of the temporal anti aliasing to the maximum the Unreal will allow you to. Feel free to set it up to anything between 0 and 6, which is the range said command is expecting:

- Another command you can use to quickly change between the different anti aliasing methods is r.DefaultFeature.AntiAliasing. Following that command with a value of 0, 1 or 2 will toggle between no effect, FXAA or TAA:

As you can see from the preceding screenshot, the difference in the quality of the AA method is really visible if we go from zero to two, or from two to four. Going as high as six doesn't seem to be doing much in our particular scene, but could be useful when heavy aliasing happens in thin objects such as cables. Next up, we are going to be looking at the screen space reflections. With the post process volume selected, head over to the Details panel and scroll down to the Rendering Features settings.
- Expand the Screen Space Reflections section and tick the Quality checkbox. By default this should be set to 50 increase it to 100 instead.
- While in here, do tick as well the parameter called Max Roughness. Its default value of 0.6 might be a bit low for many cases, so let's raise it to 0.8:

We'll explore in further detail what those parameters are affecting in the There's more... section, but this setting basically increases the quality of the screen space reflections effect. These can be quite important in some scenes, in particular in those where we have dynamic objects moving around which can cause reflections to update in real time. They are limited in that they can only reflect what is on the screen, so things that are behind the camera or at the very edges of the image won't be picked up. Another rendering feature we can include is the Ambient Occlusion. It works on a post process layer by analyzing the scene and determining which areas should be darker according to how occluded they are.
- Expand the Ambient Occlusion section and tick the Intensity checkbox, as well as the Radius one. Give the first parameter a value of 0.3 and go with 10 for the second one.
- Expand the Advanced section while still within the Ambient Occlusion tab. Check the two tick-boxes where it says Radius in WorldSpace. By doing this, we are ensuring that the value of 10 we have previously specified means 10 centimeters in world space units:

The last setting that we are going to talk about is the Screen Percentage. This setting can be found under the Misc section of the Rendering Features category. What we basically control through it is what you might know as Supersampling; let's try it out.
- Check the Screen Percentage checkbox and increase the default value of 100 to something like 200. Be careful though this has a great impact on performance and you should be careful when choosing a number in this box. You can read more about this in the next section, How it works...
- In order to test this setting we actually need to play the game. As it is a runtime effect, we can't visualize its impact on the main viewport of the Unreal editor; instead, click on the Play button at the top of the main Toolbar:

Before we go, I'd like to leave you with some images from this scene taken under different Screen Percentage settings. They should be representative of the changes in image quality that Supersampling introduces or upscaling, which is the term used when the screen percentage is lower than 100:

- C程序設計簡明教程(第二版)
- Arduino by Example
- Vue.js 3.x從入門到精通(視頻教學版)
- Clojure for Domain:specific Languages
- 數據結構習題精解(C語言實現+微課視頻)
- JavaScript前端開發與實例教程(微課視頻版)
- SQL Server 2016數據庫應用與開發
- PLC應用技術(三菱FX2N系列)
- Learning PHP 7
- Android嵌入式系統程序開發:基于Cortex-A8(第2版)
- FPGA嵌入式項目開發實戰
- Practical Predictive Analytics
- Learning Kotlin by building Android Applications
- 征服C指針(第2版)
- 從零開始學算法:基于Python