Units are transform on export (SOLVED)

feanor91

05-09-2008 07:11:22

Hello

I have a strange behavior with 1.8.6 CE version.

Under max I set my units in meters. When I export my scene, units are multyplied by 100 so I obtain units in centimeters. Apparently, this cause problems with newton and gravity behavior. So why a such behavior with oFusion? Is there a way to export in meters?

Evak

05-09-2008 07:51:05

If I remember right you need to change the 3dsmax system unit setting. By default it's something like 1 unit = 1inch or something. Change it to something that makes sense like 1 unit = 1 meter.

feanor91

05-09-2008 07:57:26

Yes, I know, it's what I made since beginning of my project to have a good way to construct my scene and way before to begin to work with Ogre, and look :

The begining of exported scene with oFusion :

<oe_scene>
<sceneManager type="5" />
<bkgcolor r="0" g="0.772549" b="0.909804" />
<lightColor r="0.74902" g="0.74902" b="0.74902" />
<shadowTechnique type="0" tex_size="512" tex_count="6">
<color r="0.807843" g="0.807843" b="0.807843" />
</shadowTechnique>
<entities>
<entity name="Sol" hidden="false" filename="Sol.mesh" CastShadows="no" ReceiveShadows="yes">
<position x="-713.76123" y="-78.478394" z="-135.56821" />
<rotation x="-2.5121481e-015" y="0.70710683" z="6.1817239e-008" w="-0.70710671" />
<scale x="4.5760565" y="2.2243831" z="4.5760565" />
</entity>
<entity name="Box03" hidden="false" filename="Box03.mesh" CastShadows="no" ReceiveShadows="yes">
<position x="-732.71014" y="-101.18311" z="-1574.4418" />
<rotation x="-2.5121481e-015" y="0.70710683" z="6.1817239e-008" w="-0.70710671" />
<scale x="2.1439981" y="1" z="2.1439981" />
</entity>
<entity name="Box04" hidden="false" filename="Box04.mesh" CastShadows="no" ReceiveShadows="yes">
<position x="-2136.0776" y="-117.51532" z="-145.7655" />
<rotation x="-2.8033187e-010" y="0.99999803" z="4.2005857e-011" w="-0.0019628468" />
<scale x="2.0572276" y="2.0060656" z="2.2257905" />
</entity>


Same thing exported with OgreMax and OgreMax units set to meters in it's parameters :

<scene formatVersion="1.0" upAxis="y" unitsPerMeter="1" unitType="meters" minOgreVersion="1.4" author="OgreMax Scene Exporter by Derek Nedelman (www.ogremax.com)">
<environment>
<colourAmbient r="0.803922" g="0.803922" b="0.803922" />
<colourBackground r="0" g="0.796079" b="0.803922" />
</environment>
<nodes>
<node name="Sol">
<scale x="4.57606" y="2.22438" z="4.57606" />
<position x="-7.13761" y="-0.784784" z="-1.35568" />
<rotation qx="0" qy="-0.707107" qz="-6.18172e-008" qw="0.707107" />
<entity name="Sol" id="304" meshFile="Sol.mesh" castShadows="false" receiveShadows="true">
<subentities>
<subentity index="0" materialName="Sol" />
</subentities>
</entity>
</node>
<node name="Box03">
<scale x="2.144" y="1" z="2.144" />
<position x="-7.3271" y="-1.01183" z="-15.7444" />
<rotation qx="0" qy="-0.707107" qz="-6.18172e-008" qw="0.707107" />
<entity name="Box03" id="305" meshFile="Box03.mesh" castShadows="false" receiveShadows="true">
<subentities>
<subentity index="0" materialName="MursDeBriques" />
</subentities>
</entity>
</node>

Evak

05-09-2008 17:22:29

You must have scaled the mesh at some time in the past with the uniform scale tool. 3dsmax doesn't track the scale of a mesh at all when you use the scale tool. Internaly in 3dsmax it doesn't make a difference, so if you used scale at all, on export to games you have to reset the xforms and collapse the stack (utilities tab in the control panel)

If that doesn't work, theres reset position and scale in the heirarchy panel) usualy the reset xform is all you need. It's best to start a project with your scale already determined and stick to it without using scale. That way you never have to reset anything and can keep your modifier stack right till the end when you want your final game media exported.

You don't even need to then, but if you don't collapse the stack you can end up with bloated meshes that are inefficient because of extra data still stored in the exported mesh.

(I've used the above in several game engines since 3ds max has always behaved like this.

feanor91

05-09-2008 17:38:21

OK, I'm not sure to have understand what you say....I will investigate this way.

I did not understand the link between position and scale. But netherless, I will conduct test.

When you speak of the uniform scal tools tou talk about what? The icon in the toolbar to scale things or another tool?

Thanks.

Evak

05-09-2008 18:16:19

yeah the scale button in the main toolbar at across the top. That's the scale tool which doesn't register and is probably causing your problems with ofusion and ogremax.

http://www.ofusiontechnologies.com/supp ... _id=2&id=7

You can see where reset scale in this image I found. See button bottom left of the control panel. this should fix your scale problem.

Lioric

05-09-2008 18:28:37

A unit (whatever you want it to be) as defined in Max == to a unit in your Ogre application

There is no need to set any specific unit type, you can use any that you need, you just need to be consistent in your scene size and in your whole application

Your issue is because in Max you can set the 'System unit' (internally the scene scale) and the 'Display Unit' (the unit type in the viewports) and it seems you have the System unit in cm's and the display unit in meters

Its adviced to set only the 'System Unit Setup' to the unit type you need (in your case meters) and mantain the 'Display Unit Scale' in "Generic Units"

That way your viewports will display the correct size, being this of any type you have defined

feanor91

05-09-2008 18:40:32

OK, but how scale object if needed if we can't use scale tool?

feanor91

05-09-2008 19:05:53

Whaou...it's outstanding. I set the system units as you say, it was in cm, I pass it in meters (a 3ds feature that I do not know...) I reset scale then transform, and my scene in ofusion viewport is totaly broken meanwhile she's not in 3ds viewport...Look :



And how can I change dimension and position of objects, because for max they are well positionned....There's something strange here.

Lioric

05-09-2008 19:50:42

You dont need to rescale anything, just open the 'Customize' menu and in the 'Units Setup' set your 'Generic Units' then click 'System Units Setup' and set meters

If needed, select all objects then in the Utilities panel click 'Reset XForm' and click on 'selected', update your scene in the preview viewport

feanor91

05-09-2008 20:04:52

OK, I solved the problem by set up system units in meters, then reloaded my scene, and all work fine (exept Newton, but tis is another story....)

Thanks a lot.