UPDATE 2: It now appears this is more of a modelling issue than a programming one. Whoops.
I'm new to XNA development, and despite my C# experience, I've been stuck at one spot for going on two days now.
The situation: I've created a model in 3D Studio Max 2010 which uses two materials, both are of type DirectX Shader. The model exports to FBX without error and Visual Studio compiles it properly. When I ran the Draw() method initially, it threw an exception on the 'BasicEffect' portion of one of my loops, demonstrating (at least to me) that it was loading the .fx file correctly, which must be embedded in the FBX file or something.
The problem: When using the following code
foreach (ModelMesh mesh in map.Meshes)
{
foreach (Effect effect in mesh.Effects)
{
effect.CurrentTechnique = effect.Techniques["DefaultTechnique"];
effect.Begin();
effect.Parameters["World"].SetValue(Matrix.CreateTranslation(Vector3.Zero));
effect.Parameters["View"].SetValue(ActiveCamera.ViewMatrix);
effect.Parameters["Projection"].SetValue(ActiveCamera.ProjectionMatrix);
effect.Parameters["WorldViewProj"].SetValue(Matrix.Identity * ActiveCamera.ProjectionMatrix);
effect.Parameters["WorldView"].SetValue(Matrix.Identity * ActiveCamera.ViewMatrix);
foreach (EffectPass ep in effect.CurrentTechnique.Passes)
{
ep.Begin();
// something goes here?
ep.End();
}
effect.End();
}
mesh.Draw();
}
The only thing that happens is a white box appears covering the bottom half of the screen, regardless of camera position or angle. I got the name of the effect parameters of the default.fx file specified in Max (it's at [program files]\autodesk\3ds Max 2010\maps\fx).
I get the feeling I'm setting one or all of these incorrectly. I've tried to look up tutorials and follow their code, however none of it seems to work for my model.
Any help or ideas?
UPDATE: By making these changes:
effect.Parameters["WorldViewProj"].SetValue(Matrix.CreateTranslation(Vector3.Zero) * ActiveCamera.ViewMatrix * Conductor.ActiveCamera.ProjectionMatrix);
effect.Parameters["WorldView"].SetValue(Matrix.CreateTranslation(Vector3.Zero) * ActiveCamera.ViewMatrix);
The model was able to draw. However, everything is completely white :(