Mesh Combine Studio 2 Documentation
1.Requirements(需求)
- Support >Unity 5.1, Unity 2017.x, Unity 2018.x and Unity 2019.x.
- 支持unity 5.1 2017.x 2018.x 2019.x 以上版本
- Supports all platforms (PC, Mac, Linux, Android, IOS, WebGL, etc).
- 支持全平臺(PC, Mac, Linux, Android, IOS, WebGL, 等等)
- Can be used on the in Editor and/or Runtime.
- 能夠在編輯模式和運行模式下使用
2.Demos(Demo)
Here is a demo build of an example Scene from a popular modular Asset called?Dungeon Architect. MCS boosts performance about?2170%!?(from 37 to 805 fps) on my Nvidia 980TI compared to Unity’s batching:
這里是一個發布后的Demo案例場景來自于一個比較常見的資源叫做Dungeon Architect.MCS可以提高性能達到2170%(從37幀提高到805幀)在我的電腦上基于Nvidia 980TI顯卡,相對于Unity的批處理,下面是Demo地址
MCS Dungeon Architect demo
Another demo with MCS used in?Modular City Allay Pack:
另外一個Demo使用MCS在Modular City Allay Pack:中
MCS Modular City Allay pack demo
3.How does it work?它是如何工作的?
?
?
Simply drag and drop the MeshCombineStudio prefab into your Scene. You can use multiple MCS prefabs for different settings in the same Scene.?if you use MCS in runtime, make sure you disable Unity’s static batching or disable ‘batching static’ on the MCS to combine GameObjects.?Otherwise Unity static batching will combine the meshes instead and MCS won’t work.
簡單的拖動MeshCombineStudio預設物到你的場景中。你能夠使用多個MCS預設物做不同的設置在同一個場景中。如果你在運行的時候使用MCS,確保你已經關閉了Unity自身的靜態批處理或者MCS組件上的靜態批處理(batching static)選項。否則,Unity靜態批處理將改為合并網格,而MCS將不起作用。
MCS is completely automated like Unity’s static batching and you don’t need to do tedious manual combining. MCS works with a clever octree cell based combining technique which is optimal for culling, z-sorting and LOD switching. What is unique about MCS is that it support LOD meshes and that MCS is able to remove geometry that is never visible for the camera. E.g. triangles that are under a terrain/mesh, and/or backface triangles on background terrain or on a sideway scroller or top down game. LODs are combined per cell and switching is done per cell. This gives even more performance and as a bonus gives less LOD popping artifact.
MCS完全自動化,就像Unity的靜態批處理一樣,您無需進行繁瑣的手動合并。 MCS與基于巧妙的八叉樹單元的結合技術一起工作,該技術最適合于剔除,z排序和LOD切換。 MCS的獨特之處在于它支持LOD網格,并且MCS能夠刪除相機無法看到的幾何圖形。例如。地形/網格下的三角形和/或背景地形上或側面滾動條或自上而下游戲中的背面三角形。 LOD按每個單元組合,并且按每個單元進行切換。這樣可以提供更高的性能,而額外的好處是可以減少LOD彈出失真。
The MCS script Inspector is divided into seven parts: Unity’s settings, Search Options, Output Settings, Job Settings, Runtime, Execute Buttons and Stats.
?
MCS腳本檢查器分為七個部分:Unity的設置,搜索選項,輸出設置,作業設置,運行時,執行按鈕和統計信息。
3.1.Unity's Settings
?
These are Unity settings from Unity Menu (Player and Quality Settings) to quickly access them.
這些是Unity菜單中的Unity設置(玩家設置和質量設置),可以快速訪問它們。
Static Batching(靜態批處理)
Enable/Disable Unity’s static batching (same setting as in Player Settings). More info on Unity’s batching can be found in the Unity Manual?here.
啟用/禁用Unity的靜態批處理(與“玩家設置”中的設置相同)。可在此處的Unity手冊中找到有關Unity批處理的更多信息。
Dynamic Batching(動態批處理)
Enable/Disable Unity’s dynamic batching (same setting as in Player Settings).
啟用/禁用Unity的動態批處理(與“玩家設置”中的設置相同)。
V Sync Count(垂直同步計數)
Enable/Disable Unity’s V Sync Count settings (same settings as in Quality Settings). Disable V Sync to measure true fps gain, otherwise Unity will cap to 60 fps.
啟用/禁用Unity的垂直同步計數設置(與“質量設置”中的設置相同)。禁用垂直同步以測量真實的fps增益,否則Unity將限制為60 fps。
?
3.2.Search Options(查找選項)
?
?
With the search options you can filter which GameObjects with meshes MCS will combine.
使用搜索選項,您可以過濾將合并MCS的帶有網格的GameObjects。
Parent(父級)
The GameObject parent in which the meshes in the children will be included and combined.
GameObject父級將包含并合并子級中的網格。
Object Center(物體中心點)
What position should be used to determine in which cell the mesh will be placed, the center of the mesh bounds in world space or the transform pivot.
應該使用哪個位置來確定將網格放置在哪個單元中,網格邊界在世界空間中的中心或變換樞軸。
Draw Gizmos(繪制指南)
Draws the combine cells in the Scene window after objects are found for combining when clicking the ‘Search’ button.
單擊“搜索”按鈕后找到要合并的對象后,在“場景”窗口中繪制合并單元格。
Draw Mesh Bounds(繪制網格邊界)
Draws the mesh bounds in the Scene window in world space.
在世界空間的“場景”窗口中繪制網格邊界。
Only Active(僅活動)
Only combine active GameObjects.
僅合并活動的GameObject
Only Static(只有靜態)
Only combine GameObjects that are marked as ‘Static’.
僅合并標記為“靜態”的GameObject
Use Search Box(使用搜索框)
Only combine meshes that are within the bounds of the search box.
僅合并在搜索框范圍內的網格
Search Box Pivot/Size(搜索框樞軸/大小 )
The pivot position and the size of the search box.
樞軸位置和搜索框的大小。
Search box square(搜索框正方形)
The first filter option is the search box, only GameObjects within this box will be combined. In the next update an automatic bound detection will be added, so it wouldn’t be necessary to use the search box.
第一個過濾器選項是搜索框,僅此框中的GameObjects會被組合。在下一個更新中,將添加自動邊界檢測,因此無需使用搜索框
Use Max Bounds Factor(使用最大邊界因子)
Only include meshes which bounds are not bigger than x times the cell size. This option limits that too big objects are included which would make cell bounds too big for optimal culling.
僅包括邊界不大于像元大小x的網格。此選項限制了包含太大的對象,這會使單元邊界太大而無法實現最佳剔除
User Vertex Input Limit(用戶頂點輸入限制)
Only combine meshes that don’t exceed this vertex limit. MCS works best on small and medium meshes. Combining takes more memory than without, so having a good balance with only combining the necessary smaller meshes is important.?I recommend to use a vertex input limit?of around 5000.?Unity’s static batching doesn’t have such filter option and it would all need to be selected manually to save memory, which can be tedious.
僅合并不超過此頂點限制的網格。 MCS在中小型網格上效果最佳。合并要比沒有合并花費更多的內存,因此僅合并必要的較小網格,取得良好的平衡非常重要。我建議使用大約5000個頂點輸入限制。Unity的靜態批處理沒有此類過濾器選項,因此需要手動選擇所有這些選項以節省內存,這可能很繁瑣。
Use Vertex Input Limit LOD(使用頂點輸入限制LOD)
Only combines meshes that have this vertex limit for all LODS, so if LOD0 has a higher vertex count than the limit the entire object won’t be included for combining. For LODs the limit can be higher somewhere between 10.000 – 15.000.
僅合并所有LODS具有此頂點限制的網格,因此,如果LOD0的頂點數大于限制,則將不包括整個對象進行合并。對于LOD,該限制可能更高,介于10.000-15.000之間。
Use LayerMask(使用層遮罩)
Only combine GameObjects which Layer is in this LayerMask.
只合并選定的層的物體
Use Tag(標簽使用)
Only combine GameObjects with this selected Tag.
只合并帶有指定標簽的物體
Use Components Filter(通過組件過濾器)
Only combine GameObjects with a certain component. And: Only include GameObjects that have all components.\nOr: Include GameObjects that have one of the components.
僅將GameObjects與某個組件結合在一起。并且:僅包括具有所有組件的游戲對象。\ n或:包括具有其中一種組件的游戲對象。
Use Name Contains(通過名字合并)
Only combine GameObjects with a certain name (similar to windows explorer file search). E.g. can use Rocks*Green and will include all GameObjects that contain the word ‘Rocks’ and ‘Green’.
僅將具有特定名稱的GameObject組合在一起(類似于Windows資源管理器文件搜索)。例如。可以使用Rocks * Green,并將包含所有包含“ Rocks”和“ Green”一詞的GameObject。
3.3.Output Settings(輸出設置)
?
?
Use Cells(使用單元格)
Combine cell based, only disable cells for combining parts for dynamic objects.
基于合并單元格,僅禁用用于合并動態對象零件的單元格
Cell Size(單元格大小)
The size of the cells in which meshes will be combined into one mesh.
基于當前選擇將單元格內的物體合并到一個網格里面
Cell Offset(單元格偏離)
Offset position of the cells.
中心點的位置偏移
Remove Tris Below Surface(移除表面下方的三角面)
Remove triangles that are below any surface (terrain and/or meshes). This works collider based. This also removes vertices/normals/tangents/uvs, etc to save memory.刪除任何曲面(地形和/或網格)下方的三角形。這基于碰撞器。這也將刪除頂點/法線/切線/ uvs等以節省內存。
Surface Layer Mask(表面層遮罩)
The layers on which the surface colliders are.
表面碰撞器所在的層
Raycast Height(射線高度)
This needs to be at least the maximum height of your surface. This is the height where the rays are cast from.
這必須至少是您表面的最大高度。這是投射光線的高度
Remove Backface Tris(移除背部三角面)
Removes triangles that will never be visible for the camera from with a certain box volume. E.g. if you have an inner area where the player cannot go beyond and outside of this area you placed objects (even big mountain meshes) you can remove the back part of those meshes as the player will never see them. This can also work for a top down game or side scroller game where the player is never able to see a certain angle. This also removes vertices/normals/tangents/uvs, etc to save memory.
從特定的盒子體積中刪除相機永遠看不見的三角形。例如。如果您有一個內部區域,玩家無法超出該區域,則在該區域之外放置了對象(甚至是大的山狀網格),您可以刪除這些網格的后部,因為玩家將永遠看不到它們。這也可以用于自上而下的游戲或側面滾動游戲,在這種情況下玩家永遠無法看到某個角度。這也將刪除頂點/法線/切線/ uvs等以節省內存。
Backface Mode(背部模式)
Box based: Case where Camera stays within the box volume.
Direction based: Case where Camera is orthogonal and doesn’t rotate.
基于包裝盒:相機停留在包裝盒內的情況。
基于方向:相機正交且不旋轉的情況
Center/Size 中心點和尺寸
The center and size of the box volume.
盒子體積的中心和大小
Two Sided Shadows(雙面陰影)
When using shadows this probably needs to be enabled to keep correct shadows, otherwise they will be cut-out because the backface triangles of the meshes are missing.
當使用陰影時,可能需要啟用它以保持正確的陰影,否則由于缺少網格物體的背面三角形,將其切除。
Add Mesh Colliders(添加網格碰撞器)
Adds mesh colliders to the combined Meshes. Only use this options if you don’t have any colliders on the original GameObjects. It’s much faster to use primitive colliders on the original GameObjects. Can be a mix of primitive and mesh colliders, MCS will keep the original colliders and any other components working.
將網格碰撞器添加到組合的網格中。僅當原始GameObjects上沒有任何碰撞器時,才使用此選項。在原始GameObjects上使用原始碰撞器要快得多。可以混合使用原始碰撞器和網格碰撞器,MCS將保持原始碰撞器和任何其他組件的正常運行
Make Meshes Unreadable(使網格不可讀)
Removes the copy of the mesh arrays from CPU memory, which saves CPU memory. Only disable this option if you need to read from the meshes.
從CPU內存中刪除網格陣列的副本,從而節省了CPU內存。僅在需要從網格讀取時才禁用此選項
Use Vertex Output Limit(使用節點輸出限制)
Limit the maximum vertices for combined meshes. This can be disabled.
限制最大的合并網格節點,這個選項可以被關閉
Copy Baked Lighting(復制烘焙燈光)
The Lighting of the original meshes will be copied to the combined meshes. Copy baked lighting can result in more combined meshes (more draw calls than with rebaking) as the source objects need to have the same lightmap index. The advantage is that the Scene file size doesn’t increase when used with ‘Combine In Runtime’.
原始網格物體的光照將被復制到組合的網格物體。由于源對象需要具有相同的光照貼圖索引,因此復制烘焙的光照可以導致更多的組合網格(與重新烘焙相比,繪制調用更多)。好處是與“在運行時合并”一起使用時,場景文件的大小不會增加
Rebake Lighting(重新烘焙燈光)
Rebake the lighting on the combines meshes.重新烘焙燈光在合并網格后
Scale in Lightmap(縮放烘焙貼圖)
The scale of the combined meshes in the Lightmap, default value is 1 and a smaller value will create Lightmaps with less file size.
光照貼圖中組合網格的比例,默認值為1,較小的值將創建文件尺寸較小的光照貼圖
Output Layer(輸出層)
The combined GameObjects will be on this layer.
合并后的物體將會在這個層上
3.4.Job Settings(作業設定)
?
?
These are the settings for the multi-threaded (optional) combine job manager. There’s one global job manager that handles all combine jobs, and there can be many MeshCombineStudio prefabs which all send the jobs to the job manager. The job manager is designed to have as low memory and garbage allocation as possible. Each mesh type is only cached once and new combined mesh arrays are reused with pooling. I made a special plugin to have mesh array assigning alloc free by re-using the arrays pool.
這些是多線程(可選)組合作業管理器的設置。有一個全球性的職位經理負責處理所有合并職位,并且可以有很多MeshCombineStudio預制件將職位發送給管理器。作業管理器被設計為具有盡可能低的內存和垃圾分配。每種網格類型僅被緩存一次,新的組合網格陣列可通過池重新使用。我做了一個特殊的插件,通過重用數組池使網格數組免費分配alloc
Combine Job Mode(合并作業模式)
Combine At Once: Use this options if you quickly want to combine all meshes where FPS doesn’t matter. E.g. Just after loading a level.
Combine Per Frame: Choose the amount of meshes that will be combined per frame to keep FPS up. This can be used for any runtime editing like players creating levels, etc. A runtime API is still in the making for this and will be released soon.
一次合并:如果您想快速合并FPS無關緊要的所有網格,請使用此選項。例如。剛加載一個關卡之后。
每幀合并:選擇每幀合并以保持FPS增長的網格數量。可以將其用于任何運行時編輯,例如玩家創建關卡等。運行時API仍在開發中,將很快發布
Use Multi Threading(使用多線程)
The combine part itself can be done on multiple threads. This can speed up the combining linearly with the amount of cores/threads available.
合并部分本身可以在多個線程上完成。這樣可以加快可用內核/線程數量的線性組合速度
Use Main Thread(使用主線程)
This option can be disabled when using multi threading. This will keep fps higher on the main thread. Still the assigning of the meshes can only be done on the main thread, since it needs to use the Unity API, which doesn’t allow any multi-threading. But the more compute intense combining itself can be done on the other threads.
使用多線程時可以禁用此選項。這將使主線程上的fps更高。網格的分配仍然只能在主線程上進行,因為它需要使用Unity API,該API不允許任何多線程。但是,更復雜的計算本身可以在其他線程上完成
Show Stats(狀態顯式)
Show the stats of the Job Manager. Amount of meshes cached, amount of pending jobs, etc.
顯示作業管理器的統計信息。緩存的網格數量,掛起的作業數量等。
3.5.Runtime(運行時)
?
Combine in Runtime(運行時合并)
Combine meshes that meet the Search Option conditions in runtime.在運行時組合滿足“搜索選項”條件的網格。
Combine on Start(開始是合并)
Combine meshes automatically on Start or call the CombineAll() method yourself from another script.
在開始時自動合并網格,或者從另一個腳本中自己調用CombineAll()方法。
Original Mesh Renderers(原始網格渲染器)
What needs to be done with the original MeshRenders? (Disable or Delete).
原始的MeshRenders需要做什么? (禁用或刪除)。
Original LODGroups(原始LOD組)
What needs to be done with the orginal LOD Groups? (Disable or Delete).
原始的LOD組需要做什么? (禁用或刪除)
Use Combine swap key(使用組合交換密鑰)
Switch between MCS and original GameObjects to see the performance difference.
在MCS和原始GameObjects之間切換以查看性能差異
3.6.Execute Buttons(執行按鈕)
?
?
Search(搜索)
Search and report the found GameObjects (based on Search Conditions) for combing.搜索并報告找到的GameObject(基于搜索條件)以進行梳理
Combine(合并)
Combine the found GameObjects into new combined meshes, the new GameObjects will be spawned as children of the MeshCombineStudio GameObject.
將找到的GameObjects組合成新的組合網格,新的GameObject將作為MeshCombineStudio GameObject的子代產生
Select Original(選擇原始)
Multi select all the original GameObjects that were found with the ‘Search’ button. This can be useful to change a setting on e.g. the Mesh Renderer component.
多重選擇通過“搜索”按鈕找到的所有原始GameObject。這對于更改例如網格渲染器組件
Select Combined(選擇合并)
Multi select the combined GameObjects that are created after combining. This can be useful to change a setting on e.g. the Mesh Renderer component.
多選擇組合后創建的組合GameObject。這對于更改例如網格渲染器組件
Disable/Enable Original Renderers and LodGroups(關閉或者開啟原始渲染或者LOD組)
Switches between rendering the original and combined Mesh Renderers.
在渲染原始網格渲染器和組合網格渲染器之間切換
Save Combined(保存合并)
Saves the combined meshes to a folder in the project so they can be used as prefabs.
將組合的網格保存到項目中的文件夾中,以便將它們用作預制件
Delete Combined(刪除合并體)
Deletes the combined GameObjects, use this to reset to the original state. MCS will automatically re-enable the Mesh Renderers and LODGroups on the original meshes.
刪除組合的GameObject,使用它重置為原始狀態。 MCS將自動在原始網格上重新啟用網格渲染器和LODGroup
總結
以上是生活随笔為你收集整理的Mesh Combine Studio 2 Documentation的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: css 实现三维立体旋转效果
- 下一篇: uniapp 获取网络状态_uni-ap