Export Urban pad LOD to Unity3D

4,207 views

Published on

The complemit to UDK.

Published in: Technology

Export Urban pad LOD to Unity3D

  1. 1. Ürban PAD Unity LODAs it is now possible to create different LOD versions of your geometry in Ürban PAD, we havecreated a simple way to test those LODs in Unity.1.The Unity projectWe provide a ready-to-use project: Gamr7_LOD. If you want to use the LOD feature in one of yourother projects, merge the Editor and Scripts folders in your project.2. LOD naming convention.Keep in mind that LOD meshes are described by a number that defines their places in the LODhierarchy. The bigger the number is, the simpler the mesh is.Our Unity script uses your object names to create the LOD prefab, so you will have to follow a namingconvention for your meshes to be recognized:<my_mesh_name>_LOD<my_mesh_number>.fbxExample: building_1920_LOD1.fbx building_1920_LOD1.xml building_1920_LOD2.fbx building_1920_LOD2.xml.If you have a mesh with more than 65536 vertices, it will be exported in two or more files. In this caseyou will have to name your meshes like this:<my_mesh_name>_LOD<my_mesh_number>(<my_mesh_index>).fbxExample: building_LOD0(1).fbx building_LOD0(1).xml. building_LOD0(2).fbx. building_LOD0(2).xml.Dot not forget that each xml file contains data needed by Unity for its corresponding fbx file. As aconsequence, when you update a fbx file name, do not forget to update the corresponding xml filename and the xml data itself. Open the xml file and change the fbx_file attribute in the main tag: <gamr7_materials fbx_file="_building_1920_LOD0(1).fbx"> 1
  2. 2. 2. Exporting your LOD meshes.You will need an Ürban PAD project that includes the LOD feature added in Ürban PAD 3.0.9b. Exportyour meshes using the Unity format, and make sure to respect the previously detailed LOD namingconvention.When the export is complete, regroup all your files and folders (merge the different texture folders inthe same folder, and do the same thing for the models folders) in the desired subfolder of yourproject’s asset folder.3. Creating the LOD prefabsClick GameObject -> Gamr7 Utilities ->Create LOD prefabs1.It will create prefab for meshes with more than 65536 vertices first 1, and then the final prefabregrouping all your LOD meshes 2. 2
  3. 3. This process parses all subfolders in your assets folder, and creates the corresponding prefabs for eachset of files in each folder. A prefab needs at least to different LOD to be created. If there are no prefabsafter the creation process, this could be because Unity was unable to load your files, or to create theprefab itself. Please check the Unity Console (Alt + Shift + C) to check for errors.4. Using a LOD prefab.Drop the final prefab in your scene, and hit the play button.Gamr7_LOD’s camera is a free fly one:  Z : forward  S: backward  Q : left  D : right  Space : up  X : down  Hold the left mouse button : rotateYou will see the geometry changing according to the camera distance: 3
  4. 4. 5. Changing LOD settings.Final LOD prefabs setting can be changed.Select the prefab either in the Project window or in theHierarchy window. Then have a look at the Inspector window: you have access to Lod_distances1 and toLod_meshes2.Lod_meshes stores the different meshes used by the LOD prefab. You can manually change meshes ifyou want.LOD_distances stores the distances. The distances array is smaller than the meshes array by one cellbecause there is not really a distance for the first mesh: it’s the distance inferior to the second one. Youcan manually change each distance.If you want to add another level of detail in your prefab, extends the size of the two arrays, add thenew mesh and set the new distance. 4

×