The Process of Creating Volumetric-based Materials in Uncharted 4

来源:互联网 发布:32位 windows 内存支持 编辑:程序博客网 时间:2024/05/16 15:25


Hi everyone, welcome to the course.

My name is Yibing Jiang. I am the SeniorShading Artist of Naughty Dog. My responsibility includes in charge of all thecharacter materials of Uncharted 4, working with Character Artists to get goodfinal render results in every possible situation.

大家好,欢迎来到课程。 我的名字是江毅冰。我是顽皮狗高级材质师美术师。我的职责包括负责所有神秘海域4的角色材质,与角色美术师合作,在各种可能的情况下或者最好的最终结果。



Based on the title, you probably already know that insteadof generally talking about all the materials that we created for Uncharted 4characters, I will mainly focus on how we created fabric and hair.

Wewill also talk about the issues that we are facing in the early stage ofbuilding character shading pipeline.

Atthe last, I will introduce to youshader packages, which been widely used in ourcharacter shading pipeline and we will show examples of them.

基于标题,你可能已经知道,而不是通常说的是所有的材质,我们为神秘海域创建角色材质,我将主要集中在我们如何创建织物和头发。我们还将谈论初期阶段角色着色管线所面临的问题。

在最后,我将为您介绍着色器包,我们将展示他们的例子,被广泛应用于我们的角色着色管道。


Iremember westarted to develop character shading pipeline at the end of 2012.

At that time we knew PlayStation 4 was onthe way. We were so excited about working on the “next-gen” console that allowsus to ship a game that probably willlooklikea movie.

我记得我们开始开发角色着色管线在2012年底。当时我们知道PlayStation 4 是还在开发。我们一直很想在下一代控制台上运行,让我们的船在游戏中看起来更像个电影。


We hadcertain expectations of what next-gen consoles were capable of handling

我们对下一代游戏控制器的处理能力有一定的期待

早期阶段创建角色着色渲染管线

我们队下一代游戏控制器的处理能力有一定的期待

1.我们把PlayStation 4 当做渲染农场,通过使用昂贵的功能,是不可能在我们的引擎中实时运行的。

A.高分辨率的纹理贴图

B.完全使通过阿尔法混合来实现头发透明

C.多重采样抗锯齿

D.高分辨的阴影

2.我们认为从现在开始一切都必须是“基于物理的” 。BRDF在的游戏引擎的中,只要实施了迪士尼的“原则”我们的游戏看起来就像一个电影。


We can’t afford most of those expensive features that mentioned above.

DisneyBRDF is not enough to cover most of the character materials.

但现实是….

我们大多数是承担不起上面提到的那些昂贵的功能。

迪斯尼BRDF不足以覆盖大部分角色材质。


Then it gotus really think aboutthewhatwe need for character shading.

然后它让我们真的想到我们所需要的角色着色器。

基本着色器:体积阴影 真实细节感官感受

这些看起来非常棒,但不能实时运行在游戏中。

新的想法来至于团队

更好的工作流程

重写重写…..


Building fabric shader library

建造布料的着色器库


布料的挑战

1.大型布料类型的变化
2.如何实现不同的反射模型
3.布料有高度散射
4.可重复的微观织物结构
5.体积阴影
6.添加瑕疵细节,为了创造一个更真实的外观

微观布料结构

1.我们选了一些编织的图案


微观布料结构

2.源文件在Maya进行建模


微观布料结构

创建了一个简单的装置来至于扭曲管子。移动定位器来得到我们想要的形状。

复制源网格,并运行脚本合并边缘


问题:为什么我们使用扫描布料?

1.内存中保存纹理


问题:为什么我们使用扫描布料?

2. 保持所有的细节,而不必担心Mip Maps映射


问题:为什么我们使用扫描布料?

3.结合不同类型的微细节纹理,我们可以接近大多数布料在现实生活中的样子

12种类型的编织图案

4种不同的瑕疵细节

2种小皱纹和老化的方法

结合调整每一个大小

我们可以接近大多数布料在现实生活中的样子


结合多分辨率可重复的细节

基本颜色+GGX高光

改变布料BRDF

添加织物面料细节


结合多分辨率可重复的细节

添加布料老化

添加瑕疵细节

添加小的皱纹


添加缝针和漏洞

We alsoused UvSet2 for stitches and holes. They were built by using the same idea asfabric weave patterns.

我们还使用Uv2设置缝针和漏洞。它们通过使用相同的想法作为布料编织图案建造。


Video that demonstrate how we implemented fabric and leathershaders in our game.

视频演示我们的游戏中如何实现布料和皮革的着色


布料反射模型


布料反射模型

Thereason that we are using twodifferent reflection models for fabric instead of one, is because we wantartist spending less time setting up the shaders.

我们之所以使用两种不同的反射模型的布料,而不是一个,是因为我们希望艺术家在设置着色器花费的时间较少。


Inthis way, for NPC characters. if the artist turned on fabric shader package. They can get pretty gooddefault result to start with.

以这种方式,为NPC人物。如果艺术家打开了布料材质包。他们起初可以得到很好的默认效果。

1.丝绸、丝绒和其他高度反光面料

我们测试了各向异性GGX和Kajiya-Kay。各向异性GGX稍微略好,但基于我们的照明模式,很难看到在大多数情况下的优势。因此,我们选择了更便宜的。

2.例如 棉、毛等

我们在Dawn’scloth反射模型上使用一个准备好的进行变化。


看 创建一个"廉价次曲面散射“

diffuse= saturate(dot(N,L));

finalDiff = baseColor*diffuse*shadow;

diffuse= saturate(dot(N,L)+w)/(1+w); // 0<w<1

finalDiff = baseColor* diffuse *shadow;

diffuse= saturate(dot(N,L)+w)/(1+w); // 0<w<1

scatterLight = saturate(scatterColor + saturate(dot(N,L)))*diffuse

finalDiff = baseColor* scatterLight *shadow;


使面料看起来更柔软


Building hairshader library

建造毛发着色器库


建造毛发着色器库

发丝很薄;他们还是半透明的。

每缕发丝都有不同的法线,并投下相互之间的自阴影。为了实现头发的体积外观,我们需要一个一个解决这些问题。


头发卡片替代几何模型头发

PlayStation 4用户对多边形数量预算有显著改善,但它仍然很难为我们实时呈现出数百万的发丝。

因为我们这个项目中没有太多的时间去深入到曲面细分着色器,最终我们选择头发卡。


我们最终得头发真的很昂贵

1.高分辨率的透明贴图

2.使用阿尔法混合和多重采样抗锯齿

3.高分辨率的阴影

上面提到的给我们很好的效果。


但…….

All these methods cost a lot of GPU. Wewere unable to sacrifice gameplay and design for the look of the hair.

所有这些方法耗费了大量的GPU。我们无法牺牲玩法和对头发的外观设计。

This meant we had to find other ways to deliver similar results.

这意味着我们必须找到其他的方法来实现类似的效果。


我们的头发不能使用像我们想要的那么多的阿尔法混合

这是在调试模式下的截图 -纹理透支

Here Green or Blue means we are ok.

Red means over budget; Darker Redand Black means extremely over budget.

Which means we can’t afford a lot ofalpha-blending cards.

在这里,绿色或蓝色意味着我们都OK。

红色表示超出预算;暗红色和黑色意味着极其超过预算。

这意味着我们无法承受大量的alpha混合卡。


大多数我们的头发使用DitheredAlpha和延迟渲染

我们对大多数人的头发,关闭了alpha混合和使用抖动阿尔法与temporalAA相结合。此方法的缺点是我们有重影的影响,角色被移动过快或远离相机。


我们的头发没那么薄

若要避免这些问题,我们必须重新调整Cutoff系数的阈值。0=cutoffThreshold<=1

Theidea of cutoff threshold is simple.Byadjustingvalues of our original transparencymap. We can make sure our hair are readable when characters are moving or in adistance.

中断阀值的概念很简单。通过调整我们的原始透明度映射的值。当角色移动或者在远处,我们可以确保的头发是可读的。


但这是个问题--他们看起来像发卡"

Afterwe reduced the cost of hairshader, they didn’t look appealing to usanymore.

之后,毛发着色器的成本降低,他们看起来不在吸引我们了。

Atthat time, a lot of artists were discouraged, but eventually,we decided to take the challenge and looking for the reason why our hair didnot look good.

当时,很多艺术家沮丧,但最终我们决定接受挑战,并寻找原因,为什么我们的头发看上去并不好。


寻找原因

1.我们使用的是卡片上的顶点法线,而不是单根发丝的法线;

2.尖锐的阳光下头发卡片阴影处理像不透明物体。但发丝是半透明的;

Thoseissues were already there. But they were not that obvious when we are usinghigh-res alpha-blend.

这些问题已经在那里。当我们使用高分辨率的阿尔法混合时,但他们不并不是很明显.


头发上的法线

头发卡是角色艺术家们手工放置的,我们使用的技巧,如放置卡相互交叉,创造一个体积的感觉。

Nadine Ross创建的头发卡,弗兰克创建的模型


头发上的法线

从一张卡片平滑的过渡到另一张,我们需要统一卡片上的顶点法线

This step is necessary for the finalrender. Not only did this make hair overall look like a sphere, but it alsofixed the issues of individual cards having disconnection of diffuse, specularand backlighting scatter between cards.

对于最终渲染这一步是必要的。这不仅使头发整体看起来像一个球,但它也固定会有独立卡与卡片之间断开的漫反射,镜面反射和背光散射的问题。


头发上的法线

大多数时候,我们无法正常使用高分辨率的纹理映射

When we were creating hair textures, webaked down variation maps. These break down specular and backlighting scatterto make hair strands stand out.

Character TD Tyler Thornockwrote this hair tool for us

当我们正在创造的头发纹理,我们烘焙出来的变化图。这些打破镜面反射和背光散射,使发丝脱颖而出。

角色技术总监:Tyler  Thornock为我们写了这个头发工具


我们头发上需要体积阴影

尖锐的阳光下头发卡片阴影处理像不透明物体。但发丝是半透明的;

解决方案:减少阴影?这将使头发看上去很平。


我们尝试用自身阴影

这是我们使用了一个预先计算的好的自身阴影,它使用了57盏灯,创造了在不同情况下的广泛的阴影信息的测试。

Video ofSelf-shadowtest for fabric details

织物细节的自阴影测试视频


We tried the same thing on hair.Since it’s pre-computed, we didn’t need to worry about render time.

我们试过同样的事情在头发上.因为他是预先计算的,我们不需要担心渲染时间.

We could use semi-transparent alphamaps to bake the shadow information. We got a pretty good result that shows thedepth of the hair shadow.

我们可以使用半透明的阿尔法贴图来烘焙阴影信息。我们得到了一个很好的效果,显示了头发的阴影的深度。


我们的尝试更好的方法预先计算自身的阴影

We took references that consider different lightingenvironments.Based on the reference images, we can tell that sometimesthe direction of the lights play an important role for hair shadows, and insome scenes, the lighting situations are quite flat.

我们考虑不同的环境照明的参考文献。基于参考图像,我们可以看出有时灯的方向对头发阴影发挥了重要作用,并且在某些场景中,照明情况下是相当平坦的。

We needto find a middle ground to make sure the baked shadows readrealistically in most lighting scenes.

我们需要找到一个中间的立场,以确保在大多数场景照明中真实地看到烘焙的阴影。


我们尝试了更好的方法预先计算自身阴影

In order to achieve that, we divided all the lights into 5groups.

为了实现这一目标,我们把所有的灯光分为5组。

So that we will running into lessissues, when we implement light direction into baked shadows. Also it will makebaked shadows information much softer,and make the light direction less readable.

因此,我们将运行遇到较少的问题,当我们实现光的方向到烘焙的阴影。它也会使烘烤的阴影信息更加柔和,并使光的方向不太可读。


紧张的生产进度计划

Ifeel that we were almost there. However, as I mentioned before, with our tightschedule, we couldn’t ship directional pre-computed shadow maps for Uncharted4.

Wewill keep on working on it and hopefully we can show you guys somethingpromising next time.

我觉得我们几乎没有。然而,正如我前面提到的,我们的日程很紧,我们不能为神秘海域4传输定向预先计算的阴影贴图。

我们将继续努力工作,希望下一次我们能向你们展示一些有希望的事情。


我们传输的自身阴影

我们最后把所有的光源都结合在一起,烘焙到一张纹理,具有无方向性的阴影信息


它可以帮助我们得到头发的深度和体积的感觉


获取有限的纹理内存的头发细节

1k头发的纹理细节,很多头发卡共用

烘焙的512 X 512阴影贴图。我们使用uv2的设置来存储这些信息


我们如何才能在游戏中实现呢?

我们想到用烘焙的影子贴图代替头发上的影子。

在灯光布置好的室内效果看起来还不错,但我们需要考虑的情况在其他物体投射在头发上的阴影。会有像“在黑暗中发光”的问题。


烘焙阴影与游戏中的影子相结合

If we simply multiply in-game shadowand baked shadow together, we would get really flat looking results.

We can’t ship anything like this.

如果我们简单的把游戏中的阴影和烘焙的阴影结合相乘,我们结果看起来会变得很平。

我们不能船舶这样的事情.


我们需要在游戏里修改和烘焙阴影贴图

减少游戏中的头发上的阴影

简单的模糊头发上的影子在游戏中太过于昂贵,图形处理器智慧去实现。

我们之前提到的,在游戏中使头发变粗,减少纹理透支和重影的影响,但我不需要在游戏里加厚阴影。重置cutoffThreshold是最简单和最便宜的方式来减少游戏中的阴影。


在游戏中减少头发上的阴影

图片为之前和之后减少游戏中的头发阴影对比


修改烘焙头发上的影子

有一些调整烘焙的阴影,使最终的阴影更加真实。

1.添加灯光包烘焙阴影 

   hairShadow =(abs(dot( lightDirWS, normalWS)) + w) / ((1 + w) * (1 +  )) // w = 0.5;

2.使用探针照明强度和头发的颜色值来控制烘焙阴影

   aperture = hairShadow *lerp(0.5,1.0,dot(baseColor, kLuminanceFactor)); //white, blonde hairis getting less shadow

   hairShadow =saturate(hairShadow - (1.0 – aperture)); 


修改烘焙头发上的影子

图片为添加自身投射阴影的细节烘焙修改前后对比


Scatter on the Hair

头发上的散射


头发上的散射

我们决定使用一个给玩家头发散射印象的方法,GPU成本很低。

有2个关键要素,使头发分散看起来现实:

1.发丝之间的散射

2.背光散射

In physically based hair shadingmodels, light passes through a hair fiber, and gets Single Reflection (R),Double Transmission (TT), Transmission-Reflection-Transmission (TRT) and so on.

However, instead of diving deepertowards the direction of physically based hair shading models. We decided touse a method that gives players an impression of hair scatter, with very lowGPU cost.

So that we can afford it for crowd scene and multiplayercharacters.

基于物理的头发着色模型,光穿过头发纤维,并得到单反射(R)、双传输(TT)、透射反射传输(TRT)等。

然而,而不是潜水更深朝着基于物理的头发着色模型的方向。我们决定使用一个给玩家头发散射印象的方法,GPU成本很低。

因此,我们可以负担得起的人群场景和多人角色。


发丝之间的散射

类似于织物上的“廉价SSS”。我们发现大部分头发颜色的金发,黑发,黑色的,即使白发,添加红颜色会使头发看起来更柔软和真实。

diffuse = saturate(dot(N,L));

finalDiff = baseColor * diffuse*shadow;

diffuse = saturate(dot(N,L)+w)/(1+w); // 0<w<1

scatterLight = saturate(scatterColor + saturate(dot(N,L))) * diffuse

finalDiff = baseColor * scatterLight * shadow;

// For our hair, scatterColor = lerp(float3(0.992,0.808, 0.518),baseColor,0.5); 


背光散射

在这种方法中,我们认为头发是一个球体。我们可以看到基于光、摄影机角度和表面法线的散射


背光散射

Code:

----------------------------------------------------------------------------------

scatterFresnel = pow(cosThetaV , scatterPower);

scatterLight = pow(saturate(dot(V,-L)), scatterPower) *

                        (1.0 - cosThetaV) *(1.0 - cosThetaL);

transAmount = scatterFresnel + lightScale* scatterLight; 

----------------------------------------------------------------------

scatterpower是功率值调整使scatterfresnel形状看起来真实可信。

在我们的例子中,短头发scatterpower = 11,长和蓬松的头发scatterpower = 9。

lightscale是值我们选择基于头发的散射值。对于大多数金色的头发,我们选择一个更高的值。


背光散射添加变化

如前所述,我们必须使头发变粗,减少排序问题和纹理透支。与此同时,有关分散加入的变化会使头发丝脱颖而出,成本非常低。

Variation mapsused to break down the scatter and specular for hair strand details

Variation maps用于打破头发散射和镜面细节的变化图


头发反射模型

1.Kajiya-Kay

  基本的毛发反射模型没有什么新的   

  可参考 http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Scheuermann_HairRendering.pdf

2.高光的变化

我们在所有的头发材料上都有一个变化的蒙版。

原因:

高光的变化只会给玩家一种发丝的感觉;

错误不像其他的变化蒙版那么明显;

我们的头发卡的UV布局是统一的。

We are using a tile-able noise pattern to breakdown thespecular variation instead of high-res texturemaps

我们使用的是平铺噪音模式分解镜面变化,而不是高分辨率的纹理映射


降低NPC和多人角色的纹理内存

As we know that Scatter and Specularvariations are really important for the hair final look.

We tested by using the same tile-ablenoise as variation mask texture, which doesn’t100% match the hair flow. We realized that actuallyerrors are not that obvious to spot. It’s good enough for NPCs and multiplayercharacters.

我们知道,散射和镜面的变化对头发最终的外观是非常重要的。

我们通过测试使用相同的平铺噪声作为变化的蒙版纹理,它不是100%匹配的头发流动。我们意识到,其实错误不是很明显被发现。这对NPC和游戏人物不够好。


着色器包是什么?

At last we are going to talk aboutshader package, which have been widelyused in our character shading pipeline.

最后,我们将讨论关于着色器包,它已被广泛应用于我们的角色着色管道。


Videoof snowshader in dynamic wear and tearpackage

雪着色器动态磨损和撕裂的视频


着色器包是什么?

一个着色包是一个黑色的盒子,是由一个材质艺术家创造的。通过使用用户的几个输入,它可以实现一致的高品质的渲染结果,而不需要用户学习复杂的着色规则或做重复的工作,可以自动完成。

It was inspired by the shadingpipeline of animation feature film. In film production, shading artists weredoing research of different surface materials and building the packages beforecrunch started.

Once the artist created a package,other artists could easily get the materials they wanted by adjusting a fewsliders.

Also, during production, shadingartists could get feedback from other artists and update the packages. All thematerials that are using the package will be updated too.

它的灵感来源于动画电影的着色管线。在电影制作中,着色艺术家们正在研究不同的表面材料,并在关键时期启动前建立包。

一旦艺术家创造了这个包,其他艺术家可以很容易地得到他们想要通过调整几个滑块材料。

此外,在生产过程中,着色艺术家可以得到其他艺术家的反馈和更新的软件包。所有正在使用包的材料也将被更新。


传统的静态材质库与着色器包

静态材质库

这是容易添加到材质库

相对便宜些,如果所有的贴图都烘焙了

着色器包

易于使用,易于更新

在危机期间加快生产

材料质量的稳定性

易于添加某些材料的特殊功能

当光照模型发生变化时迅速发现问题


其他着色器包的实例 毛发材质


其他着色器包的实例 皮肤材质


其他着色器包的实例 眼睛


我们吸取的教训

Themost valuable lesson we learned was - Shipping a game was way different thanmaking a real-time demo.
Gameplayand having smooth framerates are always the number one priority. There are somany things in our game could slow down the frame rates, such as crowds,particles, complex environments, etc.

We hadto cut down the cost ofcharacters constantly, insteadof mainly focusing on pretty images.
Therewere so many times we almost lost hope about whether we were able to shipsomething decent with such strict limitations.
Fortunately,we have a great team with all kind of creative ideas and always there to helpeach other. It’s a great honor to be part of the team, andit’s a great learningexperiencesto work on this challenging project.

我们学到的最宝贵的教训是航运游戏比做出实时演示的方式不同。

游戏具有平稳的帧速率总是首要任务。在我们的游戏中有这么多的东西可以降低帧速率,如人群,粒子,复杂的环境等。

我们必须不断降低角色成本,而不是主要集中在漂亮的图像。

很多次我们几乎失去希望,在如此严格的限制下我们是否能够推出像样的东西。

幸运的是,我们有一个伟大的团队,有各种创造性的想法,总是在那里互相帮助。这伟大的荣誉是团队的一部分。这是一个很好的学习经验,在这个具有挑战性的项目工作。


特别感谢

角色团队:

弗兰克,Colin Thomas, 李素雅, Jaehoon Kim, Byung Hwa Jung, Adam Scott,

Adam Skutt, Corey Johnson, Glauco Longhi, Nicolas Collings, Wasim Khan, Tyler Thornock,

HansGodard, Nathan Horne, Damon Shelton, Nancy Cantu, Erik Ortiz

其它:

VincentMarxen, Waylon Brinck, Ramy El-Garawany, Ke Xu, Carlos Gonzalez-Ochoa

AndrewMaximov, Tate Mosesian, Dave Smith, Jerome Durand, EdwardPereira,

Mark Shoaf, Leandro Amaral, Nicholas Lance, Connie Huang,Inigo Quilez,

Jorge Jiménez,Natalya Tatarchuk


加入我们

http://www.naughtydog.com/work


在此感谢江姐分享这么精彩的PPT,翻译的水平有限,有不足之处请谅解!


0 0
原创粉丝点击