Troubleshooting this TutorialSometimes, even though you try hard to understand the information in a tutorial, things don't work out quite like you want it to. This page is here to help you resolve any problems you might be having with the tutorial on using 3D models in MonoGame. The Common Mistakes section describes common problems that people have when doing the things in this tutorial, and how to resolve them. The Frequently Asked Questions section describes questions that people have that aren't related to mistakes, but rather, trying to understand the stuff better or exploring how it can be used. If your problem or concern isn't addressed here, feel free to add a comment below, so that I know where you're having trouble. I like to keep these pages fairly clean, so I may remove comments that I felt like have been addressed. If I remove your comment and you don't feel like the problem has been fixed, repost the question and we'll take another look at it. If a tutorial has a mistake in it, I will fix the mistake and reply to the comment with a brief explanation. However, after a couple of weeks I'll likely go back and remove the original comment as well as my reply, because, hopefully, the problem will have been fixed, and it won't be a concern any more. |
Common MistakesNone listed yet… |
Frequently Asked QuestionsNone listed yet… |
I have followed all the steps in the tutorial, but all I can see ist a rotating mesh without colors or textures. What is missing?
I just rechecked everything; it should be working.
The first thing that comes to my mind is that the image for the texture isn't being copied in to the right spot. I'd start by double checking that.
The other possibility is that somehow, the texture coordinates or texture information didn't get saved when you created your 3D model file. (What format is it in, by the way?) So it could just be a problem with the model that you can fix.
One way to test that out might be to try loading in a model that is known to work. For instance, go here and download the beach ball model near the top. I was able to get this to work just barely.
Hi, thank you for your hints. Indeed I got the beach ball model working. I have generated fbx files from blender that do not contain textures obviously.
Do you have a hint on how to add textures to a .fbx or .x file or how to apply textures programmatically?
I've just gone through the tutorial "Using 3D Model" and with the "Simple Ship" model everything works just fine.
but when i changed the model to "psp" or helicopter , things just went south .
The psp becomes totally white , and i'm not sure if it's still 3D.
The helicopter's propeller appears inside the body of the helicopter ..
I don't know where i did wrong ..
This website doesn't allow me to post url directly , so i can't show you the issue directly ..
By the way , beach ball works well too.. so i am not sure if it's the coding problem or anything else that causes the failure in psp and helicopter
I haven't done this particular tutorial, but I've seen similar stuff like this before. It sounds like there's some problems with the mesh itself. The helo blades would be a separate piece within the mesh since they would need to be animated to spin independently. Since they are a separate piece, they are being rendered at the world center, as is the helo itself, causing the blades to appear in the middle of the helo. I can't speak to the other models, although the white appearance on the psp sounds like texturing/material issues.
With that being said, although I call these 'problems' with the mesh/model, that is a little of a misnomer. Truth is, the mesh/model is probably fine, but the tutorial doesn't cover all the stuff needed to render the individual meshes within the model.
You can test to see if this is the case by finding another, simple, one piece model, and trying to render that. If it comes out correctly, then there are rendering issues. Sorry I know this doesn't help much, but maybe we can get some input from RB when he's able to come back around. He's in the middle of a bunch of stuff right now, so it may be a couple days or a week before he can get back with us.
"May the mercy of His Divine Shadow fall upon you." - Stanley H. Tweedle, Security Guard class IV, The League of 20,000 planets
thanks for replying !
Like i said, model "BeachBall" works fine so i guess it's the problem with mesh , like you've mentioned, I do think it's because the helicopter's blade and its body are separated parts so that when i draw them with mesh , their center point was placed at the same point,and that causes the blades appears inside the body .
About the white psp i'm not so sure about what's wrong , i've check the .fbx file , the model itself doesn't have a color,it's a pure white psp model , but at least it's 3D,you can identify those buttons, you can see the screen.But when drawn in the program , it's a 2D picture , looking like a projection.
PiscesMike is right. The PSP model has no texture. I don't even think it has texture coordinates. That's why it shows up in white. If you call the BasicEffect's EnableDefaultLighting method, it won't look so flat. The lighting adds a lot, and it will be clear it has a shape.
The helicopter model, as PiscesMike guessed, has multiple meshes, and they need to be transformed by the matrix of the mesh's "bone" that it's attached to, or they'll all be drawn in a pile. When you set up the World matrix as you're drawing the mesh, you'll have to multiply the object's location with mesh.ParentBone.Transform, which will put it in the right spot.
With regard to what you said at the beginning about being able to post links… it's a Wikidot thing. You need to get enough "karma" by making posts and stuff. After a little bit, it will allow you to start posting links. I wish I had more control over it. I wish I could pick people and give them rights to post links, but I can't, at least not right now.
Anyway, let us know if multiplying the world matrix by the parent bone transformation fixes the problem for you. Good luck!
Thanks a lot !
Adding the BasicEffect's EnableDefaultLighting method makes the PSP looks better , but it's still missing a couple of buttons.
But after multiplying the object's location with mesh.ParentBone.Transform , the PSP looks exactly the same as in the .fbx file, and the helicopter's blades appears appropriately.
So is this means that the matrix mesh.ParentBone.Transform stores information about relationship between meshes in one model ? Relationship like parent and child ?
I'm still trying to figure out what's behind those multiplication , but i'm really poor in linear algebra ..
Again many thanks for replying me ! Great tutorial by the way !
I just tried this tutorial. I know It is more than a year old, and MonoGame is moving fast, but I wanted to let you know that the simple ship mesh is not supported anymore? I am using Visual Studio 2013 and Monogame 3.4. When I try to add simple ship (ship.fbx) to my content and build it gives me the error:
C:/Data/Game Programming/git/DungeonCrawlDemo1/DungeonCrawlDemo1/Content/Ship.fbx: error: Importer 'FbxImporter' had unexpected failure!
Assimp.AssimpException: Error importing file: FBX-DOM unsupported, old format version, supported are only FBX 2011, FBX 2012 and FBX 2013
Thanks for putting these little tutorials together! I have not done any game programming since XNA, and it was nice to have a bit of a refresher. :)
Hello there (almost six years from the future(1)),
Using Ship.fbx too, I had a different error message, although I believe this had to do with the file’s format being too old:
<game path>/Content/Ship.fbx : error : The source file '<game path>/Content/*0' does not exist! [ <game path>\MonPremierJeuEn3D.csproj]
Fortunately, after several hours spent today trying to solve this (I find out that technical installation/configuration of tools/assets is always what can take me a huge amount of time compared to really interesting things…), it turns out that converting the file to an up-to-date version works perfectly for me; I do not have the texture problem that ‘Alex (guest) 20 Jun 2016, 22:46’ encountered.
I used FBX Converter* (from Autodesk); see here for downloading:
autodesk . com/developer-network/platform-technologies/fbx-converter-archives?us_oa=dotcom-us&us_si=d9993464-7ef4-40c4-b999-f2cf70d0b472&us_st=FBX%20Convertor
Here is a page with some help (one short video), although I did not need it (converting a single file is rather intuitive):
knowledge.autodesk . com/search-result/caas/video/youtube/watch-v-9McOw1q238s.html?us_oa=dotcom-us&us_si=d9993464-7ef4-40c4-b999-f2cf70d0b472&us_st=FBX%20Convertor
* By the way, I found out about it thanks to MonoGame’s official documentation, but it turns out the link given to FBX Converter is outdated.
docs.monogame . net/articles/content/why_content_pipeline.html#models
→ codeproject . com/articles/1041397/updating-old-fbx-files-for-the-modern-era
The webpage also suggests an online converter, but it refused to even upload the file, so I guess (judging from this and my error message) that there is some serious problem in its binary (maybe the format declaration?). Nevertheless, it may be useful for other model format conversions. (Beware its link towards a converter/compression tool, it looks like the website is dangerous.)
greentoken . de/onlineconv/
(HYPER)LINK (because I realize there is a whole ‘karma’ system that prevents me from posting them in full form; I should have signed up *before* posting my previous comments around…):
(1) vimeo . com/116830715#t=16s
+ remove spaces in all URLs
I'm using MonoGame 3.5, along with Visual Studio Community 2015. All the 3D models seem to be "outdated" — the content tool is giving me errors telling me only files with the FBX 2011, 2012 and 2013 standards are supported. Using the Autodesk FBX Converter gives me correct fbx files, but I still have problems "building" the texture content for the ship — the converted fbx file somehow looks for the texture in the above folder, not the current Content one.
I'm going to try other fbx files.
I'm having issues with loading more than one model at a time. I'm using MonoGame 3.6 in OpenGL on Windows with VS2017.
When I load one, it looks great. I went back to an older version of 3.6 and it works fine. Seems to be a bug.
If I load another, it takes on the aspects of the first model. I've tried loading each model on its own, and it looks great. The mesh gets messed up, as does the UVs when I use more than one at a time. It is like the data is getting corrupt.
I've tried lots of things to fix this, to no avail. Such as:
Services.GraphicsDM.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
Services.GraphicsDM.GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicWrap;
Services.GraphicsDM.GraphicsDevice.BlendState = BlendState.Opaque;
Services.GraphicsDM.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Please help.
I'm having several issues already mentioned above, but I'm also having rendering issues. Whenever I render models, they always appear black. Am I missing something, or is this a major bug in MonoGame 3.71?
Post preview:
Close preview