Blender Exporter 5.0

Recommended Posts

6 hours ago, V!nc3r said:

For example, maybe it could be interesting to make some screenshots of Blender UI with visual indications of what could be exported and what not, for the doc ?

There are already some though they will be shortly out of date.  I was only going to document one of the exporters.  Since Tower of Babel had UI fields the JSON exporter did not have, that was the one I picked.  I just put Blue squares around the TOB only stuff.

There are changes for 5.0, but I will not have even started redoing this doc till after.  Just 2 days ago, I added a dropdown for Mesh grand entrance type.  Probably going to also drop all the code generation examples.  They were from when I generated Typescript and / or Javascript.  Now it is only Javascript and a d.ts file.

Share this post

Link to post
Share on other sites

Hey @JCPalmer

Good job, this is a very helpful exporter :)

I am however experiencing some problems, probably due to lack of knowledge and understanding, I'm very new to Blender and .babylon files.


I'm looking for models in:

I'm importing them to blender, usually .fbx files, and then exporting to bjs.

The vast majority have problems when exporting to bjs such as being exported without their textures.

Here's an example of a model which I wasn't able to export properly to bjs, it was exported without its textures:

Here's for instance a model which I had no problem exporting from Blender to bjs:

Share this post

Link to post
Share on other sites
4 hours ago, royibernthal said:

Here's an example of a model which I wasn't able to export properly to bjs

Well I looked at the .fbx file with Autodesk's FBX viewer (image below).

It seems to be just a rig  - and no Lich King mesh. In fact looking at the size of the .fbx file - 236Kb(!) also suggests there is no exotic mesh.

So I'm not sure how you got any meshes into Blender.

(Note: I also tried the .obj file too - and heaven only knows what that is! One of the two comments on the page where the download came from says the .obj file is no good.)

cheers, gryff :)


Share this post

Link to post
Share on other sites


I might have entcountered a bug. While exporting a scene I got from a third party the exporter crashes. Log file shows (I changed the mesh names due to privacy):


    WARNING: The following mesh has exceeded the maximum # of vertex elements & will be broken into multiple Babylon meshes: meshname
    processing begun of mesh:  meshname1
========= An error was encountered =========
  File "/home/styxxx/.config/blender/2.77/scripts/addons/babylon-js/", line 99, in execute
    mesh = Mesh(object, scene, nextStartFace, forcedParent, nameID, self)
  File "/home/styxxx/.config/blender/2.77/scripts/addons/babylon-js/", line 91, in __init__
    self.hasUnappliedTransforms = (scale.x != 1 or scale.y != 1 or scale.z != 1 or
ERROR:  local variable 'scale' referenced before assignment

:o First it causes the message "hasUnappliedTransforms" and then the "scale referenced before assignment" error,during the error message output. Both errors seem to be caused by trying to access the 'scale' variable before it was initialized? At least it looks like this. The mesh doesn't have unapplied transformations, I checked multiple times. So I guess there is something wrong with the variable when a mesh is splitted.

Also the texture is deleted within blender after the exporter fails. I have to click "undo" to bring it back. I guess an exporter shouldn't do this. I didn't even know it was possible :lol: (the texture output file is just a black jpeg)


edit: It works with the blender exporter 4.6.1 works. Well kind of. The textures are fine at first and get overwirrten during the export process an then are corrupted (or just black jpegs). And a lamp is added to the blender scene. But no error mesages and a babylon file is created. Also the mesh that causes the crash with 5.0.5 is completely exported. So it's a problem within the new exporter. 

Edited by styxxx
tested the old exporter

Share this post

Link to post
Share on other sites

Sounds like this .blend you got was created with a very old version of Blender.  I had a problem with this check with an old .blend I got from Blender's QA .blend set.

Try to get things into a 'New' .blend by creating one.  Then with File -> Append {Shift F1}, bring in the other .blend's stuff. When picking stuff, get them from the Object "sub directory", this will get both the mesh & materials.

This fixed issues I had with the un-applied transforms.  As the exporter gets new features, it is more and more dependent on files created with a modern version of blender.  .blends scavenged  from places like BlendSwap were not made by someone who cared about exporting them to WebGL.  They can require a lot of remediation to reduce lights, vertices, and replace features not exported.

Share this post

Link to post
Share on other sites

@styxxx and @JCPalmer

Jeff, I ran a quick simple test with Blender:

1.) Added a UV sphere to a new file then added a "Subdivision Surface Modifier" with the "View" set to 4.

2.) I applied the modifier and got a sphere with 127,000+ vertices, and attempted to export it.

I got basically the same error message  as Styxx. It is my understanding that WebGl has a limit of 65536 vertices per mesh. So it would appear as though the exporter does not like it. Should it be splitting the mesh?

cheers, gryff :)

Share this post

Link to post
Share on other sites

The blender file was created by myself (with Blender 2.77). I got the data as some different formats (.dae for example) and had to import them. So i don't think the .blend file is the reason. But I tried saving it to a new file to be sure and the same happened. :)
Seems like during splitting the mesh (which is happening according to the log file) some variables get lost or unset.

Share this post

Link to post
Share on other sites

Vertex limit is common in realtime 3d engine (here an example on unity3d). It looks like a limit of 16 bit index buffer, don't ask me what's that involved :rolleyes: (i suppose it's a kind of array which store all vertex position/color/normals/whatever of a mesh ?)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.