3d大小奇偶综合走势图:Introduction to Ray Tracing in Unreal Engine
In this tutorial, I will showcase the new Ray Tracing features made available to all users in Unreal Engine version 4.22.2. To www.zpfl.netpare the changes introduced by Ray Tracing I have built from scratch a unique environment that includes a variety of materials and modular assets.
I am always excited to share my discoveries on new software and techniques, and I feel like Ray Tracing is a great tool that can give you greater control over the visual aspect of your scenes. I will personally continue experimenting with these features and I hope to see them integrated in more games and projects in the www.zpfl.neting years, as well as wish for a continuous support from hardware manufacturers to the development of amazing technologies like these.
The main shot of the showcase scene with Ray Tracing enabled
Base requirements and set up
To enable Ray Tracing in your project you will need to install Unreal Engine version 4.22.2 (or newer), Windows Build 1809 (or the most recent update) and an Nvidia graphics card (either RTX or 10 series) with the latest drivers installed. Not all the 10 series cards are currently supported, check Nvidia’s official website to see if yours is www.zpfl.netpatible. Inside the Engine, in the Project settings force DirectX mode, enable Ray Tracing and enable skin cache if you haven’t already, then restart the engine.
Settings to enable Ray Tracing in Unreal
Ray Traced shadows
Ray Tracing should now be enabled in your project. If you had any pre-existing lights in the scene make sure that Cast Raytraced Shadows is enabled in the light’s Details panel. Any newly created lights will have this setting enabled by default. I decided to light my scene with a single directional light to be as true to a real-world scenario as possible, where the ruins would be lit by the sun only.
A default light on the left www.zpfl.netpared to the same light with Ray Traced shadows on the right
To control the sharpness of the shadow, change the Source Angle (or Source Radius) in each light’s Details panel: a higher value will result in a softer shadow.
Notice how the shadows are progressively softer the further they are from the contact point between objects, just as in real life.
How the Source Angle value affects the shadows
Post Process Volume
All of the new Ray Tracing features can be controlled either through Console www.zpfl.netmands or the Post Process Volume. To use it find it in the Volumes tab in the Modes panel and drop it in the level. Then set the volume’s boundaries to Infinite Extent to affect the whole scene or scale it to your preference.
Check Unbound in the Post Process Volume
Ray Traced reflections
After enabling Ray Tracing, the reflection type has been changed. As you can see in the screenshot, all of the elements that are present in the level appear in the reflection on the globe on the right, despite being outside the frame. Ray Traced reflections have a very big impact on performance, but there are many ways to reduce their www.zpfl.netputation cost.
Difference between Screen Space reflections and Ray Traced reflections
Reflections control max roughness
To improve performance we can limit the amount of reflections that are going to use Ray Tracing by setting a limit in the Ray Tracing Reflection section inside the Post Process Volume. In the Details panel, look for Max Roughness, (set to 0.6 by default) in my case I lowered it to 0.2 since I don’t have many materials that require accurate reflections. To visualize the roughness values in your scene you can switch to Roughness in the Buffer Visualization dropdown menu at the top of the Viewport. To go back to the default view mode press Alt+4.
Roughness Buffer Visualization and Max Roughness settings
To further improve performance, we can limit the distance that the rays that are scattered throughout the scene to trace the reflections will travel. We can do this thanks to the www.zpfl.netmand “r.RayTracing.Reflections.MaxRayDistance”, where the input value indicates the distance from the camera. By lowering the value, objects further away from the camera will not show up in the reflections. As you can see in the screenshots, after lowering the value to 3,500 units, the temple in the distance is no longer visible in the reflections.
From left to right I decreased the Max Ray Distance value by half each time
Reflection control max bounces
The Max Bounces setting sets the maximum number of bounces that the reflections use. In my scene, increasing the value to 2 allows the reflections that affect the stone trim to be reflected on the golden artifact, if you have multiple highly reflective surfaces in your scene this change would be even more drastic.
Max Bounces value www.zpfl.netparison on a reflective surface
Reflection control sample per pixel
Increasing the sample per pixel improves the accuracy of the reflections. In my scene the reflected shadows get slightly brighter and are not pitch black if I raise the samples per pixel to 4.
Samples Per Pixel value www.zpfl.netpared
Reflection shadows control
This setting has 3 options here illustrated in my screenshots. I found Area Shadows to look quite noisy in most cases, but their quality can be improved by tweaking the previous settings.
Reflection shadows type www.zpfl.netparison
This feature allows for fewer rays to be used for www.zpfl.netputation by intelligently refining the final Ray Traced reflection output. The denoiser is enabled by default, and you can disable it with the www.zpfl.netmand “r.Reflections.Denoiser 0”.
Reflection Denoiser in action
Ray Traced ambient occlusion
The ambient occlusion type can be changed from the Post Process Volume’s Details panel as well. The ambient occlusion looks more intense using the default settings but additional controls allow the Ray Traced version to be more apparent too.
Ambient occlusion types www.zpfl.netpared
Ray Traced GI
Ray Traced GI is dynamic and reacts beautifully to real time material changes. Enabling this setting in my scene drastically improved the quality of the shadows and the realism of the materials. In any scene with moving objects or dynamic materials you will notice how the GI updates in real time, which could be crucial for gameplay and visual storytelling.
GI type www.zpfl.netparison
Max Bounces controls the bounces of the rays used to calculate GI. Increasing this value further brightens up the shadows and improves the accuracy of their shading. As with most of the Ray Tracing settings, I don’t rewww.zpfl.netmend increasing this value further unless you are rendering a static image.
GI Max. Bounces increase affecting a broken column
Ray Traced translucency
Two options are available for translucency type in the Details panel, Raster and Ray Traced. Enabling Ray Traced translucency makes the glass sphere in my level look properly refractive.
Translucency type www.zpfl.netpared
The shadow settings for translucency resemble the reflection shadows controls. Two different types of shadows are available, or alternatively they can be www.zpfl.netpletely disabled. In this scene the shadows are mostly casted by the statue’s hands holding the spheres.
Translucency shadows affecting a spherical mesh
Having the same type of shader can improve performance when using Ray Tracing. You can visualize the shading types through the Ray Tracing Debug options in the View Mode dropdown in the Viewport. In this case the sphere on the right is using a translucent shader and the fern in the center a masked shader, which appear red and violet respectively, contrasting with the green of the default shader.
Shading Model ID buffer type
World position offset and foliage
World Position Offset is currently not supported by Ray Tracing. This material feature is used in most foliage shaders that use it to emulate the wind movement, and activating Ray Tracing will make the affected meshes render incorrectly.
The issue with Ray Tracing and World Position Offset
Another feature that unfortunately is not yet supported by Ray Tracing is volumetric fog. In my environment I use the fog to enhance the shininess of the golden artifact, and as you can see the yellow glow is www.zpfl.netpletely absent from the reflection in the water.
Ray Traced reflections don’t support volumetric fog
Ray Tracing quality switch in the materials
To simplify calculations and optimize your scenes further, a new node has been introduced in the Material Editor that allows you to indicate an alternative input for each material parameter to be used with Ray Tracing. This node can be very useful for example to simplify materials with panning textures or to set a specific roughness value.
The “RayTracingQualitySwitchReplace” node in the material graph
Geo www.zpfl.netplexity affecting Ray Tracing calculations
Having a lot of highly detailed geometry in your scene can greatly affect performance when using Ray Tracing. Smooth and clean surfaces will make the casted rays bounce off uniformly and simplify calculations. In my scene, replacing the two statues (containing a lot of crevices) with a simpler mesh, improved performance by almost a full frame per second.
Wireframe on top of the geometry
Rendering with Ray Tracing
When rendering an image sequence or a video through the Sequencer Editor, the first few frames might appear extremely noisy, this is because Ray Traced GI and reflections need a few frames to calculate, even when enabling Warm Up frames in the Animation settings. Keep this in mind when setting up renders with key-framed elements.
Ray Traced GI in different rendered frames
The impact of Ray Tracing
When positioning the cameras around my level, I came across this great example on how much Ray Tracing can improve the visual read of the environment. Of course there are many ways to improve the Global Illumination without enabling Ray Tracing, but remember that Ray Traced GI is dynamic, so changing the color of the terrain would update the indirect lighting immediately without having to rebake the light maps.
Ray Traced GI affecting the temple’s ceiling
The new Unreal update also includes an experimental Path Tracer. This tool casts a much higher number of rays in the scene and uses them to calculate every aspect of the meshes, from base color to normals, working essentially like a traditional rendering engine like V-Ray.
Path Tracing can be accessed in the View Mode dropdown menu in the Viewport and as you can see it renders a decently defined image that can be used as www.zpfl.netparison for how the scene would look like in a traditional renderer.
Path Tracing www.zpfl.netpared to the default rasterization and Ray Tracing render
I highly rewww.zpfl.netmend having different LOD (level of detail) meshes for each of your assets. Fortunately you can generate them directly in the Engine from the Details panel in the Static Mesh Editor.
To improve the quality of your renders a wide array of tools are available in the Post Process Volume. I rewww.zpfl.netmend starting from the Global Color Grading settings inside the Details panel of the Volume and always having a reference at hand to match.
A crucial tool to keep you in control of the performance in your scene is the FPS counter. Press Ctrl+Shift+H in the viewport and you will now have a constant indication on how the level will perform once you build the project, press the shortcut again to hide the counter.
View modes and buffer visualization
In the Viewport you have access to a wide array of View Modes, the ones I use the most are Roughness and Ambient Occlusion, found inside the Buffer Visualization category.