Troubleshooting an exported mesh

I’ve made several meshes and they’ve for the most part exported to babylon as I’ve expected them to. This one, however, has me stumped. It’s a fairly simple model, and when I examine the file it looks right, but when I load it into a game or into the sandbox (https://sandbox.babylonjs.com/) it does not show up. Just nothing there. I’ve even tried copying the model into a fresh blender file, no dice. Just wondering if I’m missing something obvious. What are the steps to troubleshoot a weird export?

passer.zip (75.4 KB) passer.babylon.zip (11.6 KB)

I downloaded the blend file. Exported to gltf, (checked apply modifiers because I see you have a mirror modifier), and then opened it in gltf viewer. It loaded fine. It must be something to do with the way you are exporting it or the blender version you are using. I can’t see anything wrong with the model itself. I am a newb tho.

1 Like

This is what I got:

I’m using the babylonjs exporter. Is GLTF preferred now?

Pinging @JCPalmer, he owns the Blender->Babylon exporter

.Babylon is pretty proprietary while gltb and gltf are becoming more an industry standard. I also think there is more active energy being out into the gltf exporters. So I guess it would be a matter of what your requirements are.

Well I’m replacing the material anyway so it just needs to be able to handle a single object with a UV map and bones, not a complicated scene with cameras, lights, etc.

When it applies the mirror modifier it creates a duplicate mesh, so they aren’t attached to each other when I spawn them in-game. Also, the skeleton does not appear to make it through the export. I think I’m going to keep trying to fix the .babylon export, unless that’s super deprecated.

On mobile now. First step is always to look at & post the export log file.

Exporter version: 6.2.2, Blender version: 2.80 (sub 75)
========= Conversion from Blender to Babylon.js =========
	Scene settings used :
		inline textures     :  false
		Material Type       :  PBR
		Positions Precision :  4
		Normals Precision   :  3
		UVs Precision       :  3
		Vert Color Precision:  3
		Mat Weight Precision:  2
		texture directory   :  /home/eamonn/Downloads/Flythrough.Space/asset_sources/
	Python World class constructor completed
	processing begun of skeleton:  Armature, id:  0
		processing begun of bone:  Bone, index:  0
	processing begun of mesh:  Cube
		processing begun of material:  Material
		num positions      :  1404
		num normals        :  1404
		num tangents       :  0
		num uvs            :  0
		num uvs2           :  0
		num colors         :  0
		num indices        :  1656
		Skeleton stats:  
			Total Influencers:  0
			Avg # of influencers per vertex:  0
			Highest # of influencers observed:  0, num vertices with this:  1404
			exported as 0 influencers
			num skeletonWeights and skeletonIndices:  5616
	processing begun of camera (UniversalCamera):  Camera
	processing begun of light (POINT):  Lamp
========= Writing of JSON file started =========
	writing mesh:  Cube
========= Writing of JSON file completed =========
========= end of processing =========
elapsed time:  0 min, 0.0904 secs

That’s the log file. I fiddled with the scene graph some more and started getting a warning that it couldn’t apply mirror modifiers to meshes that where attached to an armature, so I got past that and the export ultimately worked. For reference, further versions of the file are here and here.

I’m still a bit curious about what’s wrong with this particular version though. It creates a .babylon file that loads fine but with an invisible mesh.

Had not the time to look at this till now. The mesh, ‘Cube’, has an armature modifier improperly added. If you look at the log, you will not see the number of matrix weights or indexes listed. You will see that the skeleton stats show 0 as the number of influencers.

BJS does not like that at all. I am also guessing that you got this somewhere off the net. Reason is that although your log file shows you running 2.80. The display is not right, which indicates that this .blend was made with an older version of Blender.

Suggest you start over.

  • Start Blender 2.80.
  • Using the starting scene, File->Append all the things in the Objects section of the original Blend file.
  • Unparent the ‘Cube’ from the armature, using right click menu Parent->Clear Parent.
  • Shift click the part of the armature sticking out the top, and with both selected type ‘crtl-P’. On the parenting menu, select 'With automatic weights’

Alternatively, it seems kind of pointless to have an armature to a rigid body, like a spaceship. You could just leave the last step out, unless you are actually going bend the wings or something in an animation.

FYI, exporter 6.2.2 is slightly out of date. Updating will fix NOT this defective model though.

2 Likes

With enough fiddling I was able to get the BJS exporter to work, here’s the final blend file:
https://github.com/EamonnMR/Flythrough.Space/blob/master/asset_sources/passer.blend
and final .babylon file:

I did in fact create the file originally with an older version of Blender. The reason for the armature is that I want to add bones to the mesh to indicate where weapons are mounted, and you can’t have bones without an armature (right?)

Probably not. I would not use an armature just to mark where something goes. This will have a performance impact in exchange for a minor design time gain. If this is just for Blender, I would just place them where you want them.

If placement is being done in BJS, I would use Blender empties, parented to the ship mesh, to hold down the spots. Empties are exported without geometry or material. Add your weapon mesh as a child of ship and set position & rotation to that of empty. Very low overhead.

Thanks for the advice, I’ll give that a shot! It’s roughly equivalent to what I’m doing with bones anyway, so it shouldn’t even be too much of a code change.

I did want to add animated turrets to some ships, but it might make more sense to model them as separate meshes and stick them on in code too.