[SOLVED] FBX file cannot find the texture in the right folder during build

Hello!

I’m very new to MonoGame and just started with 3D tutorials.

Whenever I want to build an FBX file with a texture the build fails.

Error:
Building Helicopter.fbx

  • H:/Projects/MonoGame/Tutorials/3DTutorial/3DTutorial/Content/Helicopter.fbx
  • The source file ‘H:/Projects/MonoGame/Tutorials/3DTutorial/3DTutorial/HelicopterTexture.png’ does not exist!

It seems the FBX file isn’t looking in the Content folder for the texture. When I put the texture into the 3DTutorial folder, the project builds but then I get a ContentLoadException. I tried using an FBX file without a texture and then it works perfectly.

I used Autodesk FBX Converter x64 2013 to convert the FBX files.

Does anyone know what I am doing wrong?

Which ‘tutorials’ is this?

I’m using http://rbwhitaker.wikidot.com/monogame-tutorials.

I am guessing you are on this page right?

http://rbwhitaker.wikidot.com/monogame-using-3d-models

?

Correct. When I use an FBX file without a texture it works.

Are you converting it to XNB?

I’m not sure…, I used the Pipeline just as described by adding existing items I put in the Content folder.

Are you removing the extensions?

I’m not removing anything, am I supposed to?

remove the extension model .ext and keep model you may have overlooked this on the page

model = Content.Load(“Ship”);

EDIT
More clearly model.xnb, remove ‘.xnb’

my guess is you are using model.fbx

Post some code…

Fbx saves the relative location of the texture with respect to the fbx file itself when you build it. The texture must have been in the directory above the fbx file. You should be able to searcht the fbx for the name of the texture and edit the path so it expects the texture to be in the same folder (i.e. remove the … at the start of the path). There may be multiple occurences you need to edit. You can also just rebuild the fbx, but to the same location as the texture.

What was the exception you got when you put the texture in the right place relative to the fbx?

2 Likes

@MrValentine
I tried removing the .xnb, still getting an exception.

private Model model;

model = Content.Load(“Helicopter”);

The rest of the code is the same as in the tutorial.

@Jjagg
I will try to do that. I got an “ContentLoadException was unhandled”

Can you export the model to say .X and see if you still get issues, to eliminate the issue of the exporter or file type generation issue…

What was the exception message? There is probably also an inner exception (the exception that caused this exception) that gives you more information on what went wrong.

I figured it out! It works now.

It was as you said @Jjagg. When I convert my FBX it created a new folder and put the FBX file in there. So the texture wasn’t in the same path. I made sure I put the converted file in the same folder as the texture.

This was the inner exception

InnerException:
FileName=H:\Projects\Monogame\Tutorials\3DTutorial\3DTutorial\bin\Windows\x86\Debug\Content\HelicopterTexture_0.xnb
HResult=-2147024894
Message=Could not find file ‘H:\Projects\Monogame\Tutorials\3DTutorial\3DTutorial\bin\Windows\x86\Debug\Content\HelicopterTexture_0.xnb’.

Thanks for your help @MrValentine and @Jjagg!

2 Likes

Does the tutorial not tell you to do this? bad tutorial…

Anyway sorted :slight_smile:

Mark [SOLVED] EDIT nvm lol