   XNA model picking weirdness
  Hey guys!  I've been stumped on thsi for a while, and am hoping one of you could enlighten me on a solution!  I was trying to incorporate the XNA triangle picking example in my editor so I can start collision detection against static models.  Currently I have it working fine for my dungeon nav meshes but I believe that's because the world matrix for those are always Matrix.Identity.The problem is trying to get it working on just plain static models I have around the world (trees, buildings, etc).  I've been using Blender to create models and, well, nothing seems to be consistent with what that program spits out but so far I have the models I've created being positioned correctly (with much tinkering).For testing I just exported the cube that Blender starts with as an fbx file and loaded it in my game.  It is drawn and positioned where I expect it but when I outline the polygons that my ray intersects, well, the "ghost" cube is HUGE.  Like 100x what the real cube is.As for the world matrix I'm using, at first I tried using the same world matrix that I use to draw the actual cube but that didn't even work so I just did Matrix.CreateTranslation(positionOfCubeInWorld) which seems to work...but I have a feeling that is part of the problem, but heck if I can think of a solution.Sorry for the long post but if anyone can point me in some direction I could try, I'd appreciate it! :)   
  Alrighty! Well, I found the culprit!  When exporting from Blender, I was using the default fbx exporter which for some reason, messes things up.  I switched to the script written specifically for xna and now my code works! But a new problem has arisen.  None of my models (using new exporter) are being affected by lighting.  The textures are showing 100% with no shading.  Using the default fbx exporter had correct lighting...If anyone knows how to fix this, please let me know :)   ;Quote:Original post by belgrethBut a new problem has arisen.  None of my models (using new exporter) are being affected by lighting.  The textures are showing 100% with no shading.  Using the default fbx exporter had correct lighting...If anyone knows how to fix this, please let me know :)What does your model drawing function look like? Here's one you can compare to. It simply draws model at a position and rotation given a view and projection matrix.public void Draw(Model model, float scale, Vector3 position, Matrix viewMatrix, Matrix projectionMatrix) {   foreach (ModelMesh mesh in model)   { foreach (BasicEffect effect in mesh.Effects) {    effect.EnableDefaultLighting();    effect.PreferPerPixelLighting = true;    effect.Projection = projectionMatrix;    effect.View = viewMatrix;    effect.World = Matrix.CreateScale(scale) *Matrix.CreateTranslation(position); } mesh.Draw();   }}Also, check the materials in your .fbx file. You can manually edit the .fbx file in Visual Studio if you exported it in ascii format. Here's some some starting values that look decent in the XNA default lighting shader:    Material: "Material::tex_01", "" {   Version: 102   ShadingModel: "phong"   MultiLayer: 0   Properties60:  {  Property: "ShadingModel", "KString", "", "Phong"  Property: "MultiLayer", "bool", "",0  Property: "EmissiveColor", "ColorRGB", "",0,0,0  Property: "EmissiveFactor", "double", "",0  Property: "AmbientColor", "ColorRGB", "",0,0,0  Property: "AmbientFactor", "double", "",0  Property: "DiffuseColor", "ColorRGB", "",1,1,1  Property: "DiffuseFactor", "double", "",1  Property: "Bump", "Vector3D", "",0,0,0  Property: "NormalMap", "Vector3D", "",0,0,0  Property: "TransparentColor", "ColorRGB", "",0,0,0  Property: "TransparencyFactor", "double", "",0   Property: "SpecularColor", "ColorRGB", "",1,1,1  Property: "SpecularFactor", "double", "",1  Property: "ShininessExponent", "double", "",32  Property: "ReflectionColor", "ColorRGB", "",0,0,0  Property: "ReflectionFactor", "double", "",0.  Property: "Emissive", "Vector3D", "",0,0,0  Property: "Ambient", "Vector3D", "",0,0,0  Property: "Diffuse", "Vector3D", "",1,1,1   Property: "Specular", "Vector3D", "",1,1,1  Property: "Shininess", "double", "",32  Property: "Opacity", "double", "",1  Property: "Reflectivity", "double", "",0Mainly you want to play with diffuse, ambient, specular, and shininess. Not sure if any other values are considered by the DefaultLighting shader. Oh and does your model have normals? That might break lighting too.[Edited by - EJH on April 6, 2010 6:09:19 AM]