在ue4中，有两个不同基本 in ue4 there are two different basic
照明类型 types of lighting
动态照明和静电照明 dynamic lighting and static lighting
这两种方式都有好处，而且 and both of these have upsides and
不利之处 downsides
使用动态照明，所有 with dynamic lighting all of the
照明是实时进行的，仅此而已 lighting is done in real time it's all
实时计算，这意味着你 computed in real time and that means you
可以随时移动灯光 can move lights around at any time
你并不局限于必须烘焙或 you're not limited to having to bake or
任何这样的事情，这都是令人惊叹的 anything like that and this is amazing
如果您有很多移动的点光源 if you have lots of moving point lights
或者是一种动态的24小时天空系统 or a sort of dynamic 24 7 sky system
在那里太阳实际上穿过了 where the sun actually moves through the
天空 sky
而大多数开放的世界游戏完全依赖于 and most open world games fully rely on
动态照明现在静电照明怎么样 dynamic lighting now static lighting how
也有它的好处 also has its upsides
这就是那种复杂的光线 it's where the sort of complex light
将信息烘焙到场景中以 information is baked into a scene to
节省性能 save on performance
因此，虽然它确实提高了性能 so while it does improve the performance
问题是烘焙过程 the problem is that the baking process
实际上非常耗时，而且有一次 is actually very time consuming and once
灯都烤焦了，不能移动 the lights are baked they can't be moved
在没有重新烘焙的情况下四处走动 around without rebaking
这就是这个构建按钮 so that's what this build button that
你总是看到是因为它是为了 you're always seeing is for it's for
在某种程度上产生了许多不同的 sort of generating lots of different
但它产生的主要原因是 stuff but the main thing it generates is
灯光数据，显然是为艺术家准备的 lighting data and obviously for artists
那种光线烘焙并不是真的 that sort of light baking isn't really
理想的，嗯，因为我们作为艺术家，我们只是 ideal uh because we as artists we just
想要能够把东西搬来搬去 want to be able to move things around we
我只想看到不一样的东西 just want to be able to see different
一天中我们想要能够 times of day we want to be able to
完全实时工作 work completely in real time
并不局限于烘焙 and not be limited to baking
但谢天谢地，有一些新的 but thankfully there are a number of new
这些技术有望实现 technologies that are hopefully going to
制作 make
静电照明对于广大民众来说已经过时 static lighting obsolete for the vast
大多数创作者和项目 majority of creators and projects
所以如果你想确保你 so if you want to make sure that you
实际上已经禁用了静电照明 actually have static lighting disabled
而且你正在利用 and that you're using
ue4中的全动态照明 fully dynamic lighting in ue4
你可以去世界设置 you can go to the world settings
你的水平，而你只是 of your level and you just
检查您是否已获得此参数 check that you've got this parameter
这里打了勾，所以这是力量号 here ticked so it's force no
预计算照明，只需检查 pre-computed lighting and just check
就在那里的那个盒子，嗯，它会告诉你 that box right there and um it will tell
您知道预计算照明现在是 you that the precomputed lighting is now
启用，则必须构建 enabled and you will have to build the
点亮一次就可以把这个传播出去 lighting once to sort of propagate this
变化 change
所以这真正的意思就是你 so all that really means is that you
需要上去建造，然后把 need to go up to build and take the
旁边的小箭头，然后单击构建 little arrow next to it and click build
仅限照明 lighting only
另一种方法来确保它是 another way to make sure that it's
完全禁用了您的整个 completely disabled in your entire
该项目将会上升到 project is to go up to the
编辑项目设置 edit project settings
菜单 menu
只需键入 and just type in
照明 lighting
并确保允许静电 and make sure that allow static
并确保实际上未选中允许静电，然后只需点击 and make sure that allow static is actually unchecked and then just hit
实际上是未选中的，然后就按下了 is actually unchecked and then just hit
重新启动以重新启动编辑器并执行 restart to restart the editor and doing
这两件事会 those two things will
确保禁用静电照明 ensure that static lighting is disabled
而且你正在利用 and that you're using
全动态照明，嗯，就像我在 fully dynamic lighting uh like i am in
这一幕就在这里，如果你能看到 this scene right here so if you can see
我可以移动灯光，而且我 i can actually move lights around and i
我可以真正看到这些更新 can actually see those update in real
时间 time
幸运的是，因为这些新的 fortunately because of these sort of new
已经变得不真实的功能 features that have come into unreal
引擎4 engine 4
我们想要的大多数视觉效果 most of the visuals that we would want
来自静电的照明可在 from static lighting are available in
完全动态照明，只是 completely dynamic lighting it just
需要一点额外的工作 takes a little bit of extra work
第一种也是最便宜的方法是 the first and the cheapest method is
实际上称为距离场阴影 actually called distance field shadows
或距离场环境光遮挡 or distance field ambient occlusion
我可以详述如何 i could go into the details about how
距离字段实际上在 distance fields actually works under the
胡德，但我不认为那是 hood but i don't think that's
特别有用，我想什么会 particularly useful i think what would
更好的办法是给你看一下 be much better would be to show you it
在行动中，然后还会准确地向你展示 in action and then also show you exactly
如何在场景中使用它 how you can use it in your scenes
所以在引擎里我有一个非常 so here in the engine i've got a very
典型的案例中我有一个实际的 typical case where i've got an actual
动态阴影 dynamic shadow
这是非常困难的，这是非常苛刻的 and it's extremely hard it's very harsh
边缘是完全坚硬的 the edges are completely hard
它不是一个非常柔和的阴影，所以我们 it's not a very soft shadow so we're
将启用呃距离场网格 going to enable uh distance field meshes
希望它能让我们软化 hopefully it's going to let us soften
走出这个阴影，所以第一件事就是 out this shadow so the first thing
你要做的就是上到 you're going to want to do is go up to
编辑项目设置 edit project settings
然后在距离字段中键入 and then type in distance fields
然后你会得到所有的 and then you'll get all of the
参数 parameters
周围的距离场和一个 surrounding distance fields and the one
你要确保被勾选的是 you'll want to make sure is ticked is
生成网格距离场 generate mesh distance fields
然后重新启动编辑器 and then restart your editor
一旦这件事做完了 once that's done
你就能走进你的 you'll be able to come into your
灯光在这种情况下，我有一个聚光灯 light in this case i've got a spotlight
它指向下面的场景 that's pointing down onto the scene
所以如果我，你知道的，换个呃 so if i you know change the uh
此聚光灯上的照明 illumination on this spotlight
我这里的光线相当强 i've got quite a strong light here
这实际上创造了这个 and that's actually creating this
动态阴影所以如果我进入 dynamic shadow so if i go into the
聚光灯和我检查演员阵容 spotlight and i check check cast cast
阴影 shadows
这只是一种正常的动态投射 that's just casting the normal dynamic
如果我在细节上向下滚动 if i scroll way way down on the details
评审团只会给我自己更多一点 panel just gonna give myself a bit more
房间 room
嗯，我能找到这个部分，叫做 uh i can find this section called
距离场 distance field
距离场，现在我要勾选距离 distance field and now i'm just going to tick distance
现在我要把距离打勾一下 and now i'm just going to tick distance
字段 field
田野阴影，你可以看到我现在实际上 field shadows and you can see that i've actually now
得到一个非常非常柔和的阴影 got a really really soft shadow that's
在这里形成 forming here
它如此柔软的原因是我已经 and the reason why it's so soft is i've
实际上增加了 actually increased
这个参数就在这里 this parameter right here
震源半径 source radius
所以如果我把它设为零 so if i set that to zero
如果出现以下情况，阴影会变得稍微柔和一些 the shadow goes a little bit softer if
我们只是取消滴答，然后滴答作响 we just untick and tick
距离场阴影它走得有点远 distance field shadows it goes a little
稍微柔和一点，但要让它看起来真的很好看 bit softer but to really get it looking
非常非常柔软，你需要增加这个 very very soft you need to increase that
震源半径参数比较多 source radius parameter quite a bit
所以我要去150 so i'll go to 150
现在你可以看到我拿到了这个 and now you can see i've got this
看起来非常柔软 incredibly soft looking
呃，几乎看起来像是阴影 uh shadow that almost looks
就像它可能是光线追踪的一样 like it could have been ray traced it's
如此柔软 so soft
这真的是游戏规则的改变者，嗯 and that's really the game changer uh
距离场呃阴影提供了 the distance field uh shadows provides
距离带来的另一个真正巨大的好处 another really great benefit of distance
场也处于环境光遮挡中 fields is also in ambient occlusion
所以如果我走进我的天窗，我就能做到 so if i go into my skylight i've got it
就在这里，天窗 right here the skylight
如果我进去，你会看到 if i go inside of there you can see
还有距离设置 there are also settings for distance
场环境光遮挡 field ambient occlusion
在那里我实际上可以呃调整一些 and there i can actually uh tweak some
所以如果我可以打开 of the settings so if i can turn on and
关闭 off
呃 uh
我实际上可以在这里改变颜色 i can actually just alter the color here
要打开和关闭它，您可以看到 to turn it on and off you can see what
距离场环境光遮挡为 the distance field ambient occlusion is
正在做什么 doing
在这个场景中，我实际上完全 and in this scene i actually completely
已禁用法线环境光遮挡 disabled the normal ambient occlusion
因为它实际上是相当初级的 because it's actually quite rudimentary
与此相比 in comparison to this
距离场环境光遮挡 distance field ambient occlusion
另一项即将推出的功能是NVIDIA RTX another upcoming feature is nvidia rtx
它完全由虚幻支持 which is fully supported by unreal
四号引擎。 engine 4.
有史以来第一次RTX允许我们 for the first time ever rtx allows us to
在上执行实时光线跟踪 perform real-time ray tracing on the
整个场面的表演都是轰动一时的 entire scene the performance hit is a
比距离场大得多，但是 lot greater than distance fields but the
技术还支持光线跟踪 technology also supports ray traced
反射和半透明，所以如果超级 reflections and translucency so if super
在以下方面需要准确的反射 accurate reflections are required in
你的场景那么RTX绝对是 your scene then rtx is definitely the
启用全部腾讯通的最佳选择 best option in order to enable rtx all
你要做的就是去参加这个项目 you need to do is go up to the project
设置 settings
然后键入光线追踪 and then type in ray tracing
并确保勾选光线跟踪 and make sure that you tick ray tracing
这个小盒子就在这里，另一个 this little box right here the other
你需要做的事情就是来 thing that you'll need to do is come
就在这里，左边的那部分 right down here on the left to the part
上面写着站台 where it says platforms
然后走进窗户 and then go into windows
在这里你会看到一个叫做 and here you'll see a setting called
默认RHI default rhi
确保将其设置为直接文本 make sure that that's set to direct text
12个 12
然后重新启动 and then just restart
发动机 the engine
现在我重新启动了虚幻4号引擎 and now i've booted unreal engine 4 back
再升一次，现在我们可以看到我们有 up again and now we can see we have
启用了实时光线跟踪，因此 real-time ray tracing enabled so the
阴影看起来柔和多了 shadows look much much softer
因为实际上有真正的雷 because there's actually real ray
跟踪 tracing
而不是 rather than
距离场效应的一种假象 the fake sort of distance fields effect
我们以前用过的 that we were using before
不幸的是，问题是 unfortunately the problem is that the
帧速率也会受到影响，除非您 frame rate also suffers so unless you've
有一个非常强大的GPU，呃，它是 got an extremely powerful gpu uh it's
使用距离场要好得多 much better to use distance field
阴影和距离场环境光 shadows and distance field ambient
遮挡 occlusion
现在我已经启用了光线跟踪，所以 now that i've got ray tracing enabled i
可以简单地将震源半径调到 can simply turn up the source radius on
我的光 my light
然后光线就会变得又好又柔和 and then the light will be nice and soft
我可以把它搬来搬去 and i'm able to actually move it around
并实时查看光线跟踪 in real time and see the ray tracing
实际更新 actually update
就在视口中 right in the viewport
也可以使用光线跟踪 it's also possible to use ray trace
对系统的反思也是如此 reflections with the system as well so
如果您转到您的后处理卷 if you go to your post processing volume
然后你向下滚动 and you scroll right down
到渲染功能 to the rendering features
然后是倒影 and then to reflections
您可以更改 you can change the
如此使用的反射的类型 type of the reflections being used so
我要把它从屏幕空间改一下 i'm going to change it from screen space
到光线跟踪 to ray tracing
你可以看到 and you can see that
我们已经把这个洗得很干净了 we've already got this really nice clean
映入眼帘的是我们 reflection that's coming through and we
实际上可以看到那张照片上的倒影 can actually see reflected in that piece
那里有一大堆金属 of metal there
如果我们抬头看，我们实际上可以看到 if we look up we can actually see that
它反映了一些不是的东西 it's reflecting something that's not
即使在屏幕上它也在反射 even on the screen it's reflecting
一些远高于这些的东西 something way above these sort of
吊灯 hanging lights
所以 so
这是一件永远不会发生的事情 that's something that would never be
可以使用屏幕空间反射 possible with screen space reflection
如果我把它调回屏幕空间 and if i turn it back to screen space
反映一下，您可以看到我们已经对 reflection you can see that we've sort
把那根杆子放在那里 of got that pole there
但是它在哪里结束，在哪里结束，在哪里 but where it ends where it comes off the
屏幕 screen
它没有要填写的信息 there's no information for it to fill in
这个倒影就在这里，所以这就是 this reflection right here so that's the
使用光线跟踪的巨大优势 huge advantage to using ray tracing it's
真实、准确地反映了实际情况 a real accurate reflection of the actual
场景和真实准确的结果 scene and a real accurate result