Effect problem

Sep 13, 2012 at 11:49 AM

Hello!

First let me say I am very impressed by ANX. A truly amazing effort. I also absolutely understand it is still in early development, and considering that I am even more impressed by the level of functionality already present.

Now to my problem. I am running XNA with VS 2010 Express(C#) and ANX with VS 2012.
I export a FBX-file from 3DSMax and then use XNA to convert it to the xnb-format. The file looks ok in XNA, but in ANX there is a problem. If the file has only one mesh everything is ok even in ANX. But if it contains 2 or more meshes, only the first mesh looks ok. Mesh no. 2 has all its faces "flatted out" - it looks almost like an UV-map, but the faces are somewhat overlapping. Here are screenshots of how it looks:

XNA ScreenShot

ANX ScreenSHot

Both the teapot and the cone are in one fbx-file. They are not linked in any hierarchy, just positioned as you see on the XNA screenshot.

The code for XNA and ANX is identical. I am using DirectX 10 in ANX.

The drawing code:

protected override void Draw(GameTime gameTime)       
{           
GraphicsDevice.Clear(Color.CornflowerBlue);           

// Copy any parent transforms.           
Matrix[] transforms = new Matrix[_Model.Bones.Count];
_Model.CopyAbsoluteBoneTransformsTo(transforms);
// Draw the model. A model can have multiple meshes, so loop.           
foreach (ModelMesh mesh in _Model.Meshes)           
{               
// This is where the mesh orientation is set, as well                
// as our camera and projection.               
foreach (BasicEffect effect in mesh.Effects)               
{                   
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *                        Matrix.CreateRotationY(modelRotation)  * Matrix.CreateTranslation(modelPosition);                   
effect.View = Matrix.CreateLookAt(cameraPosition,
new Vector3(0f,10f,0f), Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(                        MathHelper.ToRadians(45.0f), aspectRatio, 
1.0f, 10000.0f);
}               
// Draw the mesh, using the effects set above.               
mesh.Draw();
}
base.Draw(gameTime);
}

Hope someone have an idea on what is going on. My guess is some problem with the shader (effect) when transforming the vertices of mesh no. 2.

Best regards
///JmD 

Coordinator
Sep 13, 2012 at 12:26 PM

Which version are you using? The binary version or the source version (which revision)?

Are you able to provide the FBX file and maybe the shader? This will help us with debugging. If you sent the files by email it will be confidential.

 

Sep 13, 2012 at 1:11 PM
Edited Sep 13, 2012 at 1:15 PM

Hello - impressively quick reply!

I've built from the source version - revision seems to be 17958 (for the complete repository) and 17951 for the Framework. I checked it out the day before yesterday and did an update yesterday, but there were nothing new then.

I can send you both the FBX and XNB-fil - what is the email adress? There is nothing confidential about the content.

I don't use any specific shader - I just use the BasicEffect in ANX.

Best Regards
///JmD 

Sep 13, 2012 at 2:00 PM

The same funny model rendering of the tank.fbx from this sample http://xbox.create.msdn.com/downloads/?id=495&filename=BloomSample_4_0.zip. I mean just a model. It looks like a puzzle from many mesh parts of the model placed in wrong locations.

Coordinator
Sep 13, 2012 at 2:04 PM

Ok, I will use this model as reference... Thank you...

 

Sep 19, 2012 at 11:18 AM
Edited Sep 19, 2012 at 11:18 AM

Have you been able to test and see what the problem is with rendering multiple mesh models?

Best Regards
///JmD 

Coordinator
Sep 19, 2012 at 12:23 PM

Not yet, I'm sorry... I'm currently fixing the Metro rendering and building. After that (I'll hope this weekend) I will have a look at model rendering and primitive rendering.

Sep 19, 2012 at 1:45 PM

Quick reply - as usual :-)

Oh, I understand that you are more than busy. I just wanted to make sure there wasn't some information I've missed.
Keep up the good work - your efforts are truly impressive.

Best Regards
///JmD 

Coordinator
Sep 20, 2012 at 7:19 AM

I think this was a problem with a wrong VertexBufferBinding Vertex-Offset. See http://anxframework.codeplex.com/workitem/1005 

Are you able to test if the source revision #18143 fix this problem?

 

Sep 20, 2012 at 9:19 PM

I just updated my local repository to the latest version, and now multi mesh rendering seems to work. Thanx alot - I'm now a really happy camper :-)

 

Best Regards
///JmD