您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 chenpan85 于 2022-9-4 23:40 编辑
Gilbert Sanders:
It is said that God created a beautiful world in seven days, not even including Sunday. Yet Guerrilla Games spent seven years building Horizon Zero Dawn's world, often working late on Sundays. That's the only joke of the day. The rest is all about technology. 据说,上帝在7天时间里创造了一个美丽的世界,甚至还不包括(安息日)星期天在内。然而,Guerrilla Games打造《地平线:零之曙光》的游戏世界却用了7年,而且经常需要在星期天加班。 这是今天唯一的玩笑,其余内容都是与技术相关。 Let me introduce myself. My name is Gilbert Sanders and I am the Principle Artist at Guerrilla Studio. Along with two other artists, we are responsible for creating the vegetation in Horizon Zero Dawn's world. Since joining Guerrilla in 2006, I've worked as an environment artist on Killzone 2 and a shader texture artist on Killzone 3. After those two games, in early 2011, I joined a small team inside the studio and began prototyping and testing for a project that would become Horizon: Zero Dawn. During this time, I also worked on Killzone: Shadow Fall, but since 2014, I've been working full time on Horizon: Zero Dawn. When you're playing the game, you probably don't notice the vegetation in the game, because most of the time you need to focus on the danger in the game, so let's take a look at the vegetation effect we finally created in the game: 先做个自我介绍,我的名字是Gilbert Sanders,是Guerrilla工作室的首席美术师(Principle Artist),与另外两名美术师一起,我们共同负责《地平线:零之曙光》游戏世界里的植被创作。 自2006年加入Guerrilla以来,我曾在《Killzone 2》担任环境美术,在《Killzone 3》担任着色器纹理美术师。这两款游戏之后,2011年初,我加入了工作室内部的一个小团队,并开始了一个项目的原型创意和测试,也就是后来的《地平线:零之曙光》。在此期间,我也参与了《Killzone:Shadow Fall》的研发,不过,自2014年之后,我就全身心投入到了《地平线:零之曙光》的研发。 玩游戏的时候,你们可能不太会注意到游戏里的植被,因为大多数时候都需要聚焦于游戏里的危险,接下来先看看我们最终在游戏里创造了怎样的植被效果:
We're going to focus on vegetation creation today, and most people face similar challenges when it comes to creating, simulating, and rendering natural resources. Natural resources, even on this generation's most advanced hardware, are a real problem. Despite the hassle, the topic is interesting, and the principle of "doing more with less" still works here. 我们今天主要分享的内容就是植被创作,在创作、模拟和渲染自然资源方面,大多数人都遇到过类似的挑战。自然资源,即使是在这一代最先进的硬件上,依然是一个真实存在的麻烦。除了麻烦之外,这个话题也是很有趣的,“少花钱多办事”的原则在这里仍是可行的。 Here are some of the topics I'll be covering today, and together they illustrate the technical and artistic challenges of creating and rendering large amounts of vegetation in our Decima engine. But first, some general information, history, and then a quick dive into these topics. First, some information on Decima Engine shaders, which as an artist allows me to create and maintain my own shaders, albeit with the support of my technical team. Our rendering engine can run directly from shader nodes in Maya, and the graphics programmers at the studio have done a lot to customize shader nodes. 图片中是我今天会谈到的一些话题,他们共同呈现了在我们Decima引擎里创造和渲染大量植被遇到的技术以及艺术方面的挑战。不过,首先我们来说一些整体信息、历史,随后再快速开始这些话题。 首先介绍一些Decima引擎着色器的信息,作为美术师,我可以通过这个引擎创造并维护自己的着色器,当然,这是在有技术团队支持的前提下才有可能实现。我们的渲染引擎可以直接通过Maya当中的着色器节点运行,并且工作室的图形程序员还做了很多定制化着色器节点。 The Decima engine uses delayed rendering, and we expect Horizon Zero Dawn to achieve 1080p quality at 30fps on PS4 hardware (and 4K on PS4 Pro). Decima引擎使用了延迟渲染,我们希望《地平线:零之曙光》能够在PS4硬件上以30fps实现1080p(在PS4 Pro实现4K)画质。 When we start working on the new IP Horizon: Zero Dawn, it will include everything in the picture. We were sold when we first heard about the IP, especially the "BBC" Nature, which is one of the pillars of the project. 当我们开始研发新IP《地平线:零之曙光》的时候,将包含图片中的所有东西。第一次听到这个IP的时候,我们就被说服了,尤其是其中的“BBC”大自然,这也是项目的支柱之一。 While we were working on Horizon Zero Dawn, the rest of the studio was busy working on the PS4 game Killzone Shadow Fall, which had a level that could be used in the new game, except for enemies, which was our first real test of vegetation appearance and motion production. We quickly realized that because vegetation resources are not static, it would be difficult to outsource them. We also found that building the vegetation in the game world the way Killzone did would not work in the open world of Horizon Zero Dawn, and we needed to rethink polygons, shaders, and texture budgets. This level also marked the humble beginning of the first Placement system, in which we had only the simplest enemies to run, but it also showed us that without a placement system we couldn't achieve the world we really wanted. 当我们在做《地平线:零之曙光》的时候,工作室的其他人都在忙着研发PS4游戏《Killzone Shadow Fall》,除了敌人之外,后者有一个关卡可以被用到新游戏当中,这是我们在植被外观和运动制作方面的首次真正测试。 我们很快意识到,由于植被资源并不是静态的,想要把它们进行外包会有些困难。我们还发现,如果按照《Killzone》的方式打造游戏世界内的植被,在《地平线:零之曙光》的开放世界里是行不通的,我们需要重新思考多边形、着色器以及纹理预算。 这个关卡也标志着首个布局系统(placement system)卑微的开端,我们只有最简单的敌人运行其中,但这也告诉我们,如果没有布局系统,就没办法实现我们真正想要的游戏世界。 To underline the point, I've included a talk from my colleague Jaap last year (2017). In short, we've created a system where artists can describe a wide variety of interesting and believable environments that can be applied anywhere in the game world. 为了强调着一点,我专门列出了同事Jaap去年(2017年)的演讲,简短来说,我们创造了一个系统,美术师可以在其中描述种类繁多、有趣而可信的环境,可以应用于游戏世界的任何地方。 模拟 We wanted the system to be highly art-directed and support manual layout art, and it needed to be fully data-driven, deterministic, and locally stable. Not only did this help us quickly populate the game world, but it also helped in the beta phase, such as helping to test the size and performance of new resources, so it's highly recommended that you watch the Jaap presentation. Moving on to our Foliage Movement, from the very beginning we knew that nature simulation should be linked to the broader systems in the game, that it should be art and gameplay driven, and that it needed to be controlled, that it needed to drive our vegetation shader programs. The basis of our simulation is the Global Wind Force Field. Before Horizon: Zero Dawn, wind stands were wind boxes, which we used primarily to drive particles, and they were locally used, manually laid out, and on a smaller scale. The Global Wind Farm is an extended version of these bellows, but with some changes. Our global wind farm is a computer shader that runs at the beginning of each frame, simulates the full impact of a wind force on the four types of Spring Settings, and updates the 3D textures that the shader can sample. The first is player related, which is shot FOV, which allows the simulation to be presented to the player up close at high resolution, and at long range, we present it at very low resolution. Here's a quick look at the global wind system in the game: 我们希望这个系统具有高度艺术指导性,并且支持手动布局美术,它需要是完全数据驱动、确定,而且是本地稳定的。这不仅可以帮助我们快速填充游戏世界,还对测试阶段有很大帮助,比如帮助测试新资源的规模和性能,因此非常推荐同行观看Jaap的演讲。 接下来谈谈我们的树叶运动(foliage movement),从一开始,我们就知道大自然模拟应该与游戏里更广泛的系统相联系,它应该是美术和玩法驱动,而且需要是可控的,需要驱动我们的植被着色器程序。 我们模拟的基础是全局风力场(Global wind force field)。在《地平线:零之曙光》之前,风立场就是风箱(wind box),我们主要用它来驱动粒子运动,它们是在本地使用、手动布局,而且规模较小。 全局风力场是这些风箱的扩展版,不过进行了一些改变。我们的全局风力场是在每帧开始运行的一个计算机着色器,模拟一道风力在四类spring setting上的完整影响,并更新着色器可以取样的3D纹理。 首先是与玩家相关,也就是镜头FOV,这可以让模拟以高分辨率向玩家近距离呈现,在远距离,我们以非常低的分辨率展现。我们来快速浏览一下游戏里的全局风力系统效果: It can simulate the four different types of Spring setting, in the case of logic does not require any additional shaded, three types of resources it allows us to create four different kinds of sports, we these resources can be divided into three types (trees, plants, grass), but we also have unified the ranks fourth class special objects, namely special objects, Such as banners, tarps, etc. However, for rendering and shading purposes, we only used two shaders. In fact, we started out with just one shader for everything, but then it turned out that sod needed something special, so we built a shader for him. 它可以模拟四个不同类别的Spring setting,在不需要任何额外着色逻辑的情况下,它可以让我们为三种资源类型创造四种不同的运动,我们将这些资源分为三种类型(树木、植物、草皮),不过我们还把特殊物体统一划归第四类,也就是特别物体,比如横幅、防水布等等。 不过,考虑到渲染和着色的目的,我们只用了两种着色器。实际上,我们开始的时候只用了一个着色器解决所有事情,但后来发现,草皮需要特别的方法,所以我们专门给他打造了一个着色器。 Sod will come later, but I want to talk about tree and plant shaders first. We have a way to simulate the wind, but that still needs to be translated into the motion of the resource on the screen. To do this, we took a similar approach to GPU Gems 3, which was the main reference when I started doing vegetation in 2011, and until now this way of storing skin data is one of the few methods that hasn't changed during the development process. We've changed a lot of things in seven years, but this way resources are available at any scale. In order for trees to look realistic, we need three levels of detail: mass motion, which is the bending of the entire resource; Medium motion, that is, swaying branches; There are also small movements, which are the tree tops or leaves movement details. 草皮会在后面说,但我这里希望先谈谈树木和植物着色器。我们有了模拟风的方式,但这仍然需要转化为资源在屏幕上的运动。为此,我们采取了类似GPU Gems 3的方式,在2011年我开始做植被的时候,这是主要的参考文献,直到现在,这种存储蒙皮数据的方式仍是研发过程中没有改变的少数方法之一。我们在7年里改变了很多东西,但这种方式在任何规模的资源都是可用的。 为了让树木看起来真实,我们需要有三种程度的细节:大规模运动,也就是整个资源的弯曲;中型运动,即树枝摇晃;还有就是小型运动,也就是树梢或者树叶运动细节。 The first is the movement of the whole tree, so we used resource height as an element of mass movement. The next level of movement is the movement of branches and appendages, starting with the trunk, where the elements are all shown in blue, and simply put, we store the branch distance. The third level of movement is the leaf, the red channel in the picture, where we're storing branching distances. 首先是整棵树的运动,所以我们使用了资源高度作为大规模运动的要素。 下一个等级的运动是树枝以及附属物的运动,从树干开始,这里的要素全部以蓝色显示,简单来说,我们存储了树枝距离。 第三个等级的运动是树叶,如图中的红色通道,这里我们做的是存储分枝距离。 With Vertex shader, our vegetation works. All the vegetation resources need to be driven through vertex shader, so we end up with a series of different forms to adjust the animation based on the resource. These variations are colored orange and are enough to handle all the tree movement we have in the game. Tree stiffness is the easiest to handle, and we have 3 controls for branches: bend, sway, and up and down. The final dynamic is leaf movement, which depends on the wind intensity. I used a small 3D single-row noise texture (16x16x16) to simulate leaf movement. 有了顶点着色器(vertex shader),我们的植被就可以工作了,所有的植被资源都需要通过顶点着色器驱动,所以我们最终有了一系列的不同形式根据资源调整动画。这些变化形式被标记成了橘色,足以处理我们在游戏里所有的树木运动。 树木硬度是最容易处理的,对于树枝,我们有3个控制方式:弯曲、摇摆和上下运动。最后一个动态是叶子运动,取决于风力强度不同,我使用一个小型3D单行噪声纹理(16x16x16)模拟树叶运动。 Since the plants in the game use the same shaders as the trees, but at a smaller scale, we had to remove the bending effect from the plants, which not only reduced the performance overhead, but also prevented them from bending into the terrain. In addition, another helpful part of our shader is the tilt formula, which can be used to calculate the motion effect of different resources affected by wind. When we started Horizon Zero Dawn, we had big goals for turf. The sod needed to be everywhere, and we wanted the sod to be geometric and have a realistic interaction with wind and other force fields, but we didn't think about what challenges that might pose. We started experimenting, but the sod rendering took up the whole frame, so we had to keep simplifying the sod, trying to find ways to do more with less. 由于游戏里的植物使用了与树木同样的着色器,但同时规模又更小,我们不得不去掉这些植物的弯曲效果,这不仅降低了性能开销,还避免了它们弯曲到地形当中。另外,我们着色器内另一个比较有帮助的是这个倾斜公式,可以用来计算不同资源受到风力影响的运动效果。 当我们开始《地平线:零之曙光》研发的时候,对草皮有着很大的目标。草皮需要无处不在,我们希望这些草皮是几何体,能够与风力和其他力场有真实的互动效果,但我们没有考虑这可能会带来什么挑战。 我们开始尝试,但草皮渲染占据了整帧,所以不得不对草皮进行不断简化,尝试找到事半功倍效果的方法。 We sample the global wind field, which is the underlying state of in-game turf movement. But it's not very visually spectacular, we need more dynamics, and we don't want the turf to move in the same direction for a long time, and we can't stay still all the time. On top of that, we added large range and small range dynamics, which together form the environment dynamics and account for 80% of the turf animation. Our turf must be more versatile than simulation. We wanted to avoid the situation where the player looked down and the geometry disappeared, so we tilted the turf grid according to the camera, as shown below: 我们对全局风力场进行采样,这就是游戏内草皮运动的基础状态。不过,它并不能带来非常壮观的视觉效果,我们需要更多的动态,而且我们不希望草皮长期朝着同一个方向运动,也不能一直静止不动。 在此基础上,我们分别增加了大范围动态和小范围动态,他们共同形成了环境动态,占据了草皮动画量的80%。 除了模拟之外,我们的草皮还必须有更多功能。我们想要避免的情形是,当玩家低头看的时候发现几何体消失了,所以我们根据镜头对草皮网格进行倾斜,就像下图那样: In this case, the turf will not look like a static card. 这种情况下,草皮看起来就不会是一成不变的卡片了。 In addition, we made the sod stick closer to the ground, and reduced the amount of animation for distant sod, reducing the number of grids to make these sod loads easier, and improving performance. coloring Transparency can be expensive in games, even in the alpha phase, and we didn't have much experience with alpha resource coloring during the Killzone years. While overly simple, vegetation relies heavily on alpha testing, so the question is, how do we build as much turf as Horizon Zero Dawn requires? 此外,我们还让草皮与地面贴的更紧,并且减少了远处草皮的动画量,降低了网格数量使得这些草皮加载更容易,提高了游戏性能。 着色 在游戏里,实现透明度的代价是非常高的,哪怕是alpha阶段也很昂贵,在研发《Killzone》的那些年,我们对于alpha资源着色并没有太多经验。尽管过度简单,植被也很大程度上依赖于alpha测试,所以问题在于,我们如何打造《地平线:零之曙光》需要的那么多草皮? Our solution was to render all the vegetation textures in both channels. We did alpha testing in the depth channel, where we could get the depth of all the resources. Geometric channels are more expensive, but efficient. So, let's take a look at a frame in the game and see what it means for GPU rendering time: 我们的解决方案是将所有的植被纹理都在两个通道渲染,我们在深度通道做alpha测试,这时候可以得到所有资源的深度;几何体通道代价更昂贵,但效率很高。 那么,我们分析游戏里的一帧画面来看它对GPU渲染时间意味着什么: This is a screenshot of the in-game GPU Profiler. The percentages here are the resources processed by our layout system. Of interest to us is that depthPrime takes up almost 10% of the entire frame and geometry takes up around 11.5%, making them 21.345% in total. 这是游戏内的GPU Profiler截图,这里的百分比是我们的布局系统处理的资源,我们比较感兴趣的是,depthprime几乎占了整帧10%,几何体占据11.5%左右,它们总共是21.345%。 Horizon: Dawn of Zero's Alpha texture uses the Signed Distance texture, which allows the artist to control the texture size in the shader. We can zoom in and out of the shader, control the distance, this is mainly to adjust the visual quality of different distances, we also include adjustable snow in the shader. We were always trying to improve performance and found that tuning Alpha in shaders was expensive. 《地平线:零之曙光》的Alpha纹理使用了符号距离(Signed Distance)纹理,可以让美术师在着色器里控制纹理大小。我们可以在着色器里进行放大和缩小,控制距离远近,这样做主要是为了调整不同距离看到的视觉效果品质,我们还在着色器里加入了可以调节的雪花。 我们始终在努力提升游戏性能,并且发现在着色器里调节Alpha的开销很大。 Let's take a look at the GPU Profiler. It's important to note that during the development process, there were so many changes that it was difficult to replicate a particular situation, so this is a mock version that I made. Pay attention to the DepthPrime changes, the shadows take up about 9% of the whole frame. When we lowered the shadow by 2%, depthPrime decreased by 1%. 再来看看GPU Profiler,需要声明的是,在研发过程中,由于发生太多的变化,很难复制特定情形,所以这是我做的一个模仿版本,注意关注depthprime的变化,阴影占据了整帧的9%左右,这时候depthprime是6%,当我们将阴影降低2%之后,depthprime降低了1%。 The smaller the Alpha is, of course, the better, but for the amount of resources you'll need to draw, you'll need to get used to caching, especially for turf, and you'll need a good anti-aliasing solution to achieve good visuals. Alpha当然是越小越好,但对于你需要绘制的大量资源来说,还需要适应缓存,尤其是对于草皮来说,而且你需要有比较好的抗锯齿解决方案才能实现比较好的视觉效果。 For the anti-aliasing issue, interested peers can refer to Kojima Studio's talk like this. Apply colours to a drawing Our Decima engine uses delayed rendering and the vegetation shader writes these G-buffers: 对于抗锯齿这个问题,感兴趣的同行可以参考小岛工作室的这样演讲。 渲染 我们的Decima引擎使用延迟渲染,植被着色器写入这些G-Buffer: However, for resources that are highly triangular dependent, the "error" flip can be helpful, and we can compare the following effects: 不过,对于高度依赖三角形的资源来说,“错误”翻动是有帮助的,我们可以对比以下效果: reflectivity All the vegetation in our game is colored, we make texture arrays for that, and we give artists a variety of options based on resource types, game world data, and ecosystems. 反射率 我们游戏里所有的植被都是着色的,我们为此做了纹理数组,并且基于资源类型、游戏世界数据和生态环境为美术师提供了多种选择。 We will roughness and reflectivity spun off from the texture samples, we set to 4% Dielectric reflectivity, for roughness, we want to give artists more control, they can for the environment light shade, shade texture and adjusted translucent texture, so simple in the midst of a texture roughness of the difference between the leaves and bark. For the sod, we chose a translucent texture to achieve a similar effect. 我们将粗糙度和反射率从纹理样本中剥离出来,对于反射率我们设置为4% Dielectric,对于粗糙度,我们希望给美术师更多控制权,他们可以对环境光遮挡、遮挡纹理和半透明纹理进行调节,以便简单在一个纹理当中区分树叶与树皮的粗糙度。对于草皮,我们选择了用半透明纹理实现类似的效果。 The first three images can't be adjusted in shaders. The last three images can be adjusted by the artist. Resource creation Now let's look at the creative pipeline of vegetation resources. When we started Killzone, we knew how to build these things: 图片中的前三个是没有办法在着色器中调整的,后面三个是可以让美术师进行调节的。 资源创作 接下来我们来看植被资源的创作管线,当我们开始做《Killzone》的时候,我们知道如何打造这些东西: This is an effect we created in early 2014 to determine the density of vegetation in the forest. By E3 2015, we had the first playable version of Horizon: Dawn of Zero, and we were doing a lot of LODs because of the need to get developers to show them live. As the show approached, we were thinking about how to improve the look and performance of these LODs without reducing the triangles. 这是我们2014年初做出来的效果,用来确定森林里的植被密度。 到了2015年的E3,我们有了《地平线:零之曙光》的第一个可玩版本,由于需要让开发者在现场展示,我们做了大量的LOD,随着展会临近,我们在思考如何在不减少三角形的情况下提高这些LOD的外观效果和性能。 We started with a low grid, and if we liked how it looked in the game, we started adding more detail. For example, it took us a very short time to create what a tree might look like. During the development of Horizon Zero Dawn, we used SpeedTree to create these resources. If we weren't satisfied with the results, we could quickly change them, and if we were satisfied, we would quickly create high-resolution resources. 我们最初是从低网格开始的,如果喜欢在游戏里的效果,那么就开始增加更多的细节。 比如,我们用了很短的时间打造了一棵树可能拥有的外观,在《地平线:零之曙光》研发过程中,我们用SpeedTree制作这些资源,如果对效果不满意,我们可以快速更改,如果满意,就迅速制作高分辨率资源。 Once we're happy with the textures, we put them in Maya for texture baking to create the UV space we need for our game mode. 一旦对这些纹理感到满意,我们就放到Maya进行纹理烘焙,做成我们游戏模式里需要的UV空间。 Next WE PUT THE QUICK MODE GRID TO THE TEST IN THE GAME. Did ANYONE NOTICE THAT WE PUT THE MAIN CHARACTER IN THE BACKGROUND? 接下来我们把快速模式做出来的网格放到游戏里测试,有人注意到我们把主角放在背景当中了吗? We used the in-house Houdini tool to export the resources to Maya, and then imported the resource Settings from Maya into the game. 我们用内部打造的houdini工具将资源导出到Maya,然后就是将资源设置从Maya导入到游戏里。 This is the production of another resource (plants) Shadow reflected 这是另一种资源(植物)的制作 阴影反射 For the sun shading, we used four cascades. For the other cascades, we only cover the main character Aloy, which means that she, her clothes and the surrounding objects have relatively high quality shadows, and all vegetation is not rendered in this cascade. 对于太阳光阴影,我们使用了四种级联,对于隔层级联,我们仅覆盖主角Aloy,意味着她自己以及她的衣服和周围物体都有比较高质量的阴影,所有的植被在这个级联都不会被渲染。 The cascades of 0 and 1 represent the normal shadow map, which is the vegetation render, and we also used the distance cascade to render the height map. Between the different cascades, we used a fade in and out effect so that switching between the two cascades doesn't feel unnatural. Due to the lack of time, we will not explain this part in particular. 级联0和1代表普通阴影映射,也就是植被渲染,我们还使用了距离级联来渲染高度映射。不同的级联之间,我们采取了淡入淡出效果,让两个级联之间的切换不会令人觉得不自然。 由于时间的关系,这部分我们不做特别详细的解释。 总结 To conclude, I briefly introduced some vegetation authoring methods and tools that I recommend to my peers, such as Depth Prime, customized Mip Chain, LOD Up, separating your shadow casters from the visual grid, and using a layout system. The other thing that helped us a lot was that we did all this in-house, which allowed us to iterate and improve the appearance and performance of the vegetation 作为总结,我简单介绍一些推荐同行们使用的植被创作方法和工具,比如Depth Prime、定制化Mip Chain、LOD up,将你的shadow casters与视觉网格分开,使用布局系统。另外一个对我们带来很大帮助的就是,这一切都是我们内部完成的,这使得植被外观和性能得以不断迭代、提升
|