Import model in Visual3D.NET

From $1

Table of contents
  1. 1. About :
    1. 1.1. Part one:
        1. 1.1.1.1. - Step 1:
        2. 1.1.1.2. - Step 2:
        3. 1.1.1.3. - Step 3:
        4. 1.1.1.4. - Step 4:
        5. 1.1.1.5. - Step 5:
        6. 1.1.1.6. - Step 6:
    2. 1.2. Part two :
        1. 1.2.1.1. - Step 1:
        2. 1.2.1.2. - Step 2:
        3. 1.2.1.3. - Step 3:
        4. 1.2.1.4. - Step 4:
        5. 1.2.1.5. - Step 5:
        6. 1.2.1.6. - Step 6:

by Steaph

About :

The purpose of this tutorial is to give you the basics of the model import process and materials configuration with Visual 3D.NET Beta 2.0.

It will show you two simple ways to import and give you a glimpse of the model and material editors.

Two ways :

The default import format for Visual 3D.NET is the “.mesh” format from the OGRE engine.

Not every modeler is able to export in OGRE. So, this tutorial will focus first on importing from any modeler, via a third party software (the Deled editor from Delgine), and second, on the importation from Blender, which can export in “.mesh” with the help of a little script. Moreover, the blender exporter handles skeletons and LOD. (Take note that the OGRE website offers a wide range of exporters for many 3D modeling tools. More information here)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

Part one:

Importing, from any modeler, simple mesh without LOD or Skeletons.

Requirements:

For this part, you’ll need
  1. -Your favourite modeler.
  2. -DeleD Lite editor. (DeleD is a free editor that you can download here.
  3. -Ogre exporter plugin for Deled (here).

           

- Step 1:

Before anything, you have to install the Deled editor. Launch the ".exe " file you have previously downloaded, and follow the instructions.

Unzip the OGRE exporter. It's a ‘.dll’ file you have to put in the “plugins” directory of Deled. "C:\Program Files\DeleD LITE\Plugins"

(for now, you also have to close Visual 3D.net)

- Step 2:

You first have to export your mesh in “.obj”, “.3ds” or ”.x” format. As many modeler and 3D solution suit are capable of that, we won’t discuss here the way used to obtain these files.

Thus, we’ll assume that you have your mesh, along with his texture map.

For this example, I will use a mapped cube with 3 different materials. The first is a mapped picture (you can see that only three faces are mapped), the second a black solid color, and the third, a gray color. This way we’ll can deal with the main needs in an importation.

(You can fin the mesh in the "file" window, at the end of this page)

./VD1.jpg

- Step 3:

Import your mesh in Deled, using “ Plug-ins -> X importer” where X is the format of your mesh. You’ll perhaps have to rescale your model during import, regarding which modeler you have used.

Your mesh will appear without his texture (with a beautiful error popup). Don’t worry. You can solve this by putting your texture in the file indicated by the popup, but really, as we are using Deled as a mesh converter, it’s useless.

In the scene directory of Deled, (in the "scene inspector topic) you should now see the three parts of your mesh. (One part with a mapped image material, one with a plain gray material and one in black.)

./VD2.jpg

- Step 4:

Go to “ Plug-ins” once again, and chose “Ogre Exporter”. Open the explorer and chose a place where to export your mesh. Give it a name and don’t forget to add “.mesh” after it. (i.e. cube.mesh)

./VD3 (1).jpg

You now have a "Cube.mesh", an image named "color" and a ".material" file. We'll use them in a minute.

- Step 5:

Open the Visual 3D directory and go to models in the beta assets. ("Projects/Demo Assets/#Media/Models").

Create a new folder named « my models », and, in it, a folder with the name of your model (in our example: "Projects/Demo Assets/#Media/Models/MyModels/Cube/"

In “Cube", you will put your freshly created “.mesh” file, along with its texture map (the texture you have exported from your modeler) and its .material.

You now have a file named “Cube”, in the Visual 3D.net directory"Projects/Demo Assets/#Media/Models/MyModels/Cube/cube.mesh" , containing your mesh in OGRE format, a “.mat” file and a texture map.

./VD4.jpg

- Step 6:

Open Visual 3D.net architect and open the Model viewer. Go to the Assets menu, "/#Media/Models/MyModels/Cube". Your model should be there. Drag and drop it in the viewer.

./VD5.jpg

If you have used the cube I have joined in this tutorial, the model viewer could become totaly dark... Zoom out (wheel mouse) to take a larger perspective on your work.

At this point, the cube is totaly black. Shadows or lights don't affect it. So, it's time to give it some materials. 

./VD6.jpg

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

Part two :

Basic texturing using the material editor.

Requirements:

      

For this part, you’ll need
  1. - Having completed one way of the firt part. 
  2. - If not, you need a . mesh file and his texture map, both in  the "Projects/Demo Assets/#Media/Models/MyModels/Cube" directory of Visual3D.NET.

       

- Step 1:

We first need to create a specific material for your mesh, that will contain your texture map informations. Open the material editor of Visual3D.NET and click on "create new material". The material editor will load a default checker image, to cover the mesh in the preview window. This material is now temporary saved in your asset window, under "Materials/new material".

./VDp2-1.jpg

Keep in mind that if you don't use your material in a mesh before closing Visual3D.NET, it will be erased during shut down. To keep a material you don't plan to use straight head, use the "save as" option that allow you to save your material settings in a XML file.

./VDp2-2.jpg

- Step 2:

First, let's change the name of your new material. "Textured Blinn-Phong #1" sounds really cool and serious, but it's not rather informative.

  ./VDp2-3.jpg

So, in the little "name :" window, change "Textured Blinn-Phong #1" (don't touch to "material/") by anything you want. "Cubemap" in this case. Press enter. You can now see a different asset name, in the "new material" folder.

./VDp2-4.jpg

- Step 3:

We now have a new material named "Cubemap". This material will be applied on the mapped part of our mesh, so wee need to import the mapping texture in it. In order to achieve that, let's take a look on what offer the material editor.

  •  - Texturing mode.  Here, you can choose between "Solid fill", "2D texture", or "Environment map". We will chose obviously "2D texture", as we are trying to import a texture map. "Environment map" can be used as well, but it will allows us to create a special reflection effect using a second spherical texture displaying the surroundings of our mesh. It's not the purpose of this tutorial.

  • - Lighting model.  Three lighting models are available. "Ambient" only take in count static light. "Lambert" take in count diffuse light (dynamic light) and "Blinn-Phong", faster shader derived from the Phong shader display diffuse and specular lighting. "Blinn-Phong is best suited for reflecting or polished surfaces like glass or metal. For something more "mat", prefere "Lambert". Let's assume that our cube is in plastic, and let's choose "Blinn-Phong".

  • - Normal map.   Normal map are used to generate an illusion of relief on object. Only an illusion, because this is achieve only by adding more informations about the incidence of light on the surface. The mesh geometry is not modified. The "parallax mapping" is an improvement of normal mapping that gives illusion of depth. Creating a normal map require special tools and will not be discussed here ( We will explore that in an other tutorial). We try to create a basic material, so we will select "none".

  • - Transparency mode. We choose an opaque cube.

       

         

To summarize our choice, we can say that we let everything in the default settings and we will do the same for the "lighting" part of the editor. So, open the texture window of the editor.

- Step 4:

Currently, the display texture is a "checker". In order to exchange it with the mapped texture of our mesh, go in the asset window.

./VDp2-5.jpg

Open "texture", navigate to "Textures/#Media/Models/MyModels/Cube". You should find your texture there.

Drag and drop it in the preview texture window. Our texture is now displayed on both preview windows. The material is ready.

./VDp2-6.jpg

- Step 5:

Leave the material editor, and go to the model Viewer. Drag and drop your model from the asset window to the viewer.

In the parts and material window, you should see three different names. This names correspond to the different materials of our cube. In the example cube, the first is the texture mapped material, and the two other are procedural materials.

./VDp2-7.jpg

- Step 6:

Select the mapped part. In the "material" window, the name of the material assigned to this part of the mesh appear. The material has indeed the name of our texture map, but is totally empty. So, open the "material explorer". Go to "new material" and select "Cubemap".

./VDp2-8.jpg

Our texture map is now perfectly applied on our mesh.

./VDp2-9.jpg

Don't forget to save the modifications on your mesh with the "save" button near the object name.

    

Comments (1)
Viewing 1 of 1 comments: view all
Great tutorial !

I Just added my first model using blender + OGRE exporter...cool it keeps even the material properties!

Very helpful !

Posted 22:27, 24 Jun 2008 (6 months ago)
Viewing 1 of 1 comments: view all
You must Login to post a comment.
File Size Date Attached by  
 cube.obj
The ".obj" cube I have used for example
1266 bytes22:10, 27 May 2008SteaphActions
 cube1_auv.tga
The texture map
256.02 kB22:10, 27 May 2008SteaphActions
 v3d.mtl
The ".mtl" file of the ".obj"
578 bytes22:10, 27 May 2008SteaphActions
Images (15)
Viewing 1 - 6 of 15 images | View All
No description
VDp2-9.jpg  Actions
No description
VDp2-8.jpg  Actions
No description
VDp2-7.jpg  Actions
No description
VDp2-5.jpg  Actions
No description
VDp2-6.jpg  Actions
No description
VDp2-4.jpg  Actions