Sign in to follow this  

Mesh.FromFile invalid coordinate values

This topic is 3875 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
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

This topic is 3875 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this