Go Back   AC3D Forums > General > AC3D General
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12th August 2005, 08:18 AM   #1
M1ka
Junior Member
Junior member
 
Join Date: Aug 2005
Posts: 4
Default Exporting to .x

Hi all,

I have a problem exporting meshes to .x files:

Even if I (re-)center the object center, when I import the mesh to my DirectX app, the object rotates strangely.

I tested this by creating a 1 x 1 x 1 size cube, centered in origin.

If I rotate it about the z-axis, the rotation center seems to be off a bit, so the cube appears to move. When I do the same thing with a cube created with the mesh viewer that comes with the DirectX SDK, it rotates perfectly around the center.

I calculate the bounding box for the mesh with the D3DX function D3DXComputeBoundingBox, and then I calculate the center by
cnt = (min + max) / 2

Since I'm quite new to DirectX the bug is probably in my code. Does anyone have any idea of how to fix this?

Thanks,

M
M1ka is offline   Reply With Quote
Old 15th August 2005, 09:12 AM   #2
M1ka
Junior Member
Junior member
 
Join Date: Aug 2005
Posts: 4
Default

In addition to my previous post: if I select the "Triangles only" option for exporting I get a bounding box like this:

Min = (-1, -1, -1), Max = (1, 0.5, 1)

and if I uncheck it I get

Min = (-1, -0.5, -1), Max = (1, 1, 1)

Strange. When I look at the .x file in notepad, there seems to be nothing that would explain this. Maybe someone who understands the .x file format better could...

M.
M1ka is offline   Reply With Quote
Old 17th August 2005, 09:04 PM   #3
Razer
Senior Member
Professional user
 
Join Date: Aug 2003
Posts: 194
Default

this is going to be important to people working on new cars for GT Legends. The cars are in X format and I did a quick test with a prelude model i've been working on and other then a bit of a texture problem AC3D did work to export the file enough so the car viewer could read it. don't know about the game.
__________________
Tony "Razer" Martin
3D/2D Artist
SDOP-Warbirds
Razer is offline   Reply With Quote
Old 18th August 2005, 03:20 AM   #4
M1ka
Junior Member
Junior member
 
Join Date: Aug 2005
Posts: 4
Default

I found a workaround: if I create the cube in larger size, (e.g. 5 x 5 x 5) then the bounding box comes out as expected.

So I guess the small size is something to be avoided. In fact, the .3ds to .x converter that came with some previous version included an option to scale all objects in the scene.
M1ka is offline   Reply With Quote
Old 23rd August 2005, 05:13 PM   #5
FRAME
Member
Expert member
 
Join Date: Jun 2003
Location: Löhne, Germany
Posts: 58
Default

I have created a simple 1x1x1 cube with AC3D and exported it to an DirectX file. I also created the same cube with the mesh viewer of the DXSDK.

There are not any differences which could cause this problem.
The data in both files are all right and do not show any rounding errors.

Perhaps the second frame of the AC3D-DirectX file causes a rounding error in your program ? This rather happens at calculations with zero values than at calculations with larger numbers. ( The cube is centered at 0,0,0. )

Frank
FRAME is offline   Reply With Quote
Old 24th August 2005, 02:09 AM   #6
M1ka
Junior Member
Junior member
 
Join Date: Aug 2005
Posts: 4
Default

Eh... what are frames?

M.
M1ka is offline   Reply With Quote
Old 24th August 2005, 10:28 AM   #7
FRAME
Member
Expert member
 
Join Date: Jun 2003
Location: Löhne, Germany
Posts: 58
Default

The default setting of the DirectX exporter is to create a frame for each AC3D object and group.

In the normal case the mesh vertices are relative to its origin (or another special point). So the meshes and other frames inside the frame can be moved/rotated/sized with a single transformation matrix which is part of a frame.

For example :
A car has four wheels ( in most cases :? ). Each wheel has the same mesh data (vertices) but in different frames. So it is only necessary to change the transformation matrices to rotate or move the wheels.

Another example :
'DarkBASIC' ( an easy to use 3D programming language. Perhaps somebody knows it ) uses every frame of a X file as a single 'limb'. These limbs then can be moved ( rotated, ... ) by simple commands.

AC3D X files have an additional 'WORLD' frame for all objects. So the whole file can be recognized in other programs as a single object.

However, these multiple calculations by several frames should not cause any visible movings or distortions.

Frank
FRAME is offline   Reply With Quote
Old 21st February 2008, 12:31 PM   #8
Keith Sweeting
Junior Member
Junior member
 
Join Date: Feb 2008
Posts: 7
Default Re: Exporting to .x

I purchased AC3D primarily to make and add models to a piece of software called "Rule the Rail" (I know its boring), in UK it is called "Create your own model railway"

The "Rule the rail" forum suggests that all you need to do is export in DirectX file. Me being extremely naive thought that it was easy!!!

I have compared two DirectX files one from the software (RTR X file) and a similar exported version of a similar size model from AC3D in Notepad and they look totally different. It would seem that the data is in separate groupings. I have tried various settings in the DirectX export screen, but to no avail.

Are there any folks ou there that can tell me where I am going wrong. Maybe the settings can be changed, so that the "Rule the Rail software can accept my model?
At the moment I have checked the following: "Frames only for groups", Right handed coordinate systems, "invert face orientation" and Flip normals. But in Notepad my exported DirectX file looks nothing like the one from "Rule the rail".
Any guidance will be gratefully received.:
Keith Sweeting is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 08:42 PM.


AC3D Forum
(C) Inivis Limited 2020