>>Matthew: Hi. I'm Matthew Doyle. I'm a Technical Artist, and I've
worked in video game production as well as
architectural workflows for nearly two decades now. I'm going to be walking you
through the basics, including best practices, setup,
some tips and tricks, and so forth, on using real-time
ray tracing in your Unreal Engine architectural
scenes today. So I hope you enjoy
this presentation, and I look forward to
your questions at the end. Let's get started. Here are some of the
topics that we're going to spend some
time looking at today. We only have about 30 minutes
for the presentation today. We'll have about 10
or 15 minutes of Q&A, and we're going to try to
cover the basics, as well as a few tips and tricks,
and some best practices. We'll start out with
requirements and setup for using ray tracing
in Unreal Engine, and it's quite easy
to get started. We'll look briefly at working
with materials for ray tracing. We'll talk about lights
and shadows, which are a very important part of
doing real-time ray tracing, as well as global illumination,
reflections, and translucency. We'll also take a brief look at
some of the console variables, or as we call them
CVars, inside of Unreal that can help you
with ray tracing, as well as some
debugging techniques. Finally, with the
last bit of our time, we'll briefly touch on
the path tracing tool, and that's going to
allow you to create very high-quality renders. And then also, we'll look
at the high-quality media export, which can be used in
conjunction with ray tracing to create very high-resolution,
high-quality final rendered movies or still images. We'll be jumping into
Unreal here in just a moment to look at setting up our
ray tracing environment, but before we do,
there are some things to take into consideration. You're obviously going to need
a ray tracing capable video card or RTX card. And NVIDIA make several
lines of these cards. I am using an RTX 208TI,
which is a gaming card. And in most cases,
that's going to be fine. You can use one of those
gaming cards for your projects, but there are some higher
level options available to you, including the Titan card, or
using a Quadro card instead. Now, I often get asked what the
difference is between a gaming card and a Quadro card, and
it's actually quite important. So if you're in an
enterprise environment, you're a large company, and
you really need reliability, and you need support
from NVIDIA directly, you'll probably want to
go with a Quadro card. Because NVIDIA manufacturers
those cards themselves, and so they have a very
high-quality standard. And, of course, you get
direct support from them whenever you have issues. If you're working
with a gaming card, you may not get that
same level of quality. And then on top of
that, you're not going to get that direct
connection to NVIDIA when you need help. The other thing
we'll want to do is, obviously, make
sure we have Unreal Engine 4.25 installed, or
better, inside of our launcher. Keep in mind that ray tracing
was introduced before this, so you could use
an older version, I believe, going back to 4.24. But we're going to be working
with the newer version so we get all the latest and greatest
bug fixes and optimization improvements. In fact, it's in 4.25 that the
ray tracing solution in Unreal has been deemed as
production ready. We're going to be working
with a project that is freely available from Epic. If you go to the Learn
tab in your launcher, and if we scroll
down just a bit, we'll find the project here. It's called ArchViz Interior. Now, this scene is
fully ray traced. There's no baked lighting, and
we'll be looking at it here in a moment. But it demonstrates
all of the features available to us in the
real-time ray tracing solution inside of Unreal Engine. And, of course, you'll want to
create a new project with it. Before we go over
to that project, though, let's just go ahead
and launch Unreal Engine 4.25 by itself without
selecting a project. And we're going to
create a new project and look at how you enable ray
tracing for any new projects. So in the Unreal
project browser, we're going to click on AEC. We'll go ahead and leave
it as a blank project. And now here for the
project settings, we're going to set Ray
Tracing to Enabled. And that's all
there is to enabling the settings for a new project. And we'd simply continue from
here naming our projects, picking a location we
want to save it to, and then creating it. Now, let's assume
that we have a project that we created and
didn't set ray tracing enabled for that project. But now, we've changed
our mind, and we want to go back and
enable ray tracing for this particular project. We need to go to our Settings,
and then Project Settings. And from here, we'll
scroll down to Platforms, and we'll choose Windows. We want to make sure
that Default HRI is set to Direct X12. Now, let's do a quick
search for ray tracing. And we want to make sure
that ray tracing is enabled. And you'll see that
when we do that, we need to restart our project. Let's go ahead and do that. Now, before we begin
adding lights to our scene and setting up all the
ray tracing effects, there are some things to
keep in mind about materials. So Unreal uses a
physically-based materials system or
physically-based render. Everything in Unreal
that's related to lights, materials, basically
everything that gets rendered to
the screen, is tied to this physically-based system. And the great
thing about that is is that means that
everything is unified. It's going to give you the
correct look regardless of what lighting scenario you're
in without you having to make any kind of tweaks to
the materials themselves, and it's also an
easy to understand system based on
real-world physical laws. So really, in the
old days, you would have to change things,
like glass maps and things like that. But with the physically-based
system in Unreal, you're really just
working with your base color, or your
albedo, as well as your metallicness, whether
an object is metallic or not, and its roughness. Of course, you can
work with other inputs in a material, such as
normal maps, or emmisive, or anything like that to
create special effects, but these are really
the three primary inputs you work with when you're
working with PBR materials inside of Unreal-- base color, metallic,
and roughness. Now, when working with
base color for ray tracing, there are some things
to keep in mind. First of all, you want to
avoid high contrast base color materials or textures. You want to keep them
kind of low contrast so that they'll
look more realistic. And another important
thing to keep in mind is that in nature, there are no
pure black or white textures. So, for example,
charcoal is considered one of the darkest
surfaces known to man, and its intensity
value is about 0.02. So it's not all black. It's not just 0. Likewise, snow, considered one
of the whitest surfaces known to man, has an intensity
value of about 0.81. You don't want to work
with the extreme values of black and white, because
they will make your images look less realistic. Let's jump over
into Unreal and look at a quick example of that. So here in our ray trace scene,
we have this black vase here. And if we go and select that and
bring up the material instance for it, I'm going to make
some quick tweaks here to the RGB values of it. So this is our base color tent. This is the color that
we're applying to it. You can see it looks
very dark, very black. But the reality is is we're not
using a value of 0 for our GMB. We're using a value of
0.1 for all of those. So if I were to
set this to 0, you can clearly see the
difference it makes now. It is much, much darker. In fact, it's so dark, it
looks very unrealistic. You don't see a lot of
light bounce off of it from the ray tracing solution. So to get that to
come back to get a more realistic
contoured shape, we need to bring this back up
to something more realistic. So setting this
to a value of 0.1 is going to make
a huge difference. Now when working with ray
tracing and materials, there are some
considerations that are going to help improve the
performance of your scene. First of all, there
are some things you're going to want to avoid. You want to avoid
complex normal maps. So any normal maps that have a
lot of high-frequency details, little bumps and so forth, keep
in mind that normal maps are going to simulate light bouncing
off of little perturbations on the surface in a
realistic fashion. And obviously, the more
those perturbations are, the more random the
light bounces would be, and therefore, the
more costly it's going to be for ray
traced lighting. Same thing happens
with roughness. So roughness is, again,
simulating the roughness of a surface, so a
little perturbations that make a surface either
very rough or very smooth. Obviously, a
roughness with 0 would be like looking at a mirror,
so very, very flat and smooth. And the reality is a
mirror-like surface is actually much,
much cheaper to render than a rougher surface. Because we can predict very
accurately which direction that light ray is going to go
on a very flat, smooth surface. But a rougher
surface, that's going to cause the light
rays to bounce in a more random fashion, so
the algorithm is more complex. And like any
material, you're going to want to avoid high
instruction counts. The more instructions
your materials have, the more expensive
they are to render. Now, there are a
couple of things that we can work
with inside of Unreal to visualize these
things and some tools in the material editor
that will allow us to make our materials more
or less complex, depending on if we're
using ray tracing. So let's go ahead and
jump over to Unreal and look at a couple of
these things real quick. So here inside of our
fully ray traced scene, we can actually disable
all ray traced materials to see the difference
in appearance as well as what kind
of performance costs we have for our materials. And it's a global switch. It's using a console variable. So what we're going
to do is we're going to hit the Tilde
key on the keyboard to bring up our command
prompt, and you'll see it at the very bottom
there of my screen. And first of all, I'm going
to turn on some statistics so I can see how well
my scene is rendering. We'll start out with
a simple stat FPS, and that gives us
our frame rate there. So I'm rendering at about
60 frames per second. And keep in mind that
I'm also recording with recording
software, and so forth, so this is going to have an
impact on my rendering time. And I'm going to bring
my console back up and type "stat unit,"
and that's going to give me the actual amount
of time in milliseconds for each aspect of the
rendering pipeline. So the game timing
there, that's going to be CPU draw, that's the
CPU telling the video card to render things. And GPU, that's how much
time is spent on the GPU. And so basically, you can
see where your bottleneck is. So it looks like my bottleneck
is going to be in GPU time here, which is about
17 milliseconds. But let's go ahead and
disable our materials now, our ray trace materials. So bringing the console
back up, I'm going to type, R.RayTracing.Enable. And we want this right
here, enabled materials, and I'm going to set it to 0. Now, you see when I do that,
everything gets much darker, because all of the materials
have been now fully disabled for ray tracing. So there's no bounced lighting
or anything coming off of them. And you can see my
frame rate has jumped up by about 10 frames per
second, in this case, and my GPU time went down from
17 milliseconds to about 14 to 15 milliseconds. So it's not a huge savings
in the case of this scene. This scene might not be
as complicated or complex as some other scenes would be. So we're not getting
a huge savings here, but 10 frames per second can
really make a difference, obviously, in some cases. So, for instance, if
I were to just move my camera around here,
obviously, the scene is much darker. We're not getting
the bounced light. Likewise, over here on
the TV, the screen here, it's only being affected
by a cube map reflection. So we're not getting those
nice ray traced reflections. Let's go ahead and turn
our materials back on. I'm simply going to use the
value 1 instead of 0 here. And you can see right away
that the reflections are back. Now, we've got a nice,
accurate ray traced reflections in the TV, and our
lighting is much brighter, because we're
getting more of that bounced to light coming in. Now, another thing we can do to
help our material performance is use a material node
or expression called Ray Trace Quality Switch. So to see how to use that,
we're going to select the floor material here, and we'll open
up its material instance. Inside the material instance,
we'll find the parent material and open that. So you can see that
this material is already making use of the node. So this note here is Ray
Tracing Quality Switch Replace. And so what it's
doing in this material is it's got two different
attribute nodes here that are basically being
used to create the material. So in the case of this
first attribute node, Make Material
Attributes, we're popping in the base color, the metallic,
specular roughness, as well as normal maps, and
ambient inclusion, and then that's going into
the normal input of our Ray Tracing Quality Switch Replace. And, of course, if you
want to get this node, you'd simply
right-click and then type ray tracing,
and you want Ray Tracing Quality
Switch, just like that. So this normal input
here is telling Unreal to use this branch
whenever we're not ray tracing. But if we have ray
tracing enabled, we want to use a
different branch. And so here is the
second branch here, and this one is just using base
color metallic and roughness. We don't have any normal
maps piped into this one. And then that simply goes into
the ray traced input here, and that will output to
our final material node. Now, there are some
debugging tools for ray tracing to show different
visualizations inside of our viewport that can
help us to determine things like roughness. Remember, very
rough surfaces are going to be more
expensive to render than very smooth surfaces. So if we click on the
View Mode button here, and we go down to
Ray Tracing Debug, we can see we have a lot of
options here to work with. And we're going
to pick Roughness. So here in this view
mode, we're seeing the grayscale representation
of the roughness values of every object in the scene. So anything that
is black, that's going to be a very
smooth surface, like a mirror-like surface. And so for instance, if
we look at the TV here, obviously, this would be a
very smooth screen surface. So if we go back
to our lit mode, we can see the ray traced
reflections on that very clearly, and
that's going to be a very cheap surface to render. But if we look at any of these
other surfaces, so for instance the walls here, these
are very, very rough. Likewise, you can
see here's kind of a middle ground on the table
that's got some stripes here from the wood pattern,
but very gray. So that's a very middle
tone rough surface. So for instance, if I were to
select this surface, and then we can go down to
the material on that. Here's our wood material. And so in this case, we're
using a roughness texture. Let's go ahead and open that up. So this is our
roughness texture. And we were to turn off the red
channel and the blue channel. This is our roughness texture
here in the green channel. So you can see, it's a very
gray, very evenly toned gray. So it's going to be
kind of a 50% roughness here on this table,
and this is going to be pretty expensive to render
for ray tracing because of all of these perturbations
in the wood pattern and the relative middle
tone of the roughness. Now we've had a
good look at working with materials when
doing ray tracing, we're ready to move on. So let's go ahead and
actually start adding lighting into our scene here. I've loaded up a version of
the scene that has no lighting inside of it whatsoever. So if we were to go
to Lit Mode here, we're going to see
everything is just black except for some
emmisive objects there. Go ahead go back to Unlit. And inside of Unreal,
we have access to all of the same lights
that we normally use. For baked lighting, to do our
real-time ray traced lighting, we can use directional
lights for our sunlight. We can use point lights,
and spotlights, as well as rectangle lights,
which are area lights. And finally, we
can use a skylight to mimic the ambient
lighting of the sky. So we're going to go over
to our World Settings. And then under the Light Mass
settings of our World Settings, we're going to find Force
No Pre-Computed Lighting, and we're going to enable that. And this is going to
make sure that we're not going to have any baked
lighting in our scene. It's not going to try
to bake light maps or anything like that. So we'll go ahead and hit OK. Now, we could use a skylight to
simulate our ambient lighting. But instead, I'm going
to be using some area lights in the windows. Now, you can see there's
quite a lot of bloom here, and that's because
we need to make some adjustments to our
environment's post-process settings. And we just need to make
this line up basically with the window there. So we'll make some tweaks
to the width and the height. Now, before we add our
Post-Process Volume, there are a few more things
we need to do to any light that we add to the scene. First of all, remember, we're
not baking our lighting. This is fully dynamic
real-time ray trace lighting. So we need to set this
lighting's mobility to Movable. And after that, we're going to
scroll down under the Lights Settings, and it will go
to the Advanced Options, and want to make sure that Cast
Ray Trace Shadows is enabled. Before we continue adding
lighting, let's go ahead and add in our
Post-Process Volume. So we'll do a search for post
in the Place Actors tab here, and then we'll drag that
volume into the scene. So the Post-Process
Volume, in case you're not familiar
with it, it allows you to add all sorts of effects,
like light bloom, exposure controls, dirt masks, lens
flares, things like that, into your scene. But the Post-Process
Volume is also used to enable, and
disable, as well as tweak the ray tracing effects. Before we go any
further, though, let's go ahead and get our scene
to kind of a clean lighting state. And the way we'll do that is,
under the Post-Process Volume, we want to go through all these
options here and set them to 0. So, for instance, for bloom,
we'll set the intensity to 0. For exposure, we're going to
set the min and max values here to 1. And then we'd want to go
through all these other options here and make sure that they
are all basically disabled, such as lens flares,
again, setting that to 0, and so forth. And finally, we want to
go down to the-- towards the bottom of our
post-process settings, and we want to make sure that
Infinite Extent is checked. And that's going to
make sure that all of these post-process
settings we're setting up are going to apply
to the entire scene whether we're inside
the volume or not. So right now, we're
not using any ray traced lighting or shadows. We'll get to that
in just a second. But let's go ahead and add
one more area light here on this window. And we'll go ahead and add
in our directional light now. Now, again, you can see we're
getting our little preview indicator here
letting us know we need to change the settings
on this light as well. We'll go ahead make it moveable,
and that should go away. Now, in order to have
ray traced shadows, this is really all
you have to do, is place the light in the
scene, set it to Movable, and make sure that under
the Advanced Options here, Cast Ray Trace
Shadows is enabled. Of course, we're not getting
any bounced light going around the scene or
anything like that, but we are getting the
ray traced shadows. These shadows are
fairly crisp, but we can adjust that very easily. If we go up to our
Lights Options here, and we should see this
option here, Source Angle, we can tweak this to make the
shadows a lot more diffused. So I'm going to set my source
angle to about 0.5 degrees. Now, keep in mind,
this diffused effect on the shadow of the
ombre of the shadow here, it's actually going to be
softer the further away from the object that the
light source is shadowing. Ray trace shadows are
actually considerably cheaper to use and visually
provide a great effect. So now, let's look at how
we can bring in some ray traced global illumination,
as well as reflections, and translucency. And to do that, of course,
we're going to need access to our Post-Process Volume. And then under
Post-Process, we're going to go down under Lens
and find the Rendering Features Rollout. And in here, we're going
to find all the ray tracing options available to us. So the first option we have is
ray traced ambient occlusion. In this case, I'm not going
to be using ambient occlusion. We're just going to use the
built-in screen space ambient occlusion. The next one up is going
to be global illumination, and the global
illumination option is going to allow us to get that
nice bounced lighting effect. Let's go ahead and turn that on. It's going to be found under Ray
Trace Global Illumination here, and then we're going to change
our type from disabled to one of two options here. So first of all, we
have brute force, and brute force is going to
be the more accurate version of global illumination. The lighting algorithm is
very accurate, but also quite a bit slower to use. So you can see, I'm getting
about 50 frames per second here, and it's taking about
20 milliseconds on the GPU to render this. Now, I'm going to switch
to Final Gather instead, and we can see that my frame
rate practically doubles. And now, I'm rendering
it 10 milliseconds. Now, you may not notice
much of a difference. It does look slightly
noisier, but this method, this algorithm, is going
to be the faster option. But just keep in mind,
it's not as accurate. It is a slightly less
accurate algorithm. Now, keep in mind, when you're
using final gather, the max bounces and samples
per pixel options here, these aren't going to
really do anything. It's pretty much locked to the
default value of one bounce and four samples per pixel. But if we were to go
back to brute force, we could increase the
number of bounces. But you'll see when I do
that, obviously, it gets much more expensive to render. Now, obviously,
we want this scene to be a bit brighter than this. We could add some more, as
I said, some more rectangle lights over here to bring some
light in from that direction. And there are some other
things we can do here. We can increase the brightness
of these two lights. So if I select them, I can
change those from 8 candelas to 16, essentially doubling
their brightness in effect here. And it's really
nice, because you can see how the lighting is
just bouncing around the scene thanks to the
real-time GI effect. And another option, of course,
to increase our brightness is to work with our
exposure controls. So if we go back to the
Post-Process Volume, and then go back
under Lens, we'll find our exposure options here. Now, by default it's using the
metering mode auto exposure histogram. And currently, we've
locked the auto exposure to values of 1 and
1, locking them at the baseline state
for your exposure. Now, here are some
common exposure values that we could use here. These exposure
values are for EV100. So that's going to be
ISO 100 exposure values. And so, first of all, we
have outdoor or daylight. Those values are anywhere
from 12 to 15 EV. And then we have home interior. That's what we're
going to be using here, somewhere between 5 and 6 EV. And finally, if you were doing
something like a large window office area, you could
have something from 7 to 8 EV usually for your
exposure value. So in this case, we'll
set our min EV and max EV both to about a value of 5. Now, with our
exposure value set, it gets quite a bit darker. So we're going to go ahead and
increase the lighting in here. So we'll start
with our sunlight, and I'm going to change
the intensity from 10 lux to about 1,000 lux. And then I'm also going to
change our rectangle lights here from 16 candelas to 1,500. And that makes our
scene much brighter. And we're going to
go back to Exposure. Let's go ahead and set our
exposure compensation to 0. We don't need any of that. And let's just tweak our min
and max a little bit more. Let's set these to about 5.5. So from here, under our
Post-Process Volume's ray tracing features, we've
looked at ambient occlusion and global illumination. Next up, that's going
to be reflections. So if we open up
Reflections here, we can see that we have the
ability to change the type. Now normally, we'll be using
screen space reflections. And so if we get a little
closer to an object here, and then go from screen
space to ray tracing, you'll be able to
see the difference in the quality of reflections. Now, screen space reflections
are fairly good quality, but they only apply when
an object is on screen. Whereas, with ray
traced reflections, these reflections are more
accurate and always visible, regardless of whether an
object is on screen or not. But there are still
some dark areas, and that's because
we're probably not getting enough bounces. For that, we'll open up the Ray
Traced Reflections option here, and we'll look at some of these. First of all, we
have max roughness, and with max
roughness, we can tweak the quality of our reflections
based on the roughness of the surface, the material. So if I were to bring
this down really low, this is saying that we're
not going to use ray traced reflections unless the
roughness of the surface is below a value of 0.01. And if I bring this up
higher to a value of 1, this means that anything
that has a value of 1 for roughness or lower will
receive ray traced reflections. Next up, we have
max bounces, which is defaulted to a value of 1. So we're only using one bounce
to calculate reflections. To help eliminate some of
these little black areas here, we'll need to bump this up. So I'm going to set this to 3. And you can see
by doing that, we start to see-- so if I
bring this bag down to 1, we're not getting the reflection
between these two objects here. But when I bring this
up to 3, now it's bouncing back and forth
between these two objects and giving us more
of a reflection. And, of course, with
samples per pixel, we can increase the quality. And finally, we can determine
what kind of shadows we see in our reflections
here by selecting Shadows, and we can turn them
off using Disabled. Clearly, you can see
the difference there. Or we can set them
to Hard Shadows, which will be the cheapest
option aside from turning them off. And then we can also
use Area Shadows to get a little higher quality. However, when I turn
Area Shadows on, you can now see that we're
getting a lot of noise in our reflections here. And that's because we don't
have enough samples per pixel. So go ahead and turn
that on, and I'm going to bump this way up
to 32 samples per pixel. And clearly now, we can see
that our shadows are much nicer. We're not getting any
more of that noise. But, of course, our performance
has dropped considerably. We're down to 30
frames per second now. So keep in mind,
this is a way, if you want to get a nice area
shadows in your reflections, you can increase the
quality of those, get rid of some of that
noise by increasing your samples per pixel. But in most cases, if your
reflections are very small, and most people aren't
going to see that detail, just keep your
shadows set too hard, and then turn your samples
per pixel back down to 1, and you should be fine. And so the last thing
we're going to look at is translucency. So for that, I'm going to come
back over to the kitchen table here. And I want to drag an object
from the starter content pack here into the scene. And what we've got
here is a glass statue. And let's go ahead and
reduce the scale of that object down a little bit. So this is the glass statue that
comes with the Unreal Starter Pack. Obviously, this glass does not
look very realistic right now. But we can take advantage
of real-time ray traced translucency as well. The first thing we
need to do is make sure that this material
is set up to work with real-time translucency. And the first
thing we want to do is on the material
result node, we want to make sure that it's
set to translucent, obviously. But then below that, under
the translucency rollout, we want to make sure the
lighting mode is set to Surface Translucency Volume, and this
is a much higher quality, though more expensive,
version of translucency. The other thing to
keep in mind when doing ray traced translucency
is that the refraction input of your
material here does not affect the ray
traced translucency, but instead this specular
input will control that. So we want to make
sure our specular is tied to a parameter. And in this case, it is. So let's go ahead and create
a material instance of that. I've already created
one here, and we'll apply that to the statue. So this material
instance is going to allow us to control
that specular value. But before we can see our
ray traced translucency, we'll, of course, need to
go back to the Post-Process Volume, go back to our
rendering features, and then open up Translucency. And we're going to change
the type from Raster to Ray Tracing. Now, right away without
really doing anything, you can see clearly how
much better this effect is-- much more accurate, much
more interesting-looking. Now, if we open up the
Ray Tracing Translucency options here, we have
basically the same options we had under reflections. We have Maximum
Roughness, and this will allow us to control
how rough a material can be before translucency
will basically be disabled. And then we have
Max Reflection Rays. So if I set this
to a value of 1, we can see the difference here. We don't have
enough rays bouncing through the translucent surface
to make it truly translucent, so we'll need to make
sure we increase that. And as I increase that, you
can see the difference here. Let's go ahead and
add three rays. And now, it looks like we're
getting through the surface pretty well. 4 gave us a little bit more. Let's try 5. So you can see, the
more rays I apply, the further they can
bounce through this surface and pick things up behind it. Just keep in mind, it's going
to get more and more expensive the more rays we
have going through. Just like reflections, we also
have Shadow Quality, Samples Per Pixel. And then last of all,
we have Refraction here. So I turn off Refraction,
you can see now the surface is not applying any refraction. So you're not seeing any
distortion to the light rays as they come
through the surface. So let's go and
turn that back on, and we get that nice refraction. So when you're working to
optimize your scene while still maintaining a high-quality
bar, here are some things that you should keep in mind. First of all, interior
spaces are actually more expensive than exteriors. So all these same techniques
we just looked at work pretty much the same if you're
doing a large exterior scene, but it's actually going
to be generally cheaper. Because if you think
about it, what's happening is in an interior
space, especially with real-time
GI, ray traced GI, you've got the light that
comes in through your window, and then it's going to bounce
around however many bounces you have it set to. And that's going
to be expensive. Whereas, with an exterior
space, the light rays are going to come
in from the sun. They're going to hit a
surface, and most of them are going to bounce right
back up into the atmosphere. And so they will be just
going off into space, and they won't have any more
effect on your calculations. So again, same basic techniques,
but actually cheaper. Remember to avoid using
overly complicated materials. They are going to
be more expensive. And also, reemerge keep
your roughness and normals under control, because
normal maps and roughness are going to increase the
algorithm's render time for a real-time ray tracing. And that's because smooth
reflections are simply much cheaper to render, because
the calculations for that are a very easy
to predict thing. So as far as expense
goes, in order of expense, just keep in mind that real-time
GI as well as reflections and translucency,
those are going to be your more
expensive options to use. Keeping in mind that Unreal is
a hybrid ray tracing solution, and so you can pick
and choose the ones you want to use
that have the most visual impact while having the
least effect on performance. And that's going to depend
from scene to scene. If you have a scene that has
a lot of reflective objects in it, you're going to want
to use real-time ray traced reflections. Likewise, if you have a
lot of translucent objects, you'll probably
need to use that. And in real-time GI, remember
you have two options. You can go with
brute force, which is more accurate, but much slower. Or you can go with the
final gather solution, which does a really good
job of approximating the full ray trace algorithm. Now, we did look at console
variables today a little bit. There are some other
options that you have available to you to help
you with your performance. I've listed a few
good ones here. Some of them are good for
modifying your performance, and some of them are
just good for debugging. So for instance, we
already looked at RayTracing.EnableMaterials. We can also enable and disable
all ray tracing effects entirely using the
second one here, and that's going to be
r.RayTracing.ForceAllRayTracingEffects. Let's jump into the scene
and have a look at that. So if we bring up our
console with tilde, and then type
r.RayTracing.ForceAllRayTracingEffects and we set that to 0, all
ray tracing is now off. So we're not getting
any bounced light, any ray traced reflections, or
translucency, and ray traced shadows, and so forth. And so let's go ahead and
turn that back on now. Take note of the
performance there. And we can see with
everything turned back on, we only lose maybe
5 or 10 frames per second, in this case. So it's a good way to
quickly turn those off, see what your performance
is like without them, and then turn them back on,
and you can see the difference. And then last of all,
another one we can look at is going to be Max
Ray Trace Distance. And each of the options
has this available. So if we do
r.RayTracing.-- let's say GlobalIllumination,
and then do MaxRayDistance And if we set this to
something really low, like 10, you can see what happens there. This is, obviously,
way too low of a value, so you start to get some
splotchiness and some noise there. So we want to make
sure that we have that set to a high enough
value to give us a good quality look while
maintaining a good performance rate. So you can go through here and
tweak these max ray distance settings for each effect. So just keep in mind that
by increasing and reducing the max ray distance,
you can affect the performance of your scene. And so you want to basically
find the sweet spot where everything still
looks good while maintaining as much performance as you can. And then the other thing we'd
want to talk about briefly is your debugging tools. We've already looked
at how to bring up stat FPS as well as stat unit. And in stat GPU,
you're going to find all of the ray
tracing passes here and how long they're
taking on average, max, and minimum in milliseconds. So we can see we've got
our primary ray pass here for ray tracing taking about
2 milliseconds on average. Below this, we have
GI reflections. We've got our ambient
occlusion and so forth. So here, you can see exactly
what your bottleneck is. Now, there's two last things
I'd like to briefly talk about today, and that's going
to be getting rendered outputs of your ray trace scenes. Obviously, this is
mostly for real-time ray tracing so you have
real-time 3D visualizations. But you can render out
movies and screenshots at a high quality. So if we go back to our
Post-Process Volume, the first option
available to us is going to be found under
our Rendering Features where you find the
ray tracing options, and that's going to
be the Path Tracer. From here, we can control
the maximum number of bounces and samples per
pixel for the path tracer. Now, the path tracer
is essentially a renderer, just like
VRay, or other options. So this is not a
real-time solution. It's not something
you'd want to run in a real-time visualization. To see the path tracer, we need
to go to our View Mode button here, and then
select Path Tracing. So the renderer will
improve over time. It starts out fairly noisy,
but as we sit here and wait, the quality will get better,
and better, and better. And, of course, we could
create a screenshot from this. Your second option for
creating high-quality outputs is going to be the new
High-Quality Media Export tool. So inside of Unreal, we
have our Sequencer tool, which allows us to setup
camera animations and so forth. And the new High-Quality
Media Export tool allows us to take
those animations and render them at a very
high resolution using ray traced quality. It provides you with a very
highly configurable export tool that allows you to create
presets that you can save. And then what it does is you can
create images as high as 20K, I believe, in resolution. And the way it does that is
it literally cuts the image into pieces or tiles,
and then those tiles are able to be put back
together after being output into the final full
high-resolution image. Well, we obviously
don't have the time to render out that
cinematic today, but that's going to basically
do it for this session on real-time ray tracing
for architectural interiors and exteriors. I hope you have
enjoyed this session and were able to pick
some things up today. So thanks for attending.