博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在Unity中高效工作(下)
阅读量:6365 次
发布时间:2019-06-23

本文共 4440 字,大约阅读时间需要 14 分钟。

原地址:http://www.unity蛮牛.com/thread-20005-1-1.html

Tips for Creating Better Games and Working More Efficiently in unity
在unity中高效工作以及开发更卓越的游戏的几点建议(下)
小编的话:(上)篇的链接是 http://www.unity蛮牛.com/thread-19974-1-1.html
福利又来了!大家马上看看(下)篇吧。这是蛮牛译馆中的热心译友Dusthand翻译的文章。
他非常卖力,翻译得很好。小蛮牛们一定要好好支持下他的杰作,多给点儿评论&回复吧
我挑出的关键词有(方便大家阅读):多细节层次、LOD、烘焙光照贴图、灯光探测器、灯光效果。

Use Level of Detail
多细节层次
 
    The level of detail feature inside of Unity is a great tool to use to that allows you take a very detailed asset and switch it out for a lower resolution mesh depending on how close the camera is. As the camera moves further away, it’s going to switch out the mesh with the lower resolution version. This is a great optimization technique to use that can save a lot of processing time, because it only renders out the detail when it’s actually necessary.
       Unity的多细节层次是一个很好的工具,它允许你使用多层次的细节,并根据相机的远近程度切换到较低分辨率的级别。这是一个非常重要的优化技术,它仅仅在必要时,将细节进行渲染,因而可以节省大量的时间开销。
        There’s no reason to display a high resolution of detail if the player isn’t close enough to actually tell the difference. Of course, this will mean you’ll need to model several versions of the same asset at different detail levels. You also need to keep in mind that this is a Unity Pro only feature. So if you’re using the free version, it won’t be available to you.
        当玩家离物体较远,而不足以分辨出差别时,我们完全没有必要呈现出较高的分辨率。当然,这意味着你需要为同一份资源在细节层次上准备多个版本。【注意:LOD是专业版的功能,如果你使用的是免费版,就不用想了。】

<ignore_js_op>

Bake Lightmaps
烘焙光照贴图
        As you start working with large levels requiring many different lights to create the look and feel you want, it can really start bogging down your game and have an impact on the framerate.
当你建造大型的场景,并且需要使用各种类型的灯光,用来营造理想的效果时,你会发现自己的游戏运行很慢,帧数也急剧下降。
        To prevent your lights from impacting your game, you should be creating lightmaps. They allow you to bake all the lighting in your level directly to the actual textures. All of the lighting information stays there, but you don’t need the lights anymore. You can also add things like ambient occlusion to a lightmap to enhance the realism, but keep in mind this will increase the bake time.
为了避免光照效果影响你的游戏性能,你应该创建光照贴图。你可以将你场景中所有的灯光都烘焙到实际的纹理上。所有的照明信息都会留在上面,然后你就可以去掉这些灯光了。你还可以将环境光散射也烘焙进去,从而增加真实感,但要注意,这会增加烘焙时间。
        Lightmaps may not be great for everything. Let’s say you want to give the player the ability to shoot out a light. This wouldn’t be achievable with a lightmap. So find places where you can implement lightmaps without hurting the gameplay.
        光照贴图并不是万能的。例如,你想让玩家可以发射出一束光,光照贴图是无法办到的。你所要做的是,找到可以用光照贴图实现,又不会影响游戏性的场合。
Use Light Probes
使用灯光探测器
        Anytime you create lightmaps for the lighting in your game, you’ll see it’ll look great for all the static objects in the level, but it doesn’t work for any type of dynamic asset in your game. This could be the character, enemies or anything moving. Dynamic objects will not be affected by the lightmaps. So while your level is nice and bright, the character will stay dark.
        当你为游戏创建光照贴图时,你会发现它在静态的物体上效果还不错,但它不适用于任何类型的动态物体,例如角色、敌人以及所有会移动的物体。光照贴图无法作用于动态物体,所以你会发现即使你的场景看上去十分的明亮,但是角色却是黑色的。

<ignore_js_op>

        Lightmapping can’t be calculated for moving objects in real time, but it’s possible to get a similar effect that you would get with dynamic lights by using light probes. By placing light probes in your level, it’ll sample all of the lighting at each probe point. The lighting can then be interpolated between the samples taken from the nearest point. This can be done in real time so it simulates the lighting that would occur in the scene if there were actual dynamic lights set up and not lightmaps.
        光照贴图无法为移动中的物体进行实时计算,但是通过为动态光源使用灯光探测器,还是可以达到非常接近的效果。通过在场景中布置灯光探测器,可以为每个探测点的光照进行采样。然后任一点的光照就可以通过附近的点进行插值来得到。所以,在场景中没有光照贴图而存在动态光源的地方,就可以通过插值实时地模拟出光照。
         When placing your light probes, you want to do it in areas with a high contrast in light. You’ll also want to put a probe between two bright areas, so you’ll get realistic results as your character moves through the level.
         在放置灯光探测器时,你可以把它放置在和光亮有较大对比的一个区域内。同样可以考虑,把灯光探测器放置在两个明亮区域之间,这样当人物在场景中移动时,会产生明显的效果。

<ignore_js_op>

         Next time you fire up Unity to work on your game project, find places where you can incorporate these tips to speed up your workflow and even cut back on processing time.
         下一次,当你用Unity开发你的游戏项目时,好好回顾下我讲授的几点建议,这样能够加快你的工作和增强游戏性能。

原文:http://blog.digitaltutors.com/ti ... ficiently-in-unity/
译文:蛮牛译馆 - Dusthand & OVATION
转载注明出处!!!
 
        我是游戏蛮牛的蛮牛译馆(一个专门翻译国外资料的组织)的一员,我会陆续整理,翻译国外相关的新闻资讯与技术文章,以及各种视频等内容。我们也欢迎热爱游戏翻译的好友加群,一起体验翻译并分享乐趣,QQ群号:52677537。关于此篇文章翻译有错误的地方,欢迎大家指正。
你可能感兴趣的文章
javascript类型系统——包装对象
查看>>
Android4.4中不能发送SD卡就绪广播
查看>>
解决:sudo: 无法解析主机:dinphy-500-310cn: 连接超时
查看>>
Asp.Net多线程用法1
查看>>
exFAT是支持Mac和Win的
查看>>
(转)postman中 form-data、x-www-form-urlencoded、raw、binary的区别
查看>>
js Date操作
查看>>
判断用户密码是否在警告期内(学习练习)
查看>>
sp_executesql的执行计划会被重用(转载)
查看>>
禅道项目管理软件插件开发
查看>>
Linux系统各发行版镜像下载
查看>>
JS获取键盘按下的键值event.keyCode,event.charCode,event.which的兼容性
查看>>
查看ORACLE 数据库及表信息
查看>>
腾讯、百度、阿里面试经验—(1) 腾讯面经
查看>>
Codeforces Round #374 (Div. 2) D. Maxim and Array 贪心
查看>>
HTML DOM 教程Part1
查看>>
GBDT的基本原理
查看>>
MySQL修改root密码的多种方法(转)
查看>>
MongoDB 基础命令——数据库表的增删改查——遍历操作表中的记录
查看>>
.NET Core 跨平台发布(dotnet publish)
查看>>