Jump to content
  • Advertisement
Sign in to follow this  
spiffycrony

Mesh.FromFile invalid coordinate values

This topic is 4086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am loading a mesh object with a directx x file as follows Dim mesh_ = Mesh.FromFile(MyBase.OutputFile, MeshFlags.Managed, device) When I get the vertex and check the coordinate values, some vertex coordinate values are NAN while the coordinate values in the x file are correct. I get it as follows mesh_ = mesh_.Clone(MeshFlags.Managed, VertexFormats.PositionNormal Or VertexFormats.Diffuse, direct3DDevice) Dim source() As CustomVertex.PositionNormalColored = mesh_.LockVertexBuffer(GetType(CustomVertex.PositionNormalColored), 0, mesh_.NumberVertices) Any clue of why some of the vertices coordinate values become NAN?

Share this post


Link to post
Share on other sites
Advertisement
Does the original mesh render correctly? If not, the problem really lies with the vertices. The only thing I can think of from the top of my hat would be that the vertex position elements are that large they don't fit into a float datatype (so they overflow the float). You can check if this is the case by comparing some vertex coordinates in your modelling app to Float.MaxValue.

If it is rendering correctly however, something might be going wrong with reading the vertex data. I don't know if MDX is smart enough to automatically convert a mesh with one FVF to another (simpler) FVF, but I doubt it since FVFs lack information about the order of the vertex elements. You might want to either try cloning with the vertex declaration/elements or inspecting the FVF of the original mesh and locking that with a suitable vertex struct.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!