Did anyone sucessfuly export mesh with Alpha Texture from Blender 2.8?

I tried my best doing my “homework” by reading:

“Transparency and How Meshes Are Rendered”
https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered

“Materials”
https://doc.babylonjs.com/babylon101/materials

“Blender tips”
https://doc.babylonjs.com/resources/blender#features

However, after many attempts I still can not get my model to have a face with transparent areas according to its texture.

On Blender I tried to enable PBR Transparency mode: Alpha test & Blend as well as Blend. No effect. BTW… existing Blender tips is VERY different than 2.8 and former exported made for 2.79 crashes crashes on 2.79. So I am only using 2.8 with latest exporter.

O BJS I tried to enable Alpha by getting material reference with no luck:

        var mat = arch.material;
        mat.hasAlpha = true;

Also tried other possible settings like:

        mat.backFaceCulling = false;
        mat.diffuseTexture.hasAlpha = true; // get error here as there is no diffuseTexture in this mat.
        mat.needAlphaBlendingForMesh(true);
        mat.alphamode = BABYLON.Engine.ALPHA_COMBINE;

Then I decided to follow a working solution for a cube:

So I created a material and tried to apply to my mesh. It seems that BJS did not take in consideration the existing UV Mapping and applied wrong mapping:

        var mat = new BABYLON.StandardMaterial("newMat", scene);
        mat.diffuseTexture = new BABYLON.Texture("blender/arch.png", scene);
        mat.diffuseTexture.hasAlpha = true;
        mat.backFaceCulling = false;
        arch.material = mat;

Thanks in advance,
Marcelo

Pinging our experts (@JCPalmer, @Vinc3r, @gryff)

We’ll need your .blend with your object (or if you can’t share it, a simple Cube using the same setup will be OK too). Bonus if you try to integrate it inside a playground :wink:

It does not run under playground:
https://www.babylonjs-playground.com/#KLM5MS#1

Blender file in:

I am having so many problems that I am switching engines as I have a dead line.
To mention a few:

  • Following camera get inverted rotation related to the model. Parenting a free camera did not work. So I hacked a freecamera by “manually” translating/orbting around my model
  • Dynamic texture gets wrong UV Map once re-applied to a model.
  • Transparent Texture does not worked for me.

Thanks anyways.

Yep, you’ve missed a point in the doc’ :wink: https://doc.babylonjs.com/resources/external_pg_assets#from-dropboxcom

As your folder is kind of… messy :smiley: I have no idea about which objects & materials are problematic, please be more specific. As I said, a simple cube showing your issue is enough to help.

But from what I’ve seen until now by opening randomly a .blend, you don’t use nodes on your material. Read Blender Manual about glTF: https://docs.blender.org/manual/en/latest/addons/io_scene_gltf2.html

https://docs.blender.org/manual/en/latest/_images/addons_io-gltf2_material-principled.png

Hello Vinc,

Very appreciated your reply. I really missed this doc, thanks a lot for pointing out. Once I deploy my game I will resume reimplementing it in BJS as I really want to learn it. You guys are definitely doing an amazing job.

Regards,
Marcelo