SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
Ürban PAD to Unity workflow


1 Basic Settings
It is possible to export directly into FBX format from Ürban PAD, allowing a direct import into Unity.
However, there is a limitation in Unity we will have to get around: the material assignment.


1.1 Material assignment

As stated in the Unity documentation, materials are imported only with diffuse textures.

This leads to a long and painful post-process in order to identify the materials, assign them the correct
shaders and assign the right textures in the shader slots.

Moreover, Unity's default shader implementation is missing the DiffuseNormalSpecular that is one of
the most commonly used in Ürban PAD.

We decided to develop our own custom import script that would automatically assign the correct
shaders and textures to the materials, and provide an implementation for the missing shaders.


1.2 Setting a Unity project

Be careful, the following steps must be done only once for a given Unity project, prior
importing any data exported in Ürban PAD.

Launch Unity, and then click File -> New project 1.




You will be able to add many packages to your new project 1, but you don't need any of them right
now. Don’t worry - you will be able to import any of those packages later if needed. Hit Create 2 and
your new project will be created.


                                                                                                       1
Open the Project window by clicking Window -> Project 1.




Then right click in the project window and click on Show in explorer 1.




                                                                          .

                                                                              2
It will open the project folder in a new explorer window. Open its Assets folder.

The Gamr7 custom Unity resources (scripts and shaders) are located in the resources/Unity sub-folder
of the Ürban PAD project folder. Copy the content of the resources/Unity folder in the Assets folder
previously opened.

The resulting folders hierarchy after this operation must look like this:
                                Unity Project
                                  |__ Assets
                                     |__ Editor
                                        |__ G7_UnityImport.js
                                     |__ Shaders
                                        |__ G7_DiffuseNormalSpecular.shader
                                        |__ G7_Alpha-DiffuseNormalSpecular.shader


2 Export from Ürban PAD
The export button 1 is located in the top left corner of Ürban PAD. You can also hit Ctrl+e to open the
export window.




2.1 Export a sector from Sector Editor

       Select the Unity format 1.
       Chose the folder where you want to export your data 2. By default, the export folder is the
        unity folder located at the root of your Ürban PAD project.
       Select the usual export options you want to use 3.
       Hit the validation button 4 and wait for the progress bar to disappear.




                                                                                                     3
2.2 Export a city from City Editor

       Select the Unity format 1.
       Choose the folder where you want to export your data 2. By default, the export folder is the
        unity folder located at the root of your Ürban PAD project folder.
       Select the usual export options you want to use 3.
             o Bu using the Multi Files option, you will divide your city in many files: one per road
                 segment, crossroad or sector.
             o You can pack your city on a grid, which allows you to choose the size of the city blocks
                 you will obtain.
       Hit the validation button 4 and wait for the progress bar to disappear.




Now that you have exported your city, you should have a folder containing these files and folders:
                               My exported city folder
                                        |__ models
                                        |__ textures
                                                    |__ texture_1.png
                                                    |__ texture_2.tga
                                                    |__ …
                                        |__ multi_export_global_file.xml
                                        |__ couple_1.fbx
                                        |__ couple_1.xml
                                        |__ couple_2.fbx
                                        |__ couple_2.xml
                                        |__ …



                                                                                                     4
The number of couple of .fbx and .xml files depends on the options you have chosen and the size of
your city.


3 Import into Unity
There is no import command in Unity. Simply drop your resources into the Assets directory of your
project's root folder. Then when you set the focus back to the Unity window, it automatically detects
that new assets were added and starts importing them.

Here is the procedure to follow to import your data into Unity:

       Navigate to the location where you exported your Ürban PAD data.
       Copy the .fbx file(s), the .xml file(s) and the textures folder, and paste them anywhere under the
        Assets folder. This can be directly in the Assets folder or in any sub-folder.
       Return to Unity, and you should see an Importing Assets progress bar pop up. When it's
        finished, your assets will be available in the Unity Project window 1.




3.1 Material Issue

How our material process works

Along with each .fbx file, we export a .xml file with the same base name. This file lists all the materials
used in the corresponding .fbx, identified with their IDs, and provides for each material:

       The shader format (ex: "D" stands for Diffuse, "DNS" stands for DiffuseNormalSpecular)
       The list of the textures referenced by the material with their semantic ("diffuse", "normal",
        "specular"...)

Here is an example of our xml data:
          <material id="material_123" shader_format="DNS">
                    <texture semantic="specular">default_specular.jpg</texture>
                    <texture semantic="diffuse">grey_pavement.jpg</texture>
                    <texture semantic="normal">grey_pavement_normal.jpg</texture>
          </material>

We have developed a script, named G7_UnityImport.js, that is automatically called during the import
process.



It parses the .xml materials file and assigns the correct shader and textures to the material being
imported.


                                                                                                         5
We added some shader implementations that were missing in Unity default resources, currently:

       G7_DiffuseNormalSpecular.shader : DNS without transparency
       G7_Alpha-DiffuseNormalSpecular.shader : DNS with transparency

Import models with materials

Import your assets as previously described. At the end of the process, a NormalMap settings window
might pop up:

This is because textures used as Normal Maps must be explicitly declared as such in Unity. Click Fix
now 1 to resolve this issue.




Add a single model to a Scene

To add the model to a Scene, first activate the Scene by double-clicking it in the Project window, then
drag and drop the fbx model node from the Project window to the Hierarchy window. The model will
be added to the Scene in position (0, 0, 0).

By default, you don't have any Scene in the Project window and a new, unsaved Scene is active. You
could also drag and drop the model node directly in the Scene window. In that case, you don't have a
precise control of the position where the model is added to the Scene. Click the model instance node
in the Hierarchy window and adjust the Position in the Transform section of the Inspector window.

By default, Unity applies a rotation that gives your model a different orientation than the one it has in
Ürban PAD. To restore the original orientation, input the following values for the Rotation in the
Transform section of the Inspector window: (-90, 0, 0). For more details on this problem, please see
those two links:

       fbx importer correct orientation
       3Ds max to Unity: scene rotated by 180 degree

Please note that when importing an entire city the orientation is automatically set to correct
values by our script.




                                                                                                       6
Add transparency

Transparency can’t be automatically managed by the import script. If one of your materials references
textures with transparent parts, then you have to select the material node and change the shader to
the equivalent transparent shader in the Inspector window:

       Bumped Diffuse --> Transparent/Bumped Diffuse 1
       Gamr7/Diffuse Normal Specular --> Transparent/Gamr7/Diffuse Normal Specular 2




                                                                                                   7
3.2 Import city at once

How it works

As we said before, G7_UnityImport.js is called automatically during the import process. This script will
create a Unity prefab and use multi_export_global_file.xml to load and set each individual part of the
city at its own place, as a child of the prefab.

Import an entire city

The process is simple: copy your city folder in the Assets folder of your Unity project directory. It
should now look something like this:
                      Unity Project
                      |__ Assets
                                 |__ Editor
                                       |__ G7_UnityImport.js
                                 |__ Shaders
                                       |__ G7_DiffuseNormalSpecular.shader
                                       |__ G7_Alpha-DiffuseNormalSpecular.shader
                                 |__ My exported city folder

Return to Unity, wait for it to load the new assets and you will see a prefab with the same name as
your imported city's folder in the Hierarchy Window 1.




Note that this prefab is available in the project panel, in your city's folder 1.




                                                                                                      8
You can even import many cities this way at one time. A prefab will be created for each city you have
imported.


3.3 Export a Package

To export a package, in order to sell it on the Assets Store for instance, use the Assets->Export package
command 1. An Exporting package window will pop up, letting you select which elements you want to
include in the package. After clicking Export, all these elements will be bundled into a unique
unitypackage file.




The project hierarchy is saved within the package file and you can re-import it in any Unity project
using the Assets -> Import package command 1.




                                                                                                       9
4 Frequently Asked Question
4.1 Can I sell the building/city I created with Ürban PAD on the Unity
Asset Store?

Yes, there are no limitations to using Ürban PAD to create your Asset Store assets. You can learn about
Unity’s Asset Store limitations here : submit your content to the assets store.


4.2 Can I export directly into Unity Asset folder?

Yes, you can export your data directly to your Unity project folder, and wherever you want. You just
have to use the folder selector 1 in the export options of Ürban PAD.




                                                                                                    10
4.3 Can I use Ürban PAD-integrated Substances in Unity?

We will add this possibility in a future version of Ürban PAD.


4.4 What about colliders and collisions?

Keep an eye on upcoming versions of Ürban PAD. These features will be released soon.




                                                                                       11

Más contenido relacionado

Destacado

物理ベース時代のライトマップベイク奮闘記
物理ベース時代のライトマップベイク奮闘記物理ベース時代のライトマップベイク奮闘記
物理ベース時代のライトマップベイク奮闘記Silicon Studio Corporation
 
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディgree_tech
 
プログラマがUnityでSTGを作った話
プログラマがUnityでSTGを作った話プログラマがUnityでSTGを作った話
プログラマがUnityでSTGを作った話MASA_T_O
 
学生がUnityで2 dゲームを作るとこうなる
学生がUnityで2 dゲームを作るとこうなる学生がUnityで2 dゲームを作るとこうなる
学生がUnityで2 dゲームを作るとこうなるRyoya Takahashi
 
日本ゲームと中国ゲームの違いについて
日本ゲームと中国ゲームの違いについて日本ゲームと中国ゲームの違いについて
日本ゲームと中国ゲームの違いについてKeisuke Yamada
 
マシな画面を作る
マシな画面を作るマシな画面を作る
マシな画面を作るokumasama
 
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜narumi_
 
ゲーム制作初心者が知るべき8つのこと
ゲーム制作初心者が知るべき8つのことゲーム制作初心者が知るべき8つのこと
ゲーム制作初心者が知るべき8つのことMASA_T_O
 
ゴルフゲームでUnityの限界を突破する方法
ゴルフゲームでUnityの限界を突破する方法ゴルフゲームでUnityの限界を突破する方法
ゴルフゲームでUnityの限界を突破する方法Nohina Hidenari
 
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版小林 信行
 
Unity道場08「絵づくりの基礎」ライティング虎の巻
Unity道場08「絵づくりの基礎」ライティング虎の巻Unity道場08「絵づくりの基礎」ライティング虎の巻
Unity道場08「絵づくりの基礎」ライティング虎の巻小林 信行
 
【ゲーム企画】「あなた採用、お前不採用っ。」
【ゲーム企画】「あなた採用、お前不採用っ。」【ゲーム企画】「あなた採用、お前不採用っ。」
【ゲーム企画】「あなた採用、お前不採用っ。」Osamu Ohkubo
 

Destacado (12)

物理ベース時代のライトマップベイク奮闘記
物理ベース時代のライトマップベイク奮闘記物理ベース時代のライトマップベイク奮闘記
物理ベース時代のライトマップベイク奮闘記
 
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ
[GREE Tech Talk #07] Unityカジュアルゲーム・ケーススタディ
 
プログラマがUnityでSTGを作った話
プログラマがUnityでSTGを作った話プログラマがUnityでSTGを作った話
プログラマがUnityでSTGを作った話
 
学生がUnityで2 dゲームを作るとこうなる
学生がUnityで2 dゲームを作るとこうなる学生がUnityで2 dゲームを作るとこうなる
学生がUnityで2 dゲームを作るとこうなる
 
日本ゲームと中国ゲームの違いについて
日本ゲームと中国ゲームの違いについて日本ゲームと中国ゲームの違いについて
日本ゲームと中国ゲームの違いについて
 
マシな画面を作る
マシな画面を作るマシな画面を作る
マシな画面を作る
 
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
 
ゲーム制作初心者が知るべき8つのこと
ゲーム制作初心者が知るべき8つのことゲーム制作初心者が知るべき8つのこと
ゲーム制作初心者が知るべき8つのこと
 
ゴルフゲームでUnityの限界を突破する方法
ゴルフゲームでUnityの限界を突破する方法ゴルフゲームでUnityの限界を突破する方法
ゴルフゲームでUnityの限界を突破する方法
 
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版
ゲームデザイナーのためのキャラクター表現&コンセプトメイキング:抜粋版
 
Unity道場08「絵づくりの基礎」ライティング虎の巻
Unity道場08「絵づくりの基礎」ライティング虎の巻Unity道場08「絵づくりの基礎」ライティング虎の巻
Unity道場08「絵づくりの基礎」ライティング虎の巻
 
【ゲーム企画】「あなた採用、お前不採用っ。」
【ゲーム企画】「あなた採用、お前不採用っ。」【ゲーム企画】「あなた採用、お前不採用っ。」
【ゲーム企画】「あなた採用、お前不採用っ。」
 

Último

No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Naveed Bangali
 
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfUnity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfRebeccaSealfon
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxStephen Palm
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
Asli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in LahoreAsli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in Lahoreamil baba kala jadu
 
black magic specialist amil baba pakistan no 1 Black magic contact number rea...
black magic specialist amil baba pakistan no 1 Black magic contact number rea...black magic specialist amil baba pakistan no 1 Black magic contact number rea...
black magic specialist amil baba pakistan no 1 Black magic contact number rea...Amil Baba Mangal Maseeh
 
Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Bassem Matta
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
Understanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxUnderstanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxjainismworldseo
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Naveed Bangali
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfRebeccaSealfon
 
Do You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxDo You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxRick Peterson
 
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAsli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAmil Baba Mangal Maseeh
 
Asli amil baba near you 100%kala ilm ka mahir
Asli amil baba near you 100%kala ilm ka mahirAsli amil baba near you 100%kala ilm ka mahir
Asli amil baba near you 100%kala ilm ka mahirAmil Baba Mangal Maseeh
 
No 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaNo 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaAmil Baba Mangal Maseeh
 
Amil baba kala jadu expert asli ilm ka malik
Amil baba kala jadu expert asli ilm ka malikAmil baba kala jadu expert asli ilm ka malik
Amil baba kala jadu expert asli ilm ka malikamil baba kala jadu
 
Seerah un nabi Muhammad Quiz Part-1.pdf
Seerah un nabi  Muhammad Quiz Part-1.pdfSeerah un nabi  Muhammad Quiz Part-1.pdf
Seerah un nabi Muhammad Quiz Part-1.pdfAnsariB1
 

Último (20)

No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdfUnity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
Unity is Strength 2024 Peace Haggadah_For Digital Viewing.pdf
 
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptxCulture Clash_Bioethical Concerns_Slideshare Version.pptx
Culture Clash_Bioethical Concerns_Slideshare Version.pptx
 
Top 8 Krishna Bhajan Lyrics in English.pdf
Top 8 Krishna Bhajan Lyrics in English.pdfTop 8 Krishna Bhajan Lyrics in English.pdf
Top 8 Krishna Bhajan Lyrics in English.pdf
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Asli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in LahoreAsli amil baba in Karachi asli amil baba in Lahore
Asli amil baba in Karachi asli amil baba in Lahore
 
black magic specialist amil baba pakistan no 1 Black magic contact number rea...
black magic specialist amil baba pakistan no 1 Black magic contact number rea...black magic specialist amil baba pakistan no 1 Black magic contact number rea...
black magic specialist amil baba pakistan no 1 Black magic contact number rea...
 
Sawwaf Calendar, 2024
Sawwaf Calendar, 2024Sawwaf Calendar, 2024
Sawwaf Calendar, 2024
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Understanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptxUnderstanding Jainism Beliefs and Information.pptx
Understanding Jainism Beliefs and Information.pptx
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
Unity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdfUnity is Strength 2024 Peace Haggadah + Song List.pdf
Unity is Strength 2024 Peace Haggadah + Song List.pdf
 
Do You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptxDo You Think it is a Small Matter- David’s Men.pptx
Do You Think it is a Small Matter- David’s Men.pptx
 
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialistAsli amil baba in Karachi Pakistan and best astrologer Black magic specialist
Asli amil baba in Karachi Pakistan and best astrologer Black magic specialist
 
Asli amil baba near you 100%kala ilm ka mahir
Asli amil baba near you 100%kala ilm ka mahirAsli amil baba near you 100%kala ilm ka mahir
Asli amil baba near you 100%kala ilm ka mahir
 
No 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in CanadaNo 1 astrologer amil baba in Canada Usa astrologer in Canada
No 1 astrologer amil baba in Canada Usa astrologer in Canada
 
young Call girls in Dwarka sector 3🔝 9953056974 🔝 Delhi escort Service
young Call girls in Dwarka sector 3🔝 9953056974 🔝 Delhi escort Serviceyoung Call girls in Dwarka sector 3🔝 9953056974 🔝 Delhi escort Service
young Call girls in Dwarka sector 3🔝 9953056974 🔝 Delhi escort Service
 
Amil baba kala jadu expert asli ilm ka malik
Amil baba kala jadu expert asli ilm ka malikAmil baba kala jadu expert asli ilm ka malik
Amil baba kala jadu expert asli ilm ka malik
 
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort serviceyoung Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
young Whatsapp Call Girls in Adarsh Nagar🔝 9953056974 🔝 escort service
 
Seerah un nabi Muhammad Quiz Part-1.pdf
Seerah un nabi  Muhammad Quiz Part-1.pdfSeerah un nabi  Muhammad Quiz Part-1.pdf
Seerah un nabi Muhammad Quiz Part-1.pdf
 

Ürban PAD to Unity 3D Workflow

  • 1. Ürban PAD to Unity workflow 1 Basic Settings It is possible to export directly into FBX format from Ürban PAD, allowing a direct import into Unity. However, there is a limitation in Unity we will have to get around: the material assignment. 1.1 Material assignment As stated in the Unity documentation, materials are imported only with diffuse textures. This leads to a long and painful post-process in order to identify the materials, assign them the correct shaders and assign the right textures in the shader slots. Moreover, Unity's default shader implementation is missing the DiffuseNormalSpecular that is one of the most commonly used in Ürban PAD. We decided to develop our own custom import script that would automatically assign the correct shaders and textures to the materials, and provide an implementation for the missing shaders. 1.2 Setting a Unity project Be careful, the following steps must be done only once for a given Unity project, prior importing any data exported in Ürban PAD. Launch Unity, and then click File -> New project 1. You will be able to add many packages to your new project 1, but you don't need any of them right now. Don’t worry - you will be able to import any of those packages later if needed. Hit Create 2 and your new project will be created. 1
  • 2. Open the Project window by clicking Window -> Project 1. Then right click in the project window and click on Show in explorer 1. . 2
  • 3. It will open the project folder in a new explorer window. Open its Assets folder. The Gamr7 custom Unity resources (scripts and shaders) are located in the resources/Unity sub-folder of the Ürban PAD project folder. Copy the content of the resources/Unity folder in the Assets folder previously opened. The resulting folders hierarchy after this operation must look like this: Unity Project |__ Assets |__ Editor |__ G7_UnityImport.js |__ Shaders |__ G7_DiffuseNormalSpecular.shader |__ G7_Alpha-DiffuseNormalSpecular.shader 2 Export from Ürban PAD The export button 1 is located in the top left corner of Ürban PAD. You can also hit Ctrl+e to open the export window. 2.1 Export a sector from Sector Editor  Select the Unity format 1.  Chose the folder where you want to export your data 2. By default, the export folder is the unity folder located at the root of your Ürban PAD project.  Select the usual export options you want to use 3.  Hit the validation button 4 and wait for the progress bar to disappear. 3
  • 4. 2.2 Export a city from City Editor  Select the Unity format 1.  Choose the folder where you want to export your data 2. By default, the export folder is the unity folder located at the root of your Ürban PAD project folder.  Select the usual export options you want to use 3. o Bu using the Multi Files option, you will divide your city in many files: one per road segment, crossroad or sector. o You can pack your city on a grid, which allows you to choose the size of the city blocks you will obtain.  Hit the validation button 4 and wait for the progress bar to disappear. Now that you have exported your city, you should have a folder containing these files and folders: My exported city folder |__ models |__ textures |__ texture_1.png |__ texture_2.tga |__ … |__ multi_export_global_file.xml |__ couple_1.fbx |__ couple_1.xml |__ couple_2.fbx |__ couple_2.xml |__ … 4
  • 5. The number of couple of .fbx and .xml files depends on the options you have chosen and the size of your city. 3 Import into Unity There is no import command in Unity. Simply drop your resources into the Assets directory of your project's root folder. Then when you set the focus back to the Unity window, it automatically detects that new assets were added and starts importing them. Here is the procedure to follow to import your data into Unity:  Navigate to the location where you exported your Ürban PAD data.  Copy the .fbx file(s), the .xml file(s) and the textures folder, and paste them anywhere under the Assets folder. This can be directly in the Assets folder or in any sub-folder.  Return to Unity, and you should see an Importing Assets progress bar pop up. When it's finished, your assets will be available in the Unity Project window 1. 3.1 Material Issue How our material process works Along with each .fbx file, we export a .xml file with the same base name. This file lists all the materials used in the corresponding .fbx, identified with their IDs, and provides for each material:  The shader format (ex: "D" stands for Diffuse, "DNS" stands for DiffuseNormalSpecular)  The list of the textures referenced by the material with their semantic ("diffuse", "normal", "specular"...) Here is an example of our xml data: <material id="material_123" shader_format="DNS"> <texture semantic="specular">default_specular.jpg</texture> <texture semantic="diffuse">grey_pavement.jpg</texture> <texture semantic="normal">grey_pavement_normal.jpg</texture> </material> We have developed a script, named G7_UnityImport.js, that is automatically called during the import process. It parses the .xml materials file and assigns the correct shader and textures to the material being imported. 5
  • 6. We added some shader implementations that were missing in Unity default resources, currently:  G7_DiffuseNormalSpecular.shader : DNS without transparency  G7_Alpha-DiffuseNormalSpecular.shader : DNS with transparency Import models with materials Import your assets as previously described. At the end of the process, a NormalMap settings window might pop up: This is because textures used as Normal Maps must be explicitly declared as such in Unity. Click Fix now 1 to resolve this issue. Add a single model to a Scene To add the model to a Scene, first activate the Scene by double-clicking it in the Project window, then drag and drop the fbx model node from the Project window to the Hierarchy window. The model will be added to the Scene in position (0, 0, 0). By default, you don't have any Scene in the Project window and a new, unsaved Scene is active. You could also drag and drop the model node directly in the Scene window. In that case, you don't have a precise control of the position where the model is added to the Scene. Click the model instance node in the Hierarchy window and adjust the Position in the Transform section of the Inspector window. By default, Unity applies a rotation that gives your model a different orientation than the one it has in Ürban PAD. To restore the original orientation, input the following values for the Rotation in the Transform section of the Inspector window: (-90, 0, 0). For more details on this problem, please see those two links:  fbx importer correct orientation  3Ds max to Unity: scene rotated by 180 degree Please note that when importing an entire city the orientation is automatically set to correct values by our script. 6
  • 7. Add transparency Transparency can’t be automatically managed by the import script. If one of your materials references textures with transparent parts, then you have to select the material node and change the shader to the equivalent transparent shader in the Inspector window:  Bumped Diffuse --> Transparent/Bumped Diffuse 1  Gamr7/Diffuse Normal Specular --> Transparent/Gamr7/Diffuse Normal Specular 2 7
  • 8. 3.2 Import city at once How it works As we said before, G7_UnityImport.js is called automatically during the import process. This script will create a Unity prefab and use multi_export_global_file.xml to load and set each individual part of the city at its own place, as a child of the prefab. Import an entire city The process is simple: copy your city folder in the Assets folder of your Unity project directory. It should now look something like this: Unity Project |__ Assets |__ Editor |__ G7_UnityImport.js |__ Shaders |__ G7_DiffuseNormalSpecular.shader |__ G7_Alpha-DiffuseNormalSpecular.shader |__ My exported city folder Return to Unity, wait for it to load the new assets and you will see a prefab with the same name as your imported city's folder in the Hierarchy Window 1. Note that this prefab is available in the project panel, in your city's folder 1. 8
  • 9. You can even import many cities this way at one time. A prefab will be created for each city you have imported. 3.3 Export a Package To export a package, in order to sell it on the Assets Store for instance, use the Assets->Export package command 1. An Exporting package window will pop up, letting you select which elements you want to include in the package. After clicking Export, all these elements will be bundled into a unique unitypackage file. The project hierarchy is saved within the package file and you can re-import it in any Unity project using the Assets -> Import package command 1. 9
  • 10. 4 Frequently Asked Question 4.1 Can I sell the building/city I created with Ürban PAD on the Unity Asset Store? Yes, there are no limitations to using Ürban PAD to create your Asset Store assets. You can learn about Unity’s Asset Store limitations here : submit your content to the assets store. 4.2 Can I export directly into Unity Asset folder? Yes, you can export your data directly to your Unity project folder, and wherever you want. You just have to use the folder selector 1 in the export options of Ürban PAD. 10
  • 11. 4.3 Can I use Ürban PAD-integrated Substances in Unity? We will add this possibility in a future version of Ürban PAD. 4.4 What about colliders and collisions? Keep an eye on upcoming versions of Ürban PAD. These features will be released soon. 11