Building a Sync Tool for Blender to Defold

Ah yes, these normals :grinning:
Thanks for all the info and sorry again for causing you trouble.

No trouble. Thanks for the support. Without road testing this, it can be hard to catch all the potential issues and problems people will face.
The root rotation is still a problem, which I will be addressing, but I will be doing it carefully so that the additional improvements that are gained, dont cause more problems :slight_smile:
Thanks again to you and @astrochili - the feedback is invaluable.

2 Likes

Looks like it works! :slight_smile: Many thanks for the update, now I will start modeling something interesting.

If I have any difficulties, I’ll be sure to write here.


2 Likes

Thats great news @astrochili. Thanks for the screenies. Looking great.
Oh, and most definitely post here if you have probs. I will be doing some more updates on the weekend (hopefully) with custom shader support and custom render_script support (not sure if it will be ready :slight_smile: ).

3 Likes

Am I right to understand that thanks to the ability to export the second UV, there is a way to implement something like these lightmaps?

I don’t know how to make them in blender yet, but if it’s possible to use in Defold, I’ll learn.


Or is it much easier to use dynamic lighting, just wait for it to appear in the sync tool?:upside_down_face:

2 Likes

Ok. So this is a yes, and no answer :slight_smile:
Yes there is the ability to export the second set of uv’s as a texture uv asset. Sync tool will do that if you tick the “Second UVs” checkbox.

However, to utilize this you will need a shader that is capable of using it. This is one of the reasons a custom shader and render script will need to be provided. The shader will need to utilize the second stream obviously to render the other textures using it. And of course you need texture samples for that new stream in the shader.

It is not difficult to do this right now. You can export with the sync tool, it will generate all the appropriate data and references, you just need to have a shader suited for it and you replace the shader in the material (use the pbr shader) to your custom one.

I have been working on the concept of using the emission texture slot for things like light maps.

As to whether lightmap or dynamic is better, I suspect it will come down to your needs. Lightmaps are great if the lighting is kinda static like in many indoor situations and you can use dynamic in combo with the lightmap to generate a nice look. Or maybe you are doing outdoors and you really only care about dynamic realtime lighting with dynamic shadows… all depends.

With sync tool the aim is to provide a capability for this possible use, but it wont really provide a rendering solution on how that data is used - theres many ways to tackle lighting models.

3 Likes

Oh. How this is used in Blender - sorry should explain that.
You need to use texture layers for it to work properly. A layer is usually assigned a name, and in the material, when you assign a texture if the object has multiple uv layers you can choose one of them for the texture to use. There are a number of youtube tutorials on this method.

2 Likes

Well, I’ll try to figure it out as best I can. My intention is simple - to diversify the level at least some lighting. I’ll be happy with a baked map of the whole level, as well as multiple dynamic lighting without shadows.

I’ll try to bake a static lighting map for beginning. It looks possible for me and consistent with your plans about the sync tool :+1:

2 Likes

Tested the second UV. Two cubes with different second UVs and a shared lightmap texture.


:slight_smile:

6 Likes

Looking great @astrochili ! Looks like it should be very suitable :slight_smile:

1 Like

Ok. New release (updated above).
A new update is incoming into the Defold engine:

Support for gltf and glb makes the whole sync/export proces much cleaner, quicker and more stable.
I have done a few updates to the export tool - now called Defender (thanks @Dziq and @Klear)

Main updates:

  • New name - Defender :slight_smile:
  • Added a new selection to the export panel to select GLTF and GLB.
    To make use of this you need to be running the new Defold version (see link).
  • Added export changes in the python to produce gltf and glb output files. These technically can be used where ever you want (Unity3D etc)
  • Added fixes to the mesh construction.

I have been working on lighting and a new render system, that I hope to have done soon, but Im not going to put a timeline on it. Things have been too busy lately.

If you have any problems, please raise an issue on github of contact me here or on Discord.

12 Likes

A new release for Defender (1.1.1).
Added new logging system which begins to provide feedback to the user about scene related issues.
Currently supports:

Material type checking
Collection checking (for existence)
Luajit permissions levels (reports where file cannot be executed from).
Outputs log report that can be sent to me.

The main aim of the logging is to catch more and more anomalies that are unsupported in Blender when converting to Defold.

Errors are shown on the Defender panel (up to 8 errors) and a log file is generated where the blender file exists.

8 Likes

More good news on the bug side of things. Thanks to Aronimo and Makaber they hlped track down a nasty little utf8 filename bug. The new release is here:

8 Likes

Hi, thanks for extension.
I am trying to mix it with lightmapper https://github.com/Naxela/The_Lightmapper
But can’t:(

Looks like it not export lightmap texture and lightmap uv.
I am noob in blender so i do not understand why:) I have 2 uv in material.
If you have time, please try a look, mb you can help me:)
boxes_1.zip (192.2 KB)

Are you exporting models in collada(.dea) format? If so defold does not support more than one uv set attribute for this format. glTF format can now be used in defold version 1.3.7 which does support more than one uv set.

1 Like

Thanks. I try collada.
It create mesh and buffers.
I try glb and gltf formats. Not helped.
Looks like it not export second uv and not export image.

My material.

Mb because lightmaper create hdr files?

Looks like i need to try bake in blender not lightmapper:)

Hi, Im not overly familiar with how lightmapper works - I might be able to have a look this weekend. However from the screenshots it looks like a shader node based material generator? Which I dont think will work in the exporter as it is at the moment - it did have some support for this, but it complicated things alot, so it was reduced to support mainly maps only.

With this in mind (I havent tried this) you may be able to output the lightmapper to a texture output, and then assign the texture output to the color (rather than a color variant). I might give this a quick try on the weekend too - because this might allow using node gen, but with some limitations.

Oh. And the exporter does support 2 uv channels, however you will need to have a shader material in Defold that uses the channels correctly.

On this note. Please be patient, because Im building a render pipeline that should:

  • support deferred rendering
  • support builtin custom multipass rendering
  • support a shadows implementation
  • support post render effects like ssao, bloom and more.

This, as you can imagine is a little complicated :slight_smile: And more importantly, I want it to be very Defold compatible so Im putting alot of effort in making sure its project friendly, and editor friendly as well as flexible for people to add their own shader pass setups.

I hope to have an initial build really soon. But Ive been saying that for three months. Life and work gets in the way alot :slight_smile:

All I can say… is I have not forgotten, it is underway and I may even show some screenshots in a matter of days (all things going well).

6 Likes

Thnaks.
I do not know) It generate something by lightmapper blender plugin:)

Now i al looking at blender bake. I think it should worked but i need make experiment:)

This may be a silly question as I don’t know anything about lightmapper (looks very interesting, though) but what would happen if you converted these hdr files into pngs and used those instead?