刀剑神域:突破界限I

Luma Arcade’s recently released Bladeslinger for iOS (and soon to be on Android) pushes the boundaries of what can be achieved on mobile hardware – soft shadows, depth of field, real-time reflections and stunningly detailed environments.
Luma Arcade最近发布的iOS版 Bladeslinger (即将在Android上推出) 突破了移动硬件可以实现的范围-软阴影,景深,实时反射和令人惊叹的详细环境。

What started out nearly 2 years ago as a “Sci-Fi-meets-western Infinity Blade clone” evolved dramatically over time into a large world, free roaming, fully engaging and interactive action title with combat based around such titles as Devil May Cry and God of War.

大约2年前作为“ 科幻相遇的西部无限刀片克隆 ”开始,随着时间的流逝,它Swift发展成为一个广阔的世界,免费漫游,完全参与并具有互动性的动作标题,并以Devil May Cry战神

Let’s talk with Luke Lamothe – Technical Director at Luma Arcade about the gritty details behind the Bladeslinger visuals.

让我们与Luma Arcade的技术总监Luke Lamothe谈谈Bladeslinger视觉效果背后的具体细节。

Character Shading

字符底纹

Main protagonist William as well as enemies and non-player characters in Bladeslinger are per-pixel lit, have normal maps and exhibit specular effect. First optimization Luma Arcade employed was texture lookup for specular power calculation.

主角William以及Bladeslinger中的敌人和非玩家角色均按像素点亮,具有法线贴图并显示镜面效果。 Luma Arcade使用的第一个优化是纹理查找,以进行镜面反射功率计算。

Me: Did you do any optimizations for characters in the distance?

我:您对远处的角色进行了优化吗?

Luke: Yes, we augmented per-pixel character shader with much cheaper version – no bump and specular in this shader is calculated per-vertex. We apply this shader to the lower LOD mesh for all enemies. So when they are far from the camera, they have significantly reduced fillrate cost.

卢克(Luke):是的,我们使用更便宜的版本增强了每个像素的字符着色器-此着色器中的凹凸和高光不是按顶点计算的。 我们将此着色器应用于所有敌人的较低LOD网格。 因此,当它们离摄像机很远时,可大大降低填充率成本。

Me: Which format did you pick for normal maps on characters?

我:您为角色的法线贴图选择了哪种格式?

Luke: We found that there was negligible visual quality loss in using default compression on normal maps as opposed to 16 or 32 bit ones, and the bandwidth, let alone memory savings far outweighed any hard-to-perceive normal artifacts.

卢克:我们发现在法线贴图上使用默认压缩(而不是16位或32位)时,视觉质量损失可忽略不计,而且带宽(更不用说内存节省)远远超过了任何难以理解的法线伪像。

Light Probes

光探头

Light Probes were a great help for getting lighting right on Bladeslinger characters.

“光探针”对于在Bladeslinger角色上获得正确的照明非常有帮助。

Luke: We were able to set up and bake light probes every few meters in our scenes and modify our character shaders to take this lighting information into account. This allows our characters to move in and out of both shadow and light in a very realistic manner; something that is of great importance for Bladeslinger with its high use of long shadows on dusty roads and the bright glows of evil glyphs that permeate the streets of Hammer’s Peak.

卢克:我们能够在场景中每隔几米设置并烘焙一个光探测器,并修改角色着色器以考虑到该照明信息。 这使我们的角色能够以非常逼真的方式进出阴影和光线。 对于Bladeslinger来说,这非常重要,因为它在尘土飞扬的道路上大量使用长长的阴影,并且在Hammer's Peak的街道上散发出邪恶的标志符号的明亮光芒。

Shadows on Characters

人物阴影

Happy with lighting and shading on characters Luma Arcade wanted to take it a step further and do what nobody had done before in a high end mobile game; that is, have actual shadows cast onto characters.

Luma Arcade希望对角色的灯光和阴影感到满意,因此希望将其进一步发展,并做高端手机游戏中以前没有做过的事情。 也就是说,将实际阴影投射到角色上。

Luke: At the time, Unity didn’t support full on shadow mapping out of the box (be sure to check out Unity 4 for this and more awesome features!), and it is just as well because we probably didn’t have the performance wiggle room to add shadow maps. So like all good game developers we decided to get sneaky and do some Static Shadow Mapping of our own. To achieve this, we set up offline bakes of the shadows in our scenes to relatively large textures – basically a lower resolution lightmap of the scene as seen from the light point of view. We then modified our character shader to project this additional texture using matrix constructed from Sun Light. So while this doesn’t allow for full dynamic shadows to be cast or self shadowing, it is a relatively inexpensive technique that allows for a quite a major improvement to the visual fidelity of the characters in the scene.

卢克:当时,Unity不支持开箱即用的阴影映射(请务必查看Unity 4的此功能以及更多令人敬畏的功能! ),它也是一样,因为我们可能没有性能摆动空间添加阴影贴图。 因此,像所有优秀的游戏开发人员一样,我们决定偷偷摸摸地做一些我们自己的静态阴影映射。 为实现此目的,我们将场景中阴影的离线烘焙设置为相对较大的纹理-从光的角度来看,基本上是场景的较低分辨率的光照贴图。 然后,我们修改了角色着色器,以使用从Sun Light构造的矩阵投影此附加纹理。 因此,尽管这不允许投射完整的动态阴影或自阴影,但它是一种相对便宜的技术,可以极大地改善场景中角色的视觉保真度。

Me: What is the resolution of your Static Shadow map?

我:您的“静态阴影”贴图的分辨率是多少?

Luke: Between 512×512 and 2048×2048 depending on the scene.

卢克:视场景而定,介于512×512和2048×2048之间。

Me: Should be straightforward to apply the same to all dynamic objects in the game, right?

我:应该简单地将其应用于游戏中的所有动态对象,对吗?

Luke: Yes, it was easy for us to expand the technique to be used on pretty much all of our animating world objects like banners, water wheels, the train that William arrives on, etc.

卢克:是的,对于我们来说,很容易扩展这项技术,以便将其用于几乎所有动画世界对象,例如横幅,水车,威廉到达的火车等。

Me: But that’s not all of it…

我:但这还不是全部...

Luke: Once our artists saw that we had this texture that was used to shade our characters, they decided to get fancy and paint in the odd additional lighting and shading details by hand! This allowed our artists some finer control for areas of the world where maybe the light probes just didn’t give them 100% of the result that they would have liked.

卢克(Luke):一旦我们的画家看到我们具有用于阴影角色的纹理,他们便决定手工手工在奇特的其他灯光和阴影细节上进行着色和绘画! 这样一来,我们的艺术家就可以更好地控制世界上某些区域,在这些区域中,光探针可能并不能给他们100%的满意结果。

Shadows from Characters

人物的影子

Next, grounding characters with shadows and thus tying them into environment was a must-have feature. Again, Luma Arcade wanted to push the envelope and do something that wasn’t being done widely in high quality mobile titles.

接下来,使角色带有阴影并因此将它们绑定到环境中是必须具备的功能。 再次,Luma Arcade希望突破极限,并做一些高质量手机游戏中尚未广泛完成的事情。

Luke: There are many, many ways to go about rendering projected shadows, but we believe that what we ended up with is quite unique in its efficiency and quality, though it isn’t without its own limitations. We start with an optimized mesh for each character that has a custom shader on it. Shader renders that mesh to a single channel (either R, G, B, or A) of a high resolution shadow texture. As you can see, this limits us to having only 4 projected shadows at once, meaning William + up to 3 different enemies. There are ways to expand this system and allow for more shadows, but 4 was actually ideal for what we needed to do in Bladeslinger. Once we have chosen and rendered our characters to this shadow texture in a pre-render pass, this shadow texture and 4 matrices required to project shadow map coordinates for each individual channel are set in global shader values. While rendering the world, certain materials in the scene (generally ground meshes, but sometimes other ones too) are set to use special versions of their shaders which can sample projected shadows.

卢克:渲染投影阴影的方法有很多,但是我们相信最终得到的结果在效率和质量上是非常独特的,尽管它并非没有自己的局限性。 我们从为每个具有自定义着色器的角色的优化网格开始。 Shader将该网格渲染到高分辨率阴影纹理的单个通道(R,G,B或A)。 如您所见,这将我们限制为一次只能投影4个阴影,这意味着William +最多3个不同的敌人。 有多种方法可以扩展此系统并允许更多阴影,但实际上4种方法对于我们在Bladeslinger中需要执行的操作非常理想。 一旦我们在预渲染过程中选择了角色并将其渲染到该阴影纹理上,就可以在全局着色器值中设置此阴影纹理和投影每个单独通道的阴影贴图坐标所需的4个矩阵。 在渲染世界时,场景中的某些材质(通常是地面网格,有时也包括其他网格)设置为使用其着色器的特殊版本,可以对投影的阴影进行采样。

Me: How large was your shadow texture?

我:您的阴影纹理多大?

Luke: Usually 512×512, but can vary per scene.

卢克(Luke):通常为512×512,但会因场景而异。

Me: Since all 4 channels where used independently – effectively it is 4 shadow textures each 512×512 resolution.

我:因为所有4个通道都是独立使用的-实际上,它是4个阴影纹理,每个512×512分辨率。

Luke: Yes.

卢克:是的。

Me: What was the main benefit of storing shadows in a separate channels instead of in separate textures? Did it help to save memory or to reduce cost of render-target switches or maybe something else?

我:将阴影存储在单独的通道而不是单独的纹理中的主要好处是什么? 它是否有助于节省内存或降低渲染目标切换的成本,或者可能还有其他帮助?

Luke: The main reason for the single texture with using 4 channels approach was to save render-target switches and to keep the same resolution of our shadows with 1/4 the memory used. It was also a great way of doing a blur to “soften” the shadow edges in a single pass as opposed to having to do 4 blurs – a separate blur for every one of those separate shadow textures.

卢克(Luke):使用4通道方法制作单一纹理的主要原因是为了保存渲染目标开关,并使用1/4的内存来保持阴影的相同分辨率。 这也是进行模糊处理以一次“柔化”阴影边缘的一种好方法,而不是必须进行4次模糊处理–对那些单独的阴影纹理中的每一个都进行单独的模糊处理。

Me: How do you manage what geometry gets projected shadows and how many of them?

我:您如何管理哪些几何体获得投影阴影以及其中多少阴影?

Luke: We make use of Unity’s Shader Keywords to define multiple permutations of these “character shadow shaders” that are toggled on the fly. This way, if we only need to render William’s shadow, shaders are set that only sample that 1 channel, instead of always sampling from all 4 channels. In the end, this technique allows us to have very high resolution character shadows that are projected and blended together seamlessly on any arbitrary geometry that we choose. It gives us the ability to be optimal and choose which surfaces receive shadows based on the light source in a scene, but only setting certain geometry to have the complex shaders necessary to sample and render the shadows.

卢克:我们利用Unity的“ 着色器关键字”来定义这些“字符阴影着色器”的多个排列,这些排列可以即时切换。 这样,如果我们只需要渲染William的阴影,则将着色器设置为仅对该1个通道采样,而不是始终从所有4个通道采样。 最后,该技术使我们能够拥有非常高分辨率的字符阴影,这些阴影可以在我们选择的任意几何图形上无缝投影并融合在一起。 它使我们能够进行优化,并根据场景中的光源选择要接收哪些表面的阴影,但是仅将某些几何形状设置为具有采样和渲染阴影所需的复杂着色器。

That’s it for 1st part of this blog. In next part we will talk with Luke about techniques used to make the town of Hammer’s Peak one of the most visually stunning worlds created for a mobile device.

这是本博客的第一部分。 在下一部分中,我们将与Luke讨论用于使Hammer's Peak镇成为为移动设备创建的视觉上最令人惊叹的世界之一的技术。

Stay tuned for:

请继续关注:

    翻译自: https://blogs.unity3d.com/2013/01/15/bladeslinger-pushing-the-boundaries-part-i/

    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值