source: OGRE/trunk/ogrenew/Tools/3dsmaxExport/Docs/tutorials/skateboard/index.html @ 692

Revision 692, 5.5 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1<HTML>
2
3<HEAD>
4</HEAD>
5<TITLE> OGRE tutorial.
6</TITLE>
7<BODY>
8
9<H2 ALIGN=CENTER > Tutorial: Exporting meshes from 3dsmax 5</H2>
10
11
12This tutorial shows how to export a skateboard from 3D studio Max 5. You will export a mesh made up of several submeshes and
13its assigned material.
14
15<H4> Introduction </H4>
16First, open the file "skateboard_1.max" that you can find in this <A href=skateboard_1.zip>zip file</A>.<BR>
17<B>Copy the png file to "C:\" directory or change the path in the material editor. You should also copy it to your OGRE Media directory.</B><BR>
18You can see 2 boards which have been cloned. They are made up of a board that have been mapped with <I>UVW unwrap</I>,
194 wheels and 2 trucks.<BR>
20
21<img src="images/intro1.jpg" /> <img src="images/intro2.jpg" /> <BR>
22
23
24<H4> Create one object with submeshes</H4>
25
26<UL>
27   <LI> Select the board (whose name is "board") which is at (0,0,0) and convert it to an editable mesh.
28        Attach the wheels and the trucks.<BR><BR>
29   </LI>
30   
31   <LI> As you can see, texture mapping has changed, we must create a MultiMaterial and assign material ids to submeshes.
32        In the material editor (press "M"), assign the multiMaterial to the board, and in the element subobject mode,
33        choose material Id 1 for the board, 2 for the wheels and 3 for the trucks.<BR>
34        <img src="images/assignIds.jpg" />
35        <BR>
36        <BR><BR>
37   </LI>
38   <LI> That's all, the mesh is ready to be exported. </LI>
39</UL>
40
41<H4> Run the mesh exporter</H4>
42
43The script allows you to run XMLConverter after exporting. This is set in the OgreScript.ini file.
44Here is an example:
45<PRE>
46      [Directories]
47      XMLConverterPath=e:\C++\ogrenew\Tools\XMLConverter\bin\Debug
48      MediaPath=E:\C++\ogrenew\Samples\Media
49     
50      [Exe]
51      XMLConverterExe=OgreXMLconverter.exe
52     
53      [Settings]
54      lastFile=e:\C++\ogrenew\Tools\XMLConverter\bin\Debug\bbb
55      lastAnimName=walk
56      lastMaterialFile=E:\C++\ogrenew\Samples\Media\3ds.material
57     
58      [Tools]
59      runXMLConverter=no
60</PRE>
61
62As you can see, settings are saved, so you avoid to write again and again the same output files and animation name.
63To be able to run XMLConverter, change the last line as:
64<PRE>
65   runXMLConverter=yes
66</PRE>
67and set up your directories.
68<B>Nota:</B>you may have to change XMLConverterExe to another name (to the former XMLConverter), there will not be any warnings if a path or the exe file contains errors. <BR>
69<BR>
70Now choose the board, check the "export mesh" checkbox and press the export button.<BR><BR>
71<B>Nota: Using the log - When there is no submesh: </B>
72Open the Maxscript Listener ("MaxScript/Maxscript Listener" or "F11"), You should see a log.
73You should verify that there is the number of submeshes you expect, <U>especially when you have not
74any submesh</U>. 3dsmax sets 6 material Id when a mesh is created, I think. So if you see lots of submeshes,
75just set the material ID in subobject mode.
76<BR><BR>
77
78
79<B>Nota: material names : </B>
80As you can see if you open the .mesh.xml file which has been written, submesh material names are materialname/*
81where * is a sub material name. If you forget this, you may have an "material not found" error at runtime.<BR>
82
83So our materials are called: skateboard_board/board, skateboard_board/wheels, skateboard_board/trucks.
84
85Here is the material file you have to write (in any .material file in the Media directory)
86<PRE>
87material skateboard_board/board_#132
88{
89    technique
90    {
91        pass
92        {
93            ambient 0.588 0.588 0.588
94            diffuse 0.588 0.588 0.588
95            specular 0.9 0.9 0.9 0.0
96            emissive 0.0 0.0 0.0
97            texture_unit
98            {
99                texture skateboard.png
100            }
101        }
102    }
103}
104
105material skateboard_board/wheels
106{
107    technique
108    {
109        pass
110        {
111            ambient 0.796079 0.780392 0.588235
112            diffuse 0.796079 0.780392 0.588235
113            specular 0.9 0.9 0.9 0.0
114            emissive 0.0 0.0 0.0
115        }
116    }
117}
118
119material skateboard_board/trucks
120{
121    technique
122    {
123        pass
124        {
125            ambient 0.737255 0.737255 0.737255
126            diffuse 0.737255 0.737255 0.737255
127            specular 0.9 0.9 0.9 0.0
128            emissive 0.0 0.0 0.0
129        }
130    }
131}
132</PRE>
133
134But, read the next section before doing this ;) .
135
136<H4> Run the material exporter</H4>
137
138No run the material exporter in the Ogre Toolbar. (If you don't find the material exporter button, have a look
139<A href="../ToolBar/index.html">here</A>) <BR>It can only (but it's sufficient) export MultiMaterials and Standard Materials.
140
141<UL>
142<LI> It adds /* to material names. </LI>
143<LI> It retrieves the Diffuse map of submaterials, or if it is undefined, it uses ambient, diffuse, etc. colors.</LI>
144</UL>
145
146You should see the following window: <BR>
147<img src="images/materialtools.jpg" /> <BR>
148<BR>
149Click on "Pick material", choose Scene in the right panel, and choose the snowboard_board material.<BR>
150<img src="images/choosemultimaterial.jpg" /> <BR>
151
152Click on 'Ok' button in order to select the material you want to export.<BR>
153
154Select instance in the popup, <BR>
155Choose an output filename (in the OGRE Media directory), <BR>
156Press the Export button. <BR>
157<BR>
158There is an other button which allow you to export all the materials used in the scene.<BR>
159
160<BR><B> That's all ! Have fun with this exporter !</B><BR><BR>
161
162<CENTER>
163<A href="../../index.html">Return to homepage</A>
164</CENTER>
165<BR>
166<BR>
167If you have seen any errors or have any suggestions, mail me at mallard@iie.cnam.fr.
168
169</BODY>
170</HTML>
Note: See TracBrowser for help on using the repository browser.