Importing Models

From Computing and Software Wiki

(Difference between revisions)
Jump to: navigation, search
 
(One intermediate revision not shown)
Line 1: Line 1:
__TOC__
__TOC__
-
A model (.mdl) resource is created by exporting a model from the World Editor.
+
==Getting Started==
-
<br>The model to be imported MUST be a COLLADA (*.dae) file.
+
If you find that the world editor geometry, or supplied models do not fit your experimental needs there is an easy solution.  The world editor has a function built in that allows you to import models from 3rd party modelling programs such as Maya, 3D Studio Max, or Blender. As long as you can export your file to the '''Collada''' file format '''(*.dae)''', the world editor is able to open the object. In this tutorial we will be using [http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=7635018 Audodesk Maya] as an example for importing models and using them in a world.  Maya does have native .dae export support which we will be using.  However, if you find it to be too buggy the easiest solution is to use the [http://www.feelingsoftware.com/component/option,com_docman/Itemid,80/lang,en/ Feeling Software Collada Export Plugin] for Maya.  You may download the required files and activate the plugin for Maya following the instructions on the website.  Once finished you are ready to begin exporting your scenes with the plugin which may result in better written *.dae files.
-
<br>There are different way to export to collada file depend on the software you use to create the model. In this tutorial, we use [http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=7635018 Audodesk Maya] as an example
+
==Importing Scene Data==
==Importing Scene Data==
-
<br>Export the model to COLLADA (*.dae) file. After exported to a collada file, put it in the directory "..\C4\Import"
+
When you are ready to export from Autodesk Maya make sure your entire model is selected and click on '''File > Export Selection'''.  You will be prompted with a export box, save as '''Files of Type: DAE_FBX (*.dae)''' with an appropriate name. In our example it is '''Waterdrop.dae'''.  If you are using the Feeling Software Plugin make sure to select it from the Save Type and also in the options check Bake Transforms.  After files have been exported they should be relocated to the directory '''..\C4\Import'''.
 +
 
<br>[[Image:Import1.jpg]]
<br>[[Image:Import1.jpg]]
-
<br>Start C4 and select Tool and New World. Select Import Scene from World menu
+
 
 +
<br>Start C4 and select '''Tool > New World'''. Then choose '''World > Import Scene'''
 +
 
<br>[[Image:Import2.jpg]]
<br>[[Image:Import2.jpg]]
-
<br>Import Scene dialog displays and choose the collada file that is importing. Click OK
+
 
 +
<br>You will be prompted with an Import Scene dialog where you should navigate to the appropriate file you have exported from Maya and click OK.
 +
 
<br>[[Image:Import3.jpg]]
<br>[[Image:Import3.jpg]]
-
<br>After selecting a Collada file, the imported geometry (as well as lights and materials) will appear in the World Editor. At this point, you may make any changes that you need to.
+
 
-
<br>Note that during the import process, the World Editor will keep track of the materials used by the imported geometry. The texture maps are correctly assigned to each geometry, but the images themselves still need to be imported using the [http://www.cas.mcmaster.ca/wiki/index.php/Importing_Textures Importing Textures]
+
<br>After selecting a Collada file, the imported geometry (as well as materials) will appear in the World Editor. At this point, you may make any changes that you need to in the world editor. Note that during the import process, the World Editor will keep track of the materials used by the imported geometry from Maya. However, each image must be imported using the [http://www.cas.mcmaster.ca/wiki/index.php/Importing_Textures Importing Textures] so that they are in the appropriate '''*.tex''' format that the engine can understand.  You may then need to hit the Clean button in the Material Manager in order to refresh all of the materials.
 +
 
 +
 
[[Image:Import4.jpg]]
[[Image:Import4.jpg]]
==Exporting to a Model==
==Exporting to a Model==
-
After you make the change, select World - Save as Model
+
When you have made all the required changes to your model, select '''World > Save as Model'''
 +
 
<br>[[Image:Import5.jpg]]
<br>[[Image:Import5.jpg]]
-
<br>Export Model dialog shows up. Give the model a name and choose the location that you want to save at. Click OK
+
 
 +
<br>An Export Model dialog will show up. Give the model a name and be sure to save it in a '''SUBDIRECTORY''' of data, if you put it straight in the '''/data''' folder your model will not open in the world editor. Click OK to save to '''*.mdl''' format that the game engine can recognize.
 +
 
<br>[[Image:Import6.jpg]]
<br>[[Image:Import6.jpg]]
-
<br>Now, you can close the world and the collada file has covert to a model file
 
-
==Insert Model to a world==
+
 
-
To insert the model that you just import, open the world that you work on and from the menu, select World - Insert Model
+
==Inserting a Model to a world==
 +
Now your models are ready to import into a new world or complex world that has been created for an experiment.  Controllers can be attatched to these models so that the user may interact with custom objects as the instructor sees fit.  Open the world that you would like to work with and then select '''World > Insert Model'''.
 +
 
<br>[[Image:Import7.jpg]]
<br>[[Image:Import7.jpg]]
-
<br>Import Model dialog display and you should see the model that you just import. Click OK
+
 
 +
<br>The Import Model dialog will prompt you to navigate to your model that you created. Click OK.
 +
 
<br>[[Image:Import8.jpg]]
<br>[[Image:Import8.jpg]]
-
<br>In the viewports
+
 
 +
<br>It is now easy to see that your model has been inserted into the world for interaction with the game.
 +
 
<br>[[Image:Import9.jpg]]
<br>[[Image:Import9.jpg]]
<br>
<br>
Return to [http://www.cas.mcmaster.ca/wiki/index.php/RCaragogo RCaragogo]
Return to [http://www.cas.mcmaster.ca/wiki/index.php/RCaragogo RCaragogo]
<br>
<br>
 +
 +
==Tips and Troubleshooting==
 +
 +
*Before exporting models to the *.dae format try to scale them to the size that you would like them to be in the world editor.  The scaling function was difficult to use and often had undesirable results on my model especially if it was multiple pieces.
 +
*Before exporting models check out in the Maya '''Window > Hypergraph: Connections''' and clean up any prior groupings and transforms that you may have made but now have no real effect on your model.
 +
*Make sure to go '''Modify > Freeze Transforms''' in maya before exporting so that the collada file is not filled with transforms that are not needed and your model acts appropriately in the world editor.
----
----
'''References'''
'''References'''
<br>http://www.terathon.com/wiki/index.php?title=Creating_an_Entity_Model
<br>http://www.terathon.com/wiki/index.php?title=Creating_an_Entity_Model

Current revision as of 05:03, 20 March 2008

Contents

Getting Started

If you find that the world editor geometry, or supplied models do not fit your experimental needs there is an easy solution. The world editor has a function built in that allows you to import models from 3rd party modelling programs such as Maya, 3D Studio Max, or Blender. As long as you can export your file to the Collada file format (*.dae), the world editor is able to open the object. In this tutorial we will be using Audodesk Maya as an example for importing models and using them in a world. Maya does have native .dae export support which we will be using. However, if you find it to be too buggy the easiest solution is to use the Feeling Software Collada Export Plugin for Maya. You may download the required files and activate the plugin for Maya following the instructions on the website. Once finished you are ready to begin exporting your scenes with the plugin which may result in better written *.dae files.

Importing Scene Data

When you are ready to export from Autodesk Maya make sure your entire model is selected and click on File > Export Selection. You will be prompted with a export box, save as Files of Type: DAE_FBX (*.dae) with an appropriate name. In our example it is Waterdrop.dae. If you are using the Feeling Software Plugin make sure to select it from the Save Type and also in the options check Bake Transforms. After files have been exported they should be relocated to the directory ..\C4\Import.


Image:Import1.jpg


Start C4 and select Tool > New World. Then choose World > Import Scene


Image:Import2.jpg


You will be prompted with an Import Scene dialog where you should navigate to the appropriate file you have exported from Maya and click OK.


Image:Import3.jpg


After selecting a Collada file, the imported geometry (as well as materials) will appear in the World Editor. At this point, you may make any changes that you need to in the world editor. Note that during the import process, the World Editor will keep track of the materials used by the imported geometry from Maya. However, each image must be imported using the Importing Textures so that they are in the appropriate *.tex format that the engine can understand. You may then need to hit the Clean button in the Material Manager in order to refresh all of the materials.


Image:Import4.jpg

Exporting to a Model

When you have made all the required changes to your model, select World > Save as Model


Image:Import5.jpg


An Export Model dialog will show up. Give the model a name and be sure to save it in a SUBDIRECTORY of data, if you put it straight in the /data folder your model will not open in the world editor. Click OK to save to *.mdl format that the game engine can recognize.


Image:Import6.jpg


Inserting a Model to a world

Now your models are ready to import into a new world or complex world that has been created for an experiment. Controllers can be attatched to these models so that the user may interact with custom objects as the instructor sees fit. Open the world that you would like to work with and then select World > Insert Model.


Image:Import7.jpg


The Import Model dialog will prompt you to navigate to your model that you created. Click OK.


Image:Import8.jpg


It is now easy to see that your model has been inserted into the world for interaction with the game.


Image:Import9.jpg
Return to RCaragogo

Tips and Troubleshooting

  • Before exporting models to the *.dae format try to scale them to the size that you would like them to be in the world editor. The scaling function was difficult to use and often had undesirable results on my model especially if it was multiple pieces.
  • Before exporting models check out in the Maya Window > Hypergraph: Connections and clean up any prior groupings and transforms that you may have made but now have no real effect on your model.
  • Make sure to go Modify > Freeze Transforms in maya before exporting so that the collada file is not filled with transforms that are not needed and your model acts appropriately in the world editor.

References
http://www.terathon.com/wiki/index.php?title=Creating_an_Entity_Model

Personal tools