quixel suite_《死者之书》:Quixel,风,场景构建和内容优化技巧
quixel suite
In this blog series, we will go over every aspect of the creation of our demo Book of the Dead. Today, we will focus on our partnership with Quixel, our wind system, scene building and content optimization tricks. This is the fourth blog in our ‘Making Of’ blog series. In case you missed it take a look back at the last three posts that go through the creative process for characters, concept art and photogrammetry assets, trees, and VFX within Book of the Dead.
在本博客系列中,我们将介绍演示死者之书的创建过程的各个方面。 今天,我们将专注于与Quixel的合作伙伴关系,风系统,场景构建和内容优化技巧。 这是我们“制作”博客系列中的第四个博客。 如果您错过了它,请回顾一下《死者之书》中 角色 , 概念艺术和摄影测量资产,树木和VFX的创作过程中的最后三篇文章。
Hi! My name is Julien Heijmans, I work as an Environment Artist as part of the Unity Demo team. I only joined Unity last year, but I have around 7 years of experience in the video game industry. This blog post will provide you some insight into the production of Book of the Dead from my perspective, the perspective of a content creator and an environment artist.
嗨! 我叫Julien Heijmans,我是Unity Demo团队的一名环境艺术家。 我去年才加入Unity,但在视频游戏行业拥有大约7年的经验。 这篇博客文章将从您的角度,内容创建者和环境艺术家的角度为您提供《死者之书 》制作的一些见解。
I am kind of new in the work of photogrammetry assets, but I remember clearly the day Quixel announced the creation of Megascans several years ago. Ever since, I’ve been eager to get an opportunity to work with their assets. Joining Unity’s Demo team made that happen, as I started to work on The Book of the Dead.
我对摄影测量资产有点陌生,但我清楚地记得Quixel几年前宣布创建Megascans的那一天。 从那时起,我一直渴望有机会与他们的资产一起工作。 加入Unity的演示团队后,我开始着手《死者之书》的创作。
If you want to start experimenting with the tools discussed in this blog you can download the Book of the Dead: Environment project now.
如果您想开始尝试本博客中讨论的工具,则可以立即下载《死者之书:环境》项目。
与Quixel合作 (Partnership with Quixel)
When I joined the project I realized that we were not only using assets from Quixel’s Megascans library, but that Unity and Quixel were partnering together for the creation of this project.
当我加入该项目时,我意识到我们不仅在使用Quixel的Megascans库中的资产,而且Unity和Quixel一起合作创建了这个项目。
During the production process, the Demo Team created a list of the assets that they would need and Quixel would capture new assets if they were missing an appropriate match in their existing library. Many of those assets were vegetation such as grass, plants, and bushes, that require proper equipment and setup to scan.
在生产过程中,演示团队创建了所需资产清单,如果缺少现有库中的适当匹配项,Quixel将捕获新资产。 这些资产中有很多是草木,植物和灌木丛等植被,需要适当的设备和设置来进行扫描。
Quixel did not only provide us with texture sheets for those assets, but they also created the geometry, with their LODs and vertex color setup to support our wind shader.
Quixel不仅为我们提供了这些资产的纹理表,而且还创建了几何图形以及其LOD和顶点颜色设置以支持我们的风着色器。
Between the released Book of the Dead: Environment project, and the unreleased assets used in the teaser, we received over 50 assets of high quality and of complexity that would have seen us struggle to make our deadlines with the few artists we have on the team.
在已发布的《死者之书:环境》项目和预告片中使用的未发布资产之间,我们收到了50多种高质量和复杂性的资产,这使我们很难与团队中的少数艺术家一起完成截止日期。
During the production, we could get the assets pretty quickly into the engine, and looking good. We would often tweak the textures (mostly the albedo, tweaking the brightness/levels/curve and often tweaking the colors to unify them across the scene), repack them properly, tweak a bit the LODs to the level we want, assign the textures to a new HDRP Lit material, and we would be done with it.
在生产过程中,我们可以将资产很快投入引擎,并且看起来不错。 我们经常会调整纹理(主要是反照率,调整亮度/级别/曲线,经常调整颜色以在整个场景中统一它们),重新打包它们,将LOD调整到我们想要的级别,将纹理分配给一种新的HDRP Lit材料,我们将完成此工作。
Luckily Quixel has recently released a tool, Megascans Bridge, that would do most of the importing work that we did manually. It saves time in repacking textures for HDRP and the likes.
幸运的是,Quixel最近发布了Megascans Bridge工具,它将完成我们手动完成的大多数导入工作。 它为HDRP等节省了重新包装纹理的时间。
For those who are interested in more Megascans assets, here’s a reminder that there are several Megascans collections on the Unity Asset Store. All the assets are ready to be imported into a project setup with the High Definition Render Pipeline or the Lightweight Render Pipeline.
对于那些对更多Megascans资产感兴趣的人,这里提醒您, Unity Asset Store上有几个Megascans收藏 。 准备使用“高清渲染管线”或“轻量渲染管线”将所有资产导入项目设置。
风 (Wind)
The creation of a wind system for vegetation assets and its whole pipeline is always a tricky process. There are many different kinds of vegetation assets that would need to be animated in different ways; two different trees might require completely different setup and different shader complexity.
为植被资产及其整个管道创建风力系统始终是一个棘手的过程。 有许多不同种类的植被资产需要以不同的方式进行动画处理。 两棵不同的树可能需要完全不同的设置和不同的着色器复杂性。
For this reason, our team decided to create a custom vertex shader based procedural animation for the wind effect on our vegetation assets. We made it tailored to work with our specific project and the trees or bushes it contains. Allowing us to have a complete control over it.
因此,我们的团队决定创建一个基于自定义顶点着色器的过程动画,以对我们的植被资产施加风效应。 我们将其量身定制以与我们的特定项目以及其中包含的树木或灌木丛一起使用。 使我们能够对其进行完全控制。
Torbjorn Laedre, our Tech Lead built a shader that would support several different types of vegetation, using 3 different techniques:
我们的技术主管Torbjorn Laedre使用3种不同的技术构建了支持多种不同类型植被的着色器:
- Hierarchy Pivot, for our trees and some plants with a very defined structure/hierarchy 层次结构透视图,用于我们的树木和某些具有明确结构/层次结构的植物
- Single Pivot, for grass, small plants and for large bush with undefined structure/hierarchy 单一枢轴,用于草木,小型植物和具有不确定结构/层次结构的大灌木丛
- Procedural Animation, for vegetation assets where pivots cannot be predicted. 程序动画,用于无法预测支点的植被资产。
The trees were the more complex assets to prepare, on the content side, they are using the Hierarchy Pivot type of animation and they rely on 3 distinct levels of hierarchy:
在内容方面,这些树是要准备的更复杂的资产,它们使用的是Hierarchy Pivot类型的动画,并且它们依赖于3个不同的层次结构级别:
- Trunk, that rests on the ground. 树干,搁在地上。
- Branches Level A, that are connected to the trunk. 连接到中继的A级分支。
- Branches Level B, that are connected to the branches of Level A. B级分支,连接到A级分支。
The shader needs to know the level of hierarchy and the pivot of every single vertex of the tree. I first had to author the geometry of the tree itself, and then assign the level of hierarchy for every polygon of the tree using the green vertex color channel.
着色器需要了解层次结构的级别以及树的每个单个顶点的枢纽。 我首先必须编写树本身的几何形状,然后使用绿色顶点颜色通道为树的每个多边形分配层次结构级别。
- A value of 0 for the green channel of the vertex color would signify that it is the trunk 顶点颜色的绿色通道的值为0表示它是主干
- A value between 0 and 1 would be the branches level A 0到1之间的值将是分支级别A
- A value of 1 would be the branches level B 值为1表示分支级别B
I did this using Autodesk Maya, with some small scripts I was able to set up all of the LODs of an asset in 10-15 minutes.
我使用Autodesk Maya进行了此操作,并使用一些小脚本可以在10-15分钟内设置资产的所有LOD。
In addition to this, we also used what we called a ‘Flutter Mask’. They are texture masks that would help determine where in the geometry the pivot of the branch be. We used this for the branches that used hard alpha textures for geometry. Here is an illustration of this mask.
除此之外,我们还使用了所谓的“ Flutter Mask”。 它们是纹理蒙版,可帮助确定分支的枢轴在几何中的位置。 我们将其用于将硬alpha纹理用于几何的分支。 这是这个面具的例证。
With all this information prepared, I could use the C# script that would input my tree prefab, and generate a new prefab with the pivot information of every vertex baked in. After adding a WindControl object to my scene, I can import my tree in the scene, and start playing with the material properties.
准备好所有这些信息后,我可以使用C#脚本输入树的预制件,并使用每个烘焙的顶点的枢轴信息生成一个新的预制件。将WindControl对象添加到场景后,可以将树导入到场景中。场景,然后开始使用材质属性。
You can see that each hierarchy level has a range property (basically the length of the trunk, or branches) and an elasticity property.
您可以看到每个层次结构级别都有一个range属性(基本上是主干或分支的长度)和一个弹性属性。
There are also some properties to set up wind flutter animation. They add a bit of procedural noise to the vertex positions, to imitate the vibration of the branches when the wind blows on them.
还有一些属性可以设置风颤动动画。 它们在顶点位置上增加了一些过程噪声,以模仿风吹到树枝上时的振动。
Last, but not least, we had to make the wind sound FX influence the wind animation. The volume of the sound is driving the wind strength of the animation. It is really surprising how a simple idea can add to the project. If you have not done it already, you should open the project and walk around. You will notice the trees and all the grass around shaking when you hear large gusts of wind hit your surroundings.
最后但并非最不重要的一点是,我们必须使风声FX影响风动画。 声音的大小在驱动动画的强度。 一个简单的想法如何添加到项目中,真是令人惊讶。 如果尚未完成,则应打开项目并四处走走。 当听到大风吹向周围时,您会注意到周围的树木和所有草丛都在颤抖。
布局 (Layout)
When targeting the level of detail and density of a project like Book of the Dead, it was important for me to think about how I was going to structure the level, to avoid performance issues later in production. One of the things I tried to be careful about, was to limit long view distances in the scene. You can do that by placing ‘corridors’ and ‘bottlenecks’ in the layout of the scene.
在确定《死者之书》等项目的细节和密度级别时,对我来说,考虑如何构造级别非常重要,以避免以后在生产中出现性能问题。 我试图小心的一件事是限制场景中的长视距。 您可以通过在场景布局中放置“走廊”和“瓶颈”来做到这一点。
Those layouts, together with assets correctly set up as ‘Occluder static’ and ‘Occludee static’ flags will make Unity’s occlusion culling more efficient.
这些布局以及正确设置为“静态遮挡”和“静态遮挡”标志的资产将使Unity的遮挡剔除更加有效。
This video shows the Occlusion Culling Visualization, and you can easily guess where the camera is looking at from the top view. Around the end of the video, I enable/disable the occlusion culling, and see what objects are being culled by the occlusion culling.
该视频显示了遮挡剔除的可视化效果,您可以轻松地从顶视图猜测摄像头正在看的位置。 在视频结尾处,我启用/禁用遮挡剔除,并查看遮挡剔除正在剔除哪些对象。
You will also be able to see that some objects are not culled, those are mostly the really tall trees, some over 25 meters tall, that have a very large bounding box and are therefore hard to cull behind the cliffs.
您还将看到一些物体没有被剔除,大部分是真正的高大树木,有些高超过25米,它们具有很大的边界框,因此很难在悬崖后被剔除。
使用Unity旧版地形 (Use of Unity legacy terrains)
When the trailer was released, we saw comments that there’s no way we use the legacy terrain system. But that’s exactly what we use, and we modified the HD Render Pipeline’s Layered Lit shader to support it.
发布预告片时,我们看到有评论说我们无法使用旧版地形系统。 但这正是我们所使用的,我们修改了HD Render Pipeline的Layered Lit着色器以支持它。
The HDRP Layered Shader allows blending of layers using their heightmap texture, so the result is better than the linear blend that comes with the legacy terrain shader.
HDRP分层着色器允许使用其高度图纹理进行图层混合,因此,其效果要好于旧版地形着色器随附的线性混合。
In this animation, I am simply changing the different layers height offset.
在此动画中,我只是更改了不同图层的高度偏移。
This is, of course, a temporary solution, and not properly integrated in the UI. To change the terrain you will need to edit the material that is applied to it, instead of using the ‘Edit Texture’ button in the Paint Texture tab of the terrain object.
当然,这是一个临时解决方案,并且未正确集成到UI中。 要更改地形,您将需要编辑应用于该地形的材质,而不是使用terrain对象的“绘制纹理”选项卡中的“编辑纹理”按钮。
These layers are there mainly to help you paint the different layers on the terrain. They are not used for rendering the terrain, except for the tiling settings.
这些图层主要用于帮助您绘制地形上的不同图层。 除平铺设置外,它们不用于渲染地形。
Instead, look for the material applied to your terrain, and you will find all the textures and the material properties that affect the terrain.
而是查找应用于地形的材质,然后将找到影响地形的所有纹理和材质属性。
If you want to create a new terrain and apply different textures on it, you will need to duplicate this TerrainLayeredLit material and assign it to your new terrain. You will also need to create those 4 textures sets in the Paint Texture tab. The textures assigned in there won’t be used for rendering the terrain, but they will allow you to paint the different layers on your terrain. It is also there that you can change the tiling properties of the different layers.
如果要创建新地形并在其上应用不同的纹理,则需要复制此TerrainLayeredLit材质并将其分配给新地形。 您还需要在“绘画纹理”选项卡中创建这4个纹理集。 在其中分配的纹理不会用于渲染地形,但是它们将允许您在地形上绘制不同的图层。 您还可以在其中更改不同图层的切片属性。
Also, to be able to fully use the LODGroup feature, all of the assets placed through the terrain are setup as Trees, and not detail assets.
另外,为了能够充分使用LODGroup功能,将通过地形放置的所有资产都设置为树,而不是局部资产。
But actually, this project has a really high amount of assets scattered on the ground: grass, bushes, plans, wooden twigs, rocks, etc. With all of this, the terrain can be fairly simple, you can see below that in this particular shot the terrain is just a simple tiling material.
但是实际上,这个项目在地面上散布着非常多的资产:草,灌木,计划,木树枝,岩石等。有了这些,地形可以非常简单,您可以在下面看到这一点拍摄地形只是一种简单的拼贴材料。
零散资产 (Scattered detail assets)
When you walk around the level, you will notice in places a very large amount of small twigs and pinecones scattered on the ground.
当您在水平面上行走时,您会发现在地面上散落着大量细小树枝和松果。
Those are not really that obvious when you simply walk around the level, but they really bring the level of detail of the scene when you start looking at the ground. There are sometimes hundreds of tiny twigs on the ground, between rocks and dead trunks, just like they would eventually rest if they fell down from trees. Placing these by hand would be simply impossible, it is for this reason that Torbjorn Laedre made a tool to help us scatter those small details in the level.
当您只是在水平面上行走时,这些效果并没有那么明显,但是当您开始看地面时,它们确实带来了场景的细节水平。 有时候,在岩石和枯树干之间的地面上有数百个细树枝,就像它们从树上掉下来最终会静止一样。 手工放置它们根本不可能,因为这个原因,Torbjorn Laedre制作了一个工具来帮助我们在关卡中散布这些小细节。
The twigs are simple cutout planes with an alpha material. We added physics capsule colliders to them.
细枝是带有alpha材质的简单切口平面。 我们向他们添加了物理胶囊对撞机。
The script will first spawn the desired quantity of those scatter objects around a transform position, and then simulate physics for them to fall down on the ground, colliding with the terrain and all the others assets (rock, dead trunks, etc). Then, by pressing the button ‘Bake’, they will be stripped of their colliders, merged into a single object, and assigned a LODGroup with a specific distance at which they should be culled.
该脚本将首先在变换位置周围生成所需数量的散布对象,然后模拟物理方法使其掉落在地面上,与地形和所有其他资产(岩石,死树干等)碰撞。 然后,通过按下“烘烤”按钮,将剥夺它们的对撞机,合并为一个对象,并为LODGroup分配一个特定距离,以将其剔除。
This script is used by objects called ‘UberTreeSpawner’ in the scene, and you are free to use it as you wish.
该脚本由场景中称为“ UberTreeSpawner”的对象使用,您可以随意使用它。
Side note about this tool: For the twigs and other scattered objects to fall properly on the ground and other assets, you will need to have quite high-density mesh colliders on all the assets in the scene. At the same time, you don’t want those heavy colliders to be used when the game is running. For this reason, most of the assets in the scene have two different colliders: One light to be used at real-time in play mode by the PlayerController with the Default Layer assigned. And one used exclusively for the physics simulation of those twigs, with the ‘GroundScatter’ Layer assigned.
关于此工具的补充说明:为了使树枝和其他分散的物体正确地落在地面和其他资产上,您将需要在场景中的所有资产上使用密度很高的网格对撞机。 同时,您不希望在游戏运行时使用那些笨重的对撞机。 因此,场景中的大多数资产具有两个不同的对撞机:一个灯光,在播放模式下由分配了默认层的PlayerController实时使用。 一个专门用于这些树枝的物理模拟,并分配了“ GroundScatter”层。
灯光 (Lighting)
The Book of the Dead: Environment project is using baked indirect global illumination with real-time direct lighting.
《死者之书:环境》项目正在使用带有实时直接照明的烘焙间接全局照明。
Both the indirect lighting from the sun and direct plus indirect lighting from the sky is baked into lightmaps and light probes. Reflection probes, occlusion probes and other sources of occlusion are baked as well. Direct sun contribution, on the other hand, is real-time lighting. Shading in the HD Render Pipeline looks best when using real-time direct light, and it also gives us some freedom to animate the rotation, intensity and color temperature of the directional light at runtime.
来自太阳的间接照明和来自天空的直接与间接照明都被烘焙到光照贴图和光探测器中。 反射探针,阻塞探针和其他阻塞源也要烘烤。 另一方面,直接的阳光照射是实时照明。 使用实时直射光时,HD Render Pipeline中的阴影看起来最好,它还使我们在运行时可以为定向光的旋转,强度和色温设置动画。
Since the indirect lighting is baked, we cannot change too much the intensity and color of the directional light, or it won’t match anymore with the baked lighting. We wouldn’t be able to get away with a full day/night cycle in this setup, even though a forest is a quite forgiving environment in terms of obscuring mismatched indirect lighting.
由于间接照明是烘烤的,因此我们不能过多改变定向光的强度和颜色,否则它将不再与烘烤的照明相匹配。 即使在遮蔽不匹配的间接照明方面,森林是一个非常宽容的环境,在这种设置下我们也无法摆脱一个昼夜循环。
Baked lightmaps are used mostly for the terrain and a few other assets, but we preferred to use a combination of light probes and occlusion probes for all the rocks and cliffs in the project, as they provide better results for objects with sharp angles and crisp normal maps.
烘焙的光照贴图主要用于地形和其他一些资产,但是我们更喜欢对项目中的所有岩石和悬崖使用光探针和遮挡探针的组合,因为它们可以为锐角和清晰法线的对象提供更好的结果地图。
咬合探头 (Occlusion Probes)
Lighting a dense forest is something tricky to achieve in real-time. Trees, with all their leaves and branches, have a huge surface area and complex geometry, so it’s not practical to cover them with lightmaps. Using a single light probe per tree would give it uniform lighting from the bottom to the top. Light Probe Proxy Volumes are closer to what we would want, but it’s not practical to crank up the grid resolution to capture fine details.
实时照明茂密的森林有些棘手。 树木及其叶子和树枝都有很大的表面积和复杂的几何形状,因此用光照贴图覆盖它们是不现实的。 每棵树使用单个光探头将使其从底部到顶部的照明均匀。 “光探针代理”卷更接近我们想要的卷,但是提高网格分辨率以捕获精细细节并不现实。
For that reason that our Senior Graphics Programmer, Robert Cupisz, developed the occlusion probes.
因此,我们的高级图形程序员Robert Cupisz开发了遮挡探针。
From an artist’s point of view, it’s a really nice and easy feature to use: you simply add the object to the scene, and it displays a volume gizmo that you need to scale for it to cover the area you want, and then setup its resolution parameters in X, Y, and Z.
从艺术家的角度来看,它是一个非常好用的功能:您只需将对象添加到场景中,它会显示一个体积小物件,您需要对其进行缩放以覆盖所需的区域,然后对其进行设置X,Y和Z中的分辨率参数。
It also allows you to create ‘Detail’ occlusion probes if you want some area of the scene to have a higher density of probes. Once it is set up, you will need to bake the lighting of the whole scene. The occlusion probes will be baked during that process.
如果您希望场景中的某些区域具有更高的探针密度,还可以创建“详细信息”遮挡探针。 设置完成后,您将需要烘烤整个场景的照明。 阻塞探针将在该过程中被烘烤。
Each probe in the 3D grid samples sky visibility by shooting rays in the upper hemisphere, and stores it as an 8bit value going from fully occluded 0 to fully visible 1. This gives us darker areas wherever there’s a higher concentration of leaves and branches – even more so when a few trees are clustered together.
3D网格中的每个探针都通过拍摄上半球的光线来采样天空的可见性,并将其存储为8位值(从完全遮挡的0到完全可见的1)。这使我们在较暗的区域(无论树叶和树枝的浓度如何都很高)–甚至当几棵树聚集在一起时更是如此。
Probes unlucky enough to have landed inside trunks or rocks will be fully black. To avoid that darkness from leaking out, they are marked as invalid and overwritten by neighboring valid probes.
不幸落在树干或岩石内部的探针将全黑。 为避免黑暗泄漏出来,将它们标记为无效并由相邻的有效探测器覆盖。
Since the probes sample how much of the sky is visible, they should only attenuate direct sky contribution. For this reason, the lightmapper is set up to exclude the direct light contribution from regular light probes, and then probe lighting is composed as light probe plus direct sky probe occluded by occlusion probes.
由于探针对可见的天空进行采样,因此只能减弱直接的天空贡献。 因此,设置灯光映射器以排除常规光探测器的直接光贡献,然后将探测器照明作为光探测器加上被遮挡探测器遮挡的直接天空探测器组成。
This way we can have tons of cheap occlusion probes sampling small details of how foliage occludes the sky, bring depth to the image, and very few more expensive light probes sampling slower changing indirect light.
这样,我们就可以拥有大量廉价的遮挡探针来采样树叶如何遮挡天空,为图像带来深度的细节,而很少有价格昂贵的光探针对变化较慢的间接光进行采样。
If you want to have a clearer picture of how they affect the scene, you can also use the SkyOcclusion Debug view.
如果您想更清楚地了解它们如何影响场景,还可以使用SkyOcclusion Debug视图。
The occlusion probe API for baking occlusion probes and excluding direct sky contribution from light probes has been added to Unity 2018.1, and all the scripts and shaders are available in the project.
Unity 2018.1中已添加了用于遮挡探针的遮挡探针API,并排除了光探针的直接天空贡献,并且该项目中提供了所有脚本和着色器。
大气散射 (Atmospheric Scattering)
We ported and re-used the Atmospheric Scattering solution that we originally developed for the Blacksmith demo.
我们移植并重新使用了最初为铁匠演示开发的“大气散射”解决方案。
Our Senior Programmer Lasse Jon Fuglsang Pedersen has extended it to make use of temporal supersampling, resulting in a much smoother look.
我们的高级程序员Lasse Jon Fuglsang Pedersen将其扩展为使用时间超采样,从而使外观更加平滑。
高清渲染管道传输 (HD Render Pipeline Transmission)
The HD Render Pipeline default Lit Shader supports several types of diffusion. It allows you to have materials with sub-surface scattering, or—like used for all our vegetation in this project—a more simple translucent material with only light transmission.
HD Render Pipeline默认的Lit Shader支持多种类型的扩散。 它使您可以使用具有表面下散射的材料,或者像该项目中用于我们所有植被的材料那样,使用仅透光的更简单的半透明材料。
This effect is set up in two different locations:
在两个不同的位置设置此效果:
- On the material you need to choose the ‘Translucent’ material type, input a Thickness map, and choose a diffusion profile, which is the second location: 在材料上,您需要选择“半透明”材料类型,输入“厚度”贴图,然后选择一个扩散轮廓,这是第二个位置:
- The diffusion profile settings, where you can edit all the other parameters of your transmission effect 扩散配置文件设置,您可以在其中编辑传输效果的所有其他参数
Note: Our team added additional sliders to control separately the direct and the indirect transmission to have more control over the final result. But this change is not respecting the PBR rules and thus will not make it into the HD Render Pipeline.
注意:我们的团队添加了其他滑块来分别控制直接传输和间接传输,以更好地控制最终结果。 但是此更改不遵守PBR规则,因此不会进入HD Render Pipeline。
面积体积 (Area Volumes)
The Area Volumes are built on the core volume system offered by SRP and are very similar to the Post Process Volumes. Their function is to drive object properties depending on the position of the Main Camera object.
区域卷建立在SRP提供的核心卷系统上,与后处理卷非常相似。 它们的功能是根据主摄像机对象的位置来驱动对象属性。
Several objects, including the Directional Light, the Atmospheric Scattering, Auto Focus and the WindControl have their properties driven by Area Volumes, so if you want to change the current lighting setup, for example, you will need to do that in the corresponding Area Volume. Those Area Volumes objects are located in the main scene, under _SceneSettings > _AREASETTINGS, and have the suffix ‘_AV’.
多个对象(包括定向光,大气散射,自动聚焦和WindControl)的属性由“区域体积”驱动,因此,例如,如果要更改当前的照明设置,则需要在相应的“区域体积”中进行操作。 这些Area Volumes对象位于主场景的_SceneSettings> _AREASETTINGS下,并具有后缀'_AV'。
调试窗口 (Debug window)
For those who have not used the HD Render Pipeline much, there is now a specific SRP debug window that you can open through the menu Window > General > Render Pipeline Debug
对于那些不太使用HD Render Pipeline的用户,现在可以通过菜单“窗口”>“常规”>“ Render Pipeline Debug”打开特定的SRP调试窗口。
With this, you will be able to see individual GBuffer layers, lighting components or specific texture maps from your materials, or even override albedo/smoothness/normal. It is a really useful tool when you have some objects that are not rendering correctly or any other visual bug. It will help you pinpoint the source of the issue a lot faster.
这样,您将能够从材质中看到各个GBuffer图层,照明组件或特定的纹理贴图,甚至可以覆盖反照率/平滑度/法线。 当您有一些无法正确渲染的对象或任何其他视觉错误时,它是一个非常有用的工具。 这将帮助您更快地找到问题的根源。
The best part if that is that those debug views are generated automatically from your shaders, and coders are able to create new debug views quite easily.
最好的部分是,这些调试视图是从着色器自动生成的,编码人员可以很轻松地创建新的调试视图。
Some of the debug views available through the Render Pipeline Debug window
通过“渲染管道调试”窗口可用的一些调试视图
I even used those debug views to create the tree billboards that are used in the background of the scene. I just placed my assets on an empty scene and took screenshots with the albedo, roughness, normal gbuffer layers visible, and used those to create my texture maps.
我什至使用那些调试视图来创建用于场景背景的树形广告牌。 我只是将资产放置在一个空的场景上,并截取了具有反照率,粗糙度,正常gbuffer层可见的屏幕截图,然后使用这些屏幕快照来创建我的纹理贴图。
优化 (Optimization)
While a big part of the optimization resides on the code side, it is also important that your assets and scenes are set up properly if you want to have a decent framerate. Here are some of the ways the content was optimized for this project:
尽管优化的很大一部分位于代码端,但是如果您想要一个不错的帧速率,则正确设置资产和场景也很重要。 以下是为该项目优化内容的一些方法:
- All our materials are using GPU Instancing. 我们所有的材料都使用GPU实例化。
- We are using LODs for most of the assets in this scene, this is a must-have. 我们将LOD用于此场景中的大多数资产,这是必须具备的。
- The LOD Crossfade feature is great, it allows the have a nice and smooth blending between the different Level of Details of you object. But this feature is quite heavy and can really increase the draw call count in your project. For this reason, we disabled it on as many assets as possible. LOD Crossfade功能很棒,它可以使对象的不同“细节级别”之间具有良好的平滑融合。 但是此功能相当繁重,确实可以增加项目中的绘图调用次数。 因此,我们在尽可能多的资产上禁用了它。
- To avoid noticeable transition between LODs, we started using Object Space normal maps on many of our large rock and cliff assets. 为了避免LOD之间的明显过渡,我们开始在许多大型岩石和悬崖资产上使用对象空间法线贴图。
Note: Using Object Space normal map instead of Tangent Space normal map will reduce the precision of the normal map. It is actually not very noticeable on our assets that are very rough and noisy, but you probably don’t want to use it for hard surface assets.
注意:使用“对象空间”法线贴图代替“切线空间”法线贴图会降低法线贴图的精度。 实际上,在我们的粗糙且嘈杂的资产上并不太明显,但是您可能不希望将其用于坚硬的地面资产。
- While it is important to limit view distance by the way the scene is built, and by using occlusion culling, it is also worth knowing that many of the draw calls used to render your scene are actually coming from the rendering each cascade of your shadow maps (more specifically from the directional light in our project). 虽然通过场景的构建方式和使用遮挡剔除来限制视图距离很重要,但也值得知道的是,用于渲染场景的许多绘制调用实际上都来自渲染阴影贴图的每个级联(更具体而言,来自我们项目中的定向光)。
-
We had a lot of draw calls coming from the small vegetation assets scattered on the terrain, hundreds and hundreds of them in some locations. We achieved a nice reduction of draw calls by creating larger patches of those grass and plant assets. Instead of having hundreds of them, we would then have only 15-20.
我们有很多抽奖电话来自散布在地形上的小型植被资产,其中有数百个在某些位置。 通过创建较大的草地和植物资产补丁,我们大大减少了抽奖活动。 而不是只有数百个,而只有15-20个。
Note that this has an impact on visual quality, with such large assets, it becomes really hard to avoid having the grass clipping with rocks and other assets placed on the ground.
请注意,这会对视觉质量产生影响,因为拥有如此庞大的资产,要避免草皮被岩石和其他资产夹在地面上变得非常困难。
- We are using layer culling, that is a feature already in Unity but does not have any UI. This feature allows you to cull objects that are assigned to a specific layer, depending on the distance they are from the camera. Torbjorn has extended this feature to be able to also cull the shadow casting of those objects at a different distance. For example, most of our small vegetation assets stop casting shadows at a distance of around 15 meters, which is not very noticeable given the amount of noise with the grass and other plants on the ground, and then they are completely culled at around 25 meters – no matter how their LODGroup are set up. 我们正在使用图层剔除,这是Unity中已提供的功能,但没有任何UI。 利用此功能,您可以剔除分配给特定图层的对象,具体取决于它们与相机的距离。 Torbjorn扩展了此功能,以便还可以剔除这些物体在不同距离处的阴影投射。 例如,我们大多数小型植被资产都在15米左右的距离处停止投射阴影,考虑到地面上草和其他植物发出的大量噪声,这并不是很明显,然后在25米左右完全扑灭了阴影–无论如何设置其LODGroup。
—
-
Stay tuned for the next blog post in the series. We’ll be exploring the work that went into creating the shading, lighting, post-processing, and more from the Book of the Dead.
请继续关注本系列的下一篇博客文章。 我们将探索《死者之书》中用于创建阴影,照明,后处理等的工作 。
If you couldn’t make it to Unite Berlin, we’ll soon be releasing Julien Heijmans’s presentation about environment art in the demo. You can follow our YouTube channel to keep up to date on when that video is released.
如果您不能参加Unite Berlin,我们将很快在演示中发布Julien Heijmans关于环境艺术的演示。 您可以关注我们的YouTube频道,以随时了解该视频的发布时间。
More information on Book of the Dead
quixel suite