角色优化建模

Modeling Optimized Characters

角色优化建模


Use one Skinned Mesh Renderer
一个角色仅使用一个SkinedMeshRenderer(后简称 SMR)

Your character should use only a single skinned mesh renderer. There is usually no reason to use multiple meshes for a character. Unity also has optimizations related to visibility culling and bounding volume updating which only kick in if you use one animation component and one skinned mesh renderer in conjunction. If you care about performance, multiple skinned meshes per character is not an option. If you use two skinned mesh renderers for one character instead of one, the time spent on rendering the character will most likely double!
 
在Unity中您应该每个角色仅使用一个SkinedMeshRenderer来绘制。一般来说单个角色没必要用到两个或更多的网格(译者:此网格应理解为Unity中Render组件所使用的Mesh,该Mesh可以包含多个sub mesh,各sub mesh有自己的材质,但都用一个Render绘制)。而且,Unity在优化视景裁剪和更新角色包围体时,是基于仅有一个动画组件和一个SMR的假设的。所以,如果你最求性能,就不应该为一个角色使用多个SMR。如果你用了两个SMR,则时间消耗可能是用一个SMR的两倍!
Don't Use Many Materials
不要使用过多的材质
You also want to keep the number of materials on that mesh as low as possible. There is only one reason why you might want to have more than one material on the character: when you need to use a different shader (e.g. if you want to use a special shader for the eyes). However, 2-3 materials per character should be sufficient in almost all cases. If your character is carrying a gun, it might be useful to have the gun a separate object, simply because it might get detached.
 
你还应该尽可能地减少角色所用材质的数量。你应该只有一个理由使用多个材质:那就是你想使用多个着色器(例如,你想为角色眼睛使用另外一个着色器)。但是,大多数情况下,每个角色2-3个材质就够了。如果你的角色还有一把枪,那你应该考虑把枪作为另外一个物体(而不是角色的一部分),因为它可以从角色身上拿走。(译者:我认为装备和武器网格点如果要求受到多个角色骨骼的控制,而不是单纯作为刚体随骨骼运动,则最好还是作为角色的一部分建模,然后用脚本动态组合实现换装,参见3D游戏引擎——Unity中网格合并示例研究)
Reduce Amount of Bones
减少骨骼数量
Medium Desktop games use bone hierarchies with 15-60 bones. The fewer bones you use the faster; with 30 bones you can achieve very good quality on Desktop platforms and fairly good quality on Mobile Platforms. Unless you really have to, we strongly recommend you use fewer than 30 bones if you are developing for Mobile Platforms and around 30 bones per character on Desktop platforms.
中型的PC游戏每个角色一般使用15-60个骨骼。骨骼越少,计算执行速度越快。一般用30个骨骼就可以在PC游戏中获得很好的表现效果,同时在手机平台上也如此。我们建议如果不是特别有需要的话,在手机平台上单角色的骨骼不要超过30个,在PC平台上也尽量只用30个左右的骨骼。
Polygon Count
三角片数量
How many polygons you should use depends on the quality you require and the platform you are targeting. Anything between 300-1500 triangles on Mobile Platforms and 500-6000 triangles on Desktop Platforms is reasonable. If you want lots of characters on screen or want the game to run on old machines, you will have to reduce the polygon count for each character. As an example: Half Life 2 characters used 2500-5000 triangles per character. Next-gen AAA games running on PS3 or Xbox 360 usually have characters with 5000-7000 triangles.
究竟用多少三角片取决于你所要求的细致程度和游戏运行的目标平台。一般手机上单角色200-1500,PC上500-6000个三角片都是合适的。如果你想同时显示很多个角色,或者想在较早的硬件平台上流畅运行,那么就需要再削减三角片数量。举个例子:半条命2 每个角色用2500-5000个三角片,在PS3或者Xbox360上运行的下一代的AAA(译者:这是啥。。。)游戏一般每个角色5000-7000三角片。
Separate Out IK and FK
将IK和FK分开
Separate out inverse kinematics (IK) and forward kinematics (FK). When animations are imported, the IK nodes are baked into FK, thus Unity doesn't need the IK nodes at all. You can either kill the GameObjects in Unity or the nodes in the modelling tool. By removing them, the IK nodes don't need to be animated every frame anymore. For this reason it is a very bad idea to intermix IK and FK hierarchies. Instead, you should create two hierarchies: one strictly for IK and one for FK. This way you can very easily select the whole IK hierarchy and delete it.
将IK和FK分开。当Unity导入模型动作时,IK节点会被烘焙成FK,因为Unity根本不需要IK节点。你可以在Uniy中将IK节点对应生成的GameObject删除,或者直接在建模工具(如maya、MAX等)中将IK节点删除后再导入。这样,Unity在绘制每帧时就不需要再考虑IK节点的动作了,由此提高了性能。所以,建模时将IK和FK混在一起可不是什么好主意。正确的做法是:你应该将IK和FK分成两组。这样删除的时候就非常方便。(译者:本人对Max等建模工具完全不懂,不妥之处请多指教)
Use Reusable Rigs
创建可重用的Rig
Create a rig which you can reuse. This allows you to share animations between different characters.
创建并使用可重用的rig。这样,你就可以将一套动作应用到不同的角色。(译者:基于骨骼设计动作,然后在骨骼上设计多套Mesh,就可以实现不同外貌的角色具有相同的动作。这个在游戏中提供用户自定义角色外貌时很有用。)
Name Bones Correctly
为骨骼取直观易懂的名字
Name the bones correctly (left hip, left ankle, left foot etc.). Especially with characters, naming your bones correctly is very important. For example if you want to turn a character into a Ragdoll you will have to find the right bones for each body part. If they are not named correctly, finding all the body parts will take much longer.
为骨骼取上直观易懂的名字(例如左臀、左踝、右腿等等)。对于人物角色,为骨骼取个正确的名字尤其重要。举个例子:如果你要让一个角色进入纸娃娃(译者:一种靠物理引擎驱动的动作模型,常用于模拟人体与真实环境相互作用下的动作)状态,你就需要正确定位角色的各段骨骼。如果名字取得不好(例如 1、2、3之类的),程序的兄弟写起脚本来就很费劲。
在使用Python来安装geopandas包时,由于geopandas依赖于几个其他的Python库(如GDAL, Fiona, Pyproj, Shapely等),因此安装过程可能需要一些额外的步骤。以下是一个基本的安装指南,适用于大多数用户: 使用pip安装 确保Python和pip已安装: 首先,确保你的计算机上已安装了Python和pip。pip是Python的包管理工具,用于安装和管理Python包。 安装依赖库: 由于geopandas依赖于GDAL, Fiona, Pyproj, Shapely等库,你可能需要先安装这些库。通常,你可以通过pip直接安装这些库,但有时候可能需要从其他源下载预编译的二进制包(wheel文件),特别是GDAL和Fiona,因为它们可能包含一些系统级的依赖。 bash pip install GDAL Fiona Pyproj Shapely 注意:在某些系统上,直接使用pip安装GDAL和Fiona可能会遇到问题,因为它们需要编译一些C/C++代码。如果遇到问题,你可以考虑使用conda(一个Python包、依赖和环境管理器)来安装这些库,或者从Unofficial Windows Binaries for Python Extension Packages这样的网站下载预编译的wheel文件。 安装geopandas: 在安装了所有依赖库之后,你可以使用pip来安装geopandas。 bash pip install geopandas 使用conda安装 如果你正在使用conda作为你的Python包管理器,那么安装geopandas和它的依赖可能会更简单一些。 创建一个新的conda环境(可选,但推荐): bash conda create -n geoenv python=3.x anaconda conda activate geoenv 其中3.x是你希望使用的Python版本。 安装geopandas: 使用conda-forge频道来安装geopandas,因为它提供了许多地理空间相关的包。 bash conda install -c conda-forge geopandas 这条命令会自动安装geopandas及其所有依赖。 注意事项 如果你在安装过程中遇到任何问题,比如编译错误或依赖问题,请检查你的Python版本和pip/conda的版本是否是最新的,或者尝试在不同的环境中安装。 某些库(如GDAL)可能需要额外的系统级依赖,如地理空间库(如PROJ和GEOS)。这些依赖可能需要单独安装,具体取决于你的操作系统。 如果你在Windows上遇到问题,并且pip安装失败,尝试从Unofficial Windows Binaries for Python Extension Packages网站下载相应的wheel文件,并使用pip进行安装。 脚本示例 虽然你的问题主要是关于如何安装geopandas,但如果你想要一个Python脚本来重命名文件夹下的文件,在原始名字前面加上字符串"geopandas",以下是一个简单的示例: python import os # 指定文件夹路径 folder_path = 'path/to/your/folder' # 遍历文件夹中的文件 for filename in os.listdir(folder_path): # 构造原始文件路径 old_file_path = os.path.join(folder_path, filename) # 构造新文件名 new_filename = 'geopandas_' + filename # 构造新文件路径 new_file_path = os.path.join(folder_path, new_filename) # 重命名文件 os.rename(old_file_path, new_file_path) print(f'Renamed "{filename}" to "{new_filename}"') 请确保将'path/to/your/folder'替换为你想要重命名文件的实际文件夹路径。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值