.FBX model not rendering (fixed)

Hey all. I’m dipping my toes into 3d. I’ve got the old xwing.x model displaying using BasicEffect (it looks unlit, whatever), but I’d like to use my own .fbx model exported from blender. Right now I have a flat shaded cube (no texture) - the same cube if you create a new project in blender. I assign a green material, and export it to .fxb. If I load the file in an online model viewer, it looks good. I use MGCB editor to add the file to my project. When I replace the xwing model with my cube, I see nothing. I’ve tried increasing to massive scales, I’ve tried reversing normals, tried playing with all the parameters in the .mgcb file etc etc, with no dice so far. No doubt I’ve done something silly. Anyone have any suggestions?

Edit: oh and I’ve stepped through the drawing code, the model does have a Mesh and a MeshPart, with the right number of vertices & primitives, so I think it has imported ok, just missing something when it comes to rendering.

Just for the sake of checking, have you tried turning off backface culling and setting BasicEffect to enable default lighting? Maybe also enable vertex colors and set them to red or something since textures is a whole other thing, just to see if the shape you expect appears.

If there is an issue with your export/import stuff there are a number of steps that could be tripping you up. How you export your FBX from Blender matters. The easiest way is to select exactly what you want exported and then use the FBX exporter, ensure scale properties and “use selection” and whatnot are configured. Then in MGCB you also need to make sure scale and such is set and that you’re using the FbxImporter to process it. If memory serves, FbxImporter will only load in a model texture that lives next to the FBX with the same name (but the texture is not imported into .mgcb). Once you get things working/rendering, you may also need to toy with the Rotation and other parameters in MGCB to get it to build correctly.

Giving my notes DB a second look I stumbled across this section from some years ago, maybe it will help :slight_smile:

When exporting a model from Blender for MonoGame
	Need to apply booleans before export

	In Object Mode Select the Object
		Ctrl A and Apply All Transforms

	In the export settings from Blender for .fbx > under Transform
		"Apply Scalings" should be set to "FBX Units Scale"
		"Forward" should be set to "Y forward"
		"Up" should be set to "Z up"

		Also if you're using textures use "Path Mode":"Strip Path" in the export settings and be sure to place the texture graphic next to the .fbx so MGCB can find it.

When importing a model from Blender to MonoGame
	See above.
	Then in the MonoGame Content Builder, set "Rotation X" to "-90".

I had tried a bunch of blender export settings I’d found on google, but “Apply Scalings” should be set to “FBX Units Scale”, and “Up” should be set to “Z up” - these did the trick - thanks!

Next problem, the material colour I select in blender is being ignored, and my cube is being rendered as blue - as in RGB 0,0,1 (but with shading applied, which is nice!)

1 Like

Nevermind - I was setting the effect.DiffuseColor, which I guess overrode the models colour.

1 Like