3d coordinates - help needed

Discussion in 'Game Development (Technical)' started by Slayerizer, Nov 21, 2006.

  1. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    Hi
    I'm trying to use three 3d models in my game. I converted the models from .3ds to .fbx format, to make them work with the XNA SDK. My problem is that the three models seems to be pointing in three different orientations. How should I fix this? Should I open 3DSMax and change the orientation? I tried and failed to achieve this. I tried to correct the orientation from my code but It gave me another problem.

    I included a screen shot. Normally when I load the two ships, the first one is fine and the second one appear upside-down. In this image, I applied a rotation to the second ship to make it appear correctly. I have code to make the ship roll on the side when you go LEFT or RIGHT with the joystick. The problem I'm having, is that when I move the left ship, it works as expected, but the right ship, the transformation seems to be inverted. When I move my joystick left, the ship is moving left (but appears like it's rolling on the right) and when I move right, the ship moves to the right (but the object is rolling on the left)

    pleasssssssse help!
     

    Attached Files:

  2. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    AFAIK 3D Studio MAX uses a X=right, Y=depth and Z=up coordinate system, which is different than the Direct3D X=right, Y=up and Z=depth. Personally when i was converting 3DS file to my own format, i was applying a rotation matrix to "fix" the issue.

    As for the differencies: are you sure that those two 3DS files have the planes in the same orientation?
     
  3. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    In C++ I was using my handling my own format but with XNA I decided I'm using .fbx. To answer you question, NO, when I load the 3 objects in 3ds, they are not aligned the same way. I don't know how to fix this.

    :eek:
     
  4. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    AFAIK (again :p) 3DS files have a "coordinates" or "matrix" chunk. I never used the info in that, but there has to be some reason for it's existence, which i assume is to say which coordinate system it uses :).

    If it is a matrix chunk, i think that applying that matrix to the model (before rotating to make Y go up), may solve the problem.
     
  5. bignobody

    Indie Author

    Joined:
    Aug 13, 2005
    Messages:
    387
    Likes Received:
    0
    I would try importing the original .3ds files into Wings3D, align them all the the center and make sure they oriented the same way. Then re-export as 3ds and run them through your .fbx converter again.
     
  6. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    thankkkkkks man! I don't know why I've lost my textures during the
    Wings' import but I was able to fix the orientation definitely. I re-assigned the textures once I imported the models back in 3DSMax.

    It's now working as expected..

    I wish I knew a way to do it in Max.
     
  7. bignobody

    Indie Author

    Joined:
    Aug 13, 2005
    Messages:
    387
    Likes Received:
    0
    Glad it worked out for you. I don't have Max, but there must be a way to align/center your models - it seems like pretty basic functionality...
     
  8. Applewood

    Moderator Original Member Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    3,859
    Likes Received:
    2
    :mad: You'd think so, wouldn't you.

    There is a whole swathe of shit in there for transforms. Eulers, Quaternions, Scaling and non-scaling matrices can all be applied to the model, its pivot, its parent in backwards direction, it's space-warp or any/all of the above. Oh, and don't forget the time step and any special bones or other plugins that also might have a poke at it.

    To make a rock-solid exporter will take you forever. When you think you've nailed it, along comes a new piece of art to screw you.

    Personally, I think the SDK authors should be shot. Writing code like that should surely be a sackable offence.
     
  9. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    I'm visually able to rotate my models in 3dsmax. In max, when I export and reload them, they seems fine. When I use XNA's built-in functions, they are still wrong.

    With Wings, I see the models exactly the way they are loaded with XNA, but when I rotate the objects and save them, they stay that way.

    I'm glad I don't use any complicated models. I wish I could find how to deal with that issue from 3dsmax.
     
  10. voxel

    voxel New Member

    Joined:
    Oct 29, 2006
    Messages:
    176
    Likes Received:
    0
    Normally just rotating the object in Max should solve the problem (90 degrees on the x axis so Y is "up")...

    But it sounds like other problems: left-hand vs. right-hand co-ordinate mis-match. I would have thought FBX exporters would have convert this by default. Still, without more detailed information (i.e is this your own FBX exporter? Or the one from Autodesk?) I'm shooting in the dark.
     
  11. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    I'm using these objects (SpaceFighter01-02-03)

    objects
    and I worked with the FBX exporter supplied with 3dsmax.
     
  12. Slayerizer

    Original Member

    Joined:
    Dec 13, 2004
    Messages:
    103
    Likes Received:
    0
    My problem doesn't seem to be related to XNA. I have included two images.
    When I load ship1 and ship2 (model-max.jpg) you can see that they aren't in the same direction. I select the rotate transform widget and rotate on Z=180 for my ship2 and they end up being in the same direction.

    I now have a problem without even exporting the objects.

    To simulate what I'm doing from XNA, I select my ship01 (in 3dstudio) and tell it to rotate on the 45 degrees on X axis. I do the same thing with ship2 and even if I do a +45 degrees rotation on X axis, my ship02 turns in the wrong direction (looks like its turned -45 deg on X).

    the only difference is that ship02 already have a 180deg rotation on Z.

    Is there a way to make the Z rotation permanent on the object data without using an external software like Wings?

    thanks
     

    Attached Files:

  13. zoombapup

    Moderator Original Member

    Joined:
    Nov 25, 2004
    Messages:
    2,890
    Likes Received:
    0
    Try using "reset transform" its a box on the right hand side in the modify rollout I believe.

    Also do a google for "box trick 3ds max". Apparently there can be some transforms left in max's transform stack that the box trick fixes..
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer