Building a Sync Tool for Blender to Defold

Its ok, there will be more work to be done on it. Just want to get the F18 game done.
I have a big project I will probably need it for. I want to be able to generate large sim environments with Blender and it. Should be interesting, but it will probably be a few weeks before I get back to it.


Added collection support. Heres the f18 map scene with missions being added.

Adding some simple go script init (to support tint coloring and a few other things). That should be done tomorrow.

Heres the map in Defold - added some mountains and you can see the collections and mission info in Defold project window.


New additions:

  • Normal vertex smoothing now working
  • Base color RGBA supported

I have been testing with some Sketchfab free scenes. This one from Abhay Singh

In Blender:

In Defold:

I think with the addition of a env map, it should be fairly complete.

With the addition of some lighting features in Defold, it should be quite suitable for decent 3D scene rendering. Some SSAO and a few other things which I will look at later.


I haven’t got the time to test this yet, but thank you for the time and effort put into simplifying 3D workflow.


There’s still some more changes to come soon. The initial setup needs to be made much easier, and I really want to remove the root transform nodes for the axis management - it complicates things like lighting and normals.

Too many other life tasks getting in the way :slight_smile:


Some new updates to make everything easier to do and some feedback.

  • Added luajit tools (for all three platforms) to the tool folder.
  • Added a new custom properties exporter. If you add custom properties to a mesh or group node, those custom properties will be exported into a Defold script file that can be accessed.
  • Added a progress bar to indicate what is happening.

Next is custom shaders and lighting.


It would be useful to have ability to export second set of UV coordinates, e.g. for baking lights.

Hrm. Im not sure multiple uvs are supported in Defold just yet. I’ll do some tests. I can add another section to the buffer object and see if it is passed through.

why not, you can create mesh buffer of custom format
same for normal maps (if you plan to add them), you will have to export tangent as well (and maybe bitangent to avoid computation)

Yes, you definitely could, but then thats a custom mesh, and probably wouldnt be properly visible in the editor? Because the Sync Tool generates Defold based resources (buffers etc) and a resource structure, it’d be nice to keep it closely matched. I suspect a second uv would be relatively easy to add in the pipeline, if it isnt already.

Adding a texcoord1 to this:

Would be my preference. Custom buffers could be added, but are not really high on my todo list :slight_smile:

They are visible without issues as I remember, you can apply build-in shader or custom one.

Ok. I’ll give it a try - Im not sure how builti-in shaders would possibly work with custom buffers? Ie, the model material for example (for anim) definitely needs to have a specific buffer setup. Will see, should be easy enough to test.

Just make sure you use the same (as defold mesh exporter) buffer stream names for position\normal\texcoord0 - it’s “position”, “normal” and “texcoord0” :slight_smile:

1 Like

Im already doing this (see github link above).
The problem is if you make modifications to the buffer you will then need to add code or shader modifications to support the changes in the buffer elements.
The model material is even more strict, due to the anim. I have done a fair amount with the mesh component (in a geom generator too) and Im not sure you can get extra information into the buffer with out custom code or shaders.

I think what you are suggesting is something like this:

    "name": "texcoord0",
    "type": "float32",
    "count":4,           -- <<--- 4 instead of 2, adding extra uv's to the same buffer
    "data": [

Which would work, but again you need to be able to support that in the materials etc. Im pretty sure I tried this in the past, and the resource loader fails to load it. I’ll check again (was a early last year when I tested that).

What I was suggesting is another complete texCoord stream - which would require a engine change, but I think this might be potentially more useful, especially if it was designated a “custom” stream and thus allow buffers with all sorts of different data in them.

you will have to write your own materials anyway, I don’t think it’s possible to make a nice looking game with a single build-in material
texcoord0 with 4 coords probably will make buildin material look wrong but extra stream won’t break anything


Sorry, I was confused because you mentioned that built-ins should work fine and I didnt quite get how that could work. So yes, this is why Im not really wanting to do custom materials too much or modified buffers unless they can be supported by Defold directly - because otherwise there ends up being the need to create too many new resources for single use.

A possible solution will be to provide links to materials, shaders and buffer structures on the blender side, but again thats a substantial impact on the plugin so its not really a high priority. Id much rather have better PBR (env map specifically) and lighting before this.

The aim is to get the data sets into Defold “ready to use”. Then if people want to apply their own shaders and so on, they can. I will be testing the extra stream in a day or so, so if that doesnt break the resource pipeline, then I’ll add it as a custom option (should be fairly trivial to try out).

I’ll raise an issue on the repo so I can track this. If you want to try and add something yourself, feel free to fork, or do a PR.


I did a quick test with texCoord1 stream and I think its working. Added a secondary stream. Im currently using duplicate uvs in the shader, so I cant really tell for sure. Will try a secondary texture to see if its all good.

I’ll probably make it work on detection of secondary uvs sets on the Blender side.


So, after a late night last night. And more digging, its becoming quite clear that multi-layer maps (not pbr texture slots) are not a trivial thing to get happening - mainly because there are many ways to end up with verts with multiple uv layers.

The result, is that exporting the uv layers while possible, is probably going to introduce a world of pain. The other potential downside, is that you will end up with more draw calls on an object with multiple uvlayers. I suspect it would be better to do things like decals, shadowmaps and so on, within defold itself, because each developer will likely ‘have their own method’.

Im adding a checkbox that enables embedding the extra data as a second channel only but this is likely to be inconsistent, due to the way people generate art in Blender - ie, one vert has multiple layers when mapping two sides of the vert to different textures.

Summary: Single texture/material for single mesh is going to be the norm - secondary textures can be added (check box), but wont be supported in the PBR and the data output may be inconsistent.

1 Like

I have been tinkering some more. And I think there is a simpler way to handle shadow mapping. The PBR Im using supports an Emission texture. I think it is entirely possible to map a light or shadow map to this channel - which would make adding an extra uv stream a fair bit simpler - ie, it would be a fixed channel. Will build up a test over the coming weeks.


Starting to get some cleanup and feature into sync tool again.

  • Fixed major bug with normals not being exported.
  • Added initial second UV stream in buffer definition.
  • Working on pbr setup to support shadow maps as an emission map - ie, emission of 0 is dark(blackout) shadow, 1 (bright) is no shadow. May support other variants of this.

I hope to have much of this wrapped up tomorrow. And just bug fixes going in only. I will be testing a wide array of meshes/models - I’ll be using Khronos’s gltf mesh and anim test library, its a nice set to check against. I’ll put the results up on the github so I can track missing features and problems.

Here’s a little car I did recently (helped me find the normals issue).

Oops. Almost for got. Source:


I really hope we can get Defold close to the Sketchfab renderer . I dont expect exactly (because they are doing some nice multiframe composing) but it should get close… I hope :slight_smile: