Unity3D LOD Group


今天下了一個4.0破解版,然后看到一個Demo Level of Detail    就研究了一下  以前用的是Unity3.5 free版本,沒有這個功能,真實淚奔。。。。。。。

 

As your scenes get larger, performance becomes a bigger consideration. One of the ways to manage this is to have meshes with different levels of detail depending on how far the camera is from the object. This is called Level of Detail (abbreviated asLOD)

由於場景變大,就要更加考慮性能的問題。有一種管理方法,取決於攝像機離對象的遠近,網格有不同的細節級別,這就是所謂的細節級別( Level of Detail)(LOD的縮寫)

Here's one of the ways to set up an object with different LODs.

下面是建立具有不同LODs對象的方法。

  1. Create an empty Game Object in the scene
    在場景創建一個空的游戲物體。
  2. Create 2 versions of the mesh, a high-res mesh (for LOD:0, when camera is the closest), and a low-res mesh (forLOD:1, when camera is further away)
    創建2個版本的網格,高清晰度網格(L0D:0,當攝像機最接近時),和一個低分辨率網格(L0D:1,當攝像機較遠)
  3. Add a LODGroup component to this object (Component->Rendering->LOD Group)
    給這個對象添加LODGroup 組件(Component->Rendering->LOD Group
  4. Drag in the object with the high-res mesh onto the first Renderers box forLOD:0. Say yes to the "Reparent game objects?" dialog
    把高分辨率網格的對象拖到的第一個渲染器框 L0D:0。對話框"Reparent game objects?" 按下yes按鈕
  5. Drag in the object with the low-res mesh onto the first Renderers box forLOD:1. Say yes to the "Reparent game objects?" dialog
    把低分辨率網格的對象拖到的第二個渲染器框 L0D:1。對話框"Reparent game objects?" 按下yes按鈕
  6. Right Click on LOD:2 and remove it.
    在LOD:2上右鍵單擊並刪除它。

At this point the empty object should contain both versions of the mesh, and "know" which mesh to show depending on how far away the camera is.

此時,空對象應包含兩個版本的網格,"知道"網格取決於相機遠離程度顯示不同的版本。

You can preview the effect of this, by dragging the camera icon left and right in the window for theLODGroup component.

您可以預覽這個效果,通過拖拽攝像機圖標到LODGroup組件窗口(的LOD:0,LOD:1的矩形框)。

LOD 0

camera at LOD 0(在LOD 0時的攝像機)

LOD 1

camera at LOD 1(在LOD 1時的攝像機)

In the Scene View, you should be able to see

在場景視圖,你應該能夠看到:

  • Percentage of the view this object occupies
    這個對象占用視圖的百分比
  • What LOD is currently being displayed
    當前顯示的是哪個LOD
  • The number of triangles
    三角形的數量

LOD-based naming conventions in the asset import pipeline
在資產的導入管線基於LOD的命名約定

In order to simplify setup of LODs, Unity has a naming convention for models that are being imported.

為了簡化LOD設置,Unity在模型導入時有一個命名約定。

Simply create your meshes in your modelling tool with names ending with _LOD0, _LOD1, _LOD2, etc., and the LOD group with appropriate settings will be created for you.

簡單地創建你網格,名稱后綴為_LOD0,_LOD1,_LOD2等,會為你創建LOD組,並作出相應的設置。

Note that the convention assumes that the LOD 0 is the highest resolution model.

請注意,該約定假定最高分辨率的網格的LOD后面的數字是最小的。

Setting up LODs for different platforms
對於不同的平台設置LOD

You can tweak your LOD settings for each platform in Quality Settings, in particular the properties of LOD bias and Maximum LOD Level.

質量設置你可以為每個平台條件LOD設置,特別是LOD偏移和最大LOD層次。

Utilities 實用工具

Here are some options that help you work with LODs

下面是一些選項,可有助於你更好的使用LOD工作。

 


Recalculate Bounds
重新計算邊界
If there is new geometry added to the LODGroup, that is not reflected in the bounding volume, press this to update the bounds. One example where this is needed is when one of the geometries is part of aprefab, and new geometry is added to that prefab. Geometry added directly to the LODGroup will automatically updates the bounds
如果有新的幾何體添加到LODGroup,未被映射到邊界體內,按這個按鈕來更新邊界。一個例子,當幾何體之一是prefab的一部分,以及新的幾何體被添加到這個prefab。幾何體直接添加到LODGroup將自動更新邊界。

Update Lightmaps
更新光照貼圖
Updates the Scale in Lightmap property in the lightmaps based on the LOD level boundaries.
更新光照貼圖基於LOD層次邊界光照貼圖屬性比例。
Upload to Importer
上傳給導入器
Uploads the LOD level boundaries to the importer
上傳LOD層次邊界給導入器

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM