XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Co-ords in exported X file not the correct scale!

Last post 05-12-2008 3:32 AM by BenS1. 2 replies.
  • 05-10-2008 5:11 AM

    Co-ords in exported X file not the correct scale!

    Earlier I posted in the General section to say that there was a problem with XNA not calculating the BoundingSphere correctly for my Mod Tool developed 3D models, whereas the BoundingSpheres for similar sized 3D objects from the Samples did appear correct.

    After a bit more investigation I can see what the problem is and I think its now more appropriate to post the details in this section as its more of a Mod Tool question now....

    So, the asteroid X file from the samples has a BoundingSphere with a radius of about 1500, whereas my Mod Tool developed ball (Sphere) which is roughly the same size has a BoundingSphere radius of about 4.

    The ball and the asteroid are approx the same size yet the radii are so different.

    Looking into the X files for each of the 2 object I think I can see the problem.

    For the asteroid the vertex co-ords really are in the range -1500 to +1500, and in the ball file they are only in the range -4 to +4. The ball file has the following at the top:

      FrameTransformMatrix {
    434.105743,0.000000,-0.000000,0.000000,0.000000,434.105743,0.000000,0.000000,0.000000,0.000000,434.105743,0.000000,0.000000,0.000000,0.000000,1.000000;;
    }

    It looks to me like when I scaled the ball in Mod Tool, rather than actually updating the verticies, it kept the verticies the same and just stored a scaling transform alongside them.

    Whilst the XNA ContentManager seems to apply the scaling transform at load time so taht it displays at the correct time, the XNA Model.Mech.BoundingSphere method doesn't take this transform into account!

    Is there a way to get Mod Tool to apply the scaling to the actual verticies themselves, so that actual vertex data is the correct size without the need to apply a scaling transform?

    Thanks
    Ben


  • 05-10-2008 5:24 PM In reply to

    Re: Co-ords in exported X file not the correct scale!

    I just calculate my own bounding sphere and bounding box.

    However, are you sure the importer actually applies the transform? You can animate the transforms (they end up being bone matrices). If you draw the model using all identity bones, will the ball be very small?

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 05-12-2008 3:32 AM In reply to

    Re: Co-ords in exported X file not the correct scale!

    Sure I could calc my own boundingsphere/box but I'd still like to understand why the Mesh.BoundingSphere method isn't working. Maybe I'm doing something wrong so I'd like to learn what that is.

    Yes XNA must be applying the scaling transform, otherwise the ball would be far too small to be displayed on screen. 1 pixel at best.

    Do you know if there is a kind of "Flatten Transforms" option in Mod Tool, so that it actually updates the verticies themselves?

    Thanks
    Ben

Page 1 of 1 (3 items) Previous Next