# Exported GLTF Scene does not have Material Color in Blender

**URL:** <https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235>\
**Category:** Bugs\
**Created:** [January 31, 2022, 4:01am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235 "2022-01-31T04:01:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [January 31, 2022, 4:01am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/1 "2022-01-31T04:01:55Z")

</div>

Is this a bug or am I missing something?

[PG of exported scene](https://playground.babylonjs.com/#2NJYI5#1110)  
When imported in Blender looks like this:

 ![Screen Shot 2022-01-31 at 7.09.13 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/d/3d920c67d8ea331ba937d360f29387ec2c863efd.jpeg)

**Bugs** :

1. no material color
2. transparent Texture area turns black
3. `mesh.setEnabled(false)` appears in GLTF scene (should not be exported)

How can I **filter out disabled meshes** from GLTF export without disposing them? (because I need to export its instances to GLTF).

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 31, 2022, 1:09pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/2 "2022-01-31T13:09:19Z")

</div>

@bghgary might have an idea about the serializers ?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [January 31, 2022, 9:48pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/3 "2022-01-31T21:48:11Z")

</div>

> [@ecoin](#):
>
> no material color

The exporter doesn’t support multimaterial and thus this doesn’t work properly. Feel free to file a feature request on GitHub.

> [@ecoin](#):
>
> transparent Texture area turns black

This is somewhat expected. This scene uses StandardMaterial. glTF uses PBRMaterial. There is no correct way to translate the behavior of StandardMaterial with a partially transparent diffuse texture to PBRMaterial as the alpha channel of the albedoTexture for PBR is intended for alpha as coverage. I suggest using PBR materials in this scene if you want them to translate well.

> [@ecoin](#):
>
> `mesh.setEnabled(false)` appears in GLTF scene (should not be exported)

You can tell the exporter what to export by setting the [shouldExportNode callback](https://doc.babylonjs.com/typedoc/interfaces/babylon.iexportoptions#shouldexportnode) on the exporter options. Maybe we can automatically add one for excluding the disabled meshes for the inspector export button?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [January 31, 2022, 9:56pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/4 "2022-01-31T21:56:50Z")

</div>

> [@bghgary](#):
>
> Maybe we can automatically add one for excluding the disabled meshes for the inspector export button?

[Change GLB export from inspector to exclude disabled nodes by bghgary · Pull Request #11889 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/11889)

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 1, 2022, 5:54am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/5 "2022-02-01T05:54:39Z")

</div>

> [@bghgary](#):
>
> tell the exporter what to export by setting

Is there an option to convert transforms correctly to Right handed system while keeping the default LHS in Babylon? (GLTF uses right handed).

Rotation is messed up and I cannot manually rotate the entire scene by Math.PI like the hack used in Babylon sandbox, because in the scene I have meshes transformed and nested multiple levels (i.e. rotated within rotation…)

 ![Screen Shot 2022-02-01 at 8.48.29 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/0/509fd0d8028ff33d524be266738f9ca156b636f0.png)  
 ![Screen Shot 2022-02-01 at 8.48.42 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/b/3bc3b7dcdbe93fa0c72f28bf27bb79cd4d0ac379.png)

If there is no option, where in the source code of the exporter can I manually fork my own version of Babylon?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [February 1, 2022, 4:44pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/6 "2022-02-01T16:44:57Z")

</div>

> [@ecoin](#):
>
> Is there an option to convert transforms correctly to Right handed system while keeping the default LHS in Babylon? (GLTF uses right handed).

I don’t know what you mean by this. The exporter converts the scene to RHS for glTF if the scene is in LHS. The loader converts the glTF to LHS using a root mesh if the scene is in LHS.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [February 1, 2022, 4:45pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/7 "2022-02-01T16:45:49Z")

</div>

> [@ecoin](#):
>
> Rotation is messed up and I cannot manually rotate the entire scene by Math.PI like the hack used in Babylon sandbox, because in the scene I have meshes transformed and nested multiple levels (i.e. rotated within rotation…)

Can you set up a repro so I can help you with this?

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 2, 2022, 2:49pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/8 "2022-02-02T14:49:51Z")

</div>

> [@bghgary](#):
>
> Can you set up a repro so I can help you with this?

[Here is the PG](https://playground.babylonjs.com/#YIU90M#670)

Steps to reproduce:

1. in PG, open Inspector and click Scene Export → Export to GLB
2. Open Blender New project, Import → glTF 2.0

Upon further investigation, it seems that relative rotations of nested Mesh/Nodes are preserved, only the top level Node (in PG, it is called **root** ) is not rotated correctly. Camera and Light also have incorrect rotation, so I guess for the purpose of using Blender Cycles to take snapshot should not be a problem.

 ![Screen Shot 2022-02-02 at 5.45.30 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/1/b179152661e2724f9ed1d8f58cc24ae793a75f10.jpeg)

However, even using PBR material does not produce consistent result for Textures with transparent areas (turned back) - or is it a setting in Blender that needs to change?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [February 2, 2022, 10:17pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/9 "2022-02-02T22:17:21Z")

</div>

> [@ecoin](#):
>
> it seems that relative rotations of nested Mesh/Nodes are preserved, only the top level Node (in PG, it is called **root** ) is not rotated correctly. Camera and Light also have incorrect rotation

I am able to repro. These seem like bugs. Can you narrow down the problem to just this in a playground and file an issue on GitHub?

> [@ecoin](#):
>
> However, even using PBR material does not produce consistent result for Textures with transparent areas (turned back) - or is it a setting in Blender that needs to change?

I don’t know much about Blender’s renderer, but things may look black if there isn’t an environment (IBL) set up.

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 3, 2022, 12:05am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/10 "2022-02-03T00:05:04Z")

</div>

> [@bghgary](#):
>
> Can you narrow down the problem to just this in a playground and file an issue on GitHub?

[Here](https://github.com/BabylonJS/Babylon.js/issues/11905).

> [@bghgary](#):
>
> I don’t know much about Blender’s renderer, but things may look black if there isn’t an environment (IBL) set up.

Or it could be something wrong with the `texture.png` file itself, because when I tested with another PNG file, it had black area in both Babylon and Blender.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [February 3, 2022, 12:15am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/11 "2022-02-03T00:15:18Z")

</div>

> [@ecoin](#):
>
> > [@bghgary](#):
> >
> > Can you narrow down the problem to just this in a playground and file an issue on GitHub?
> 
> [Here](https://github.com/BabylonJS/Babylon.js/issues/11905).

Please make the repro simpler. Having Blender in the equation is much more complex than it needs to be. This problem will reproduce just by reimporting the exported glb into Babylon.js sandbox. There are also too many objects in this scene for the repro. Please make it as simple as possible to repro.

> [@ecoin](#):
>
> > [@bghgary](#):
> >
> > I don’t know much about Blender’s renderer, but things may look black if there isn’t an environment (IBL) set up.
> 
> Or it could be something wrong with the `texture.png` file itself, because when I tested with another PNG file, it had black area in both Babylon and Blender.

The albedo texture has an alpha channel that should be ignored by the rendering engine whether Babylon, Blender, or anything else because that’s what the spec says for glTF. Babylon doesn’t muck with the albedo texture when exporting. My guess is that Blender is interpreting the texture incorrectly.

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 3, 2022, 12:27am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/12 "2022-02-03T00:27:57Z")

</div>

> [@bghgary](#):
>
> Please make the repro simpler.

[This is good enough?](https://playground.babylonjs.com/#YIU90M#672)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 4, 2022, 5:28pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/13 "2022-02-04T17:28:36Z")

</div>

Hi @ecoin

Before I take a look at this issue, did you try to import the .GLB in another DCC like Maya, 3DSMax or any other gltf viewer?  
I just want to be sure the issue is not on Blender side.

This viewer (based to threejs) gives the same result as the PG : [https://gltf-viewer.donmccurdy.com/](https://gltf-viewer.donmccurdy.com/)

And same as well with [PlayCanvas glTF Viewer](https://playcanvas.com/viewer)

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 4, 2022, 5:31pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/14 "2022-02-04T17:31:38Z")

</div>

> [@Cedric](#):
>
> did you try to import the .GLB in another DCC like

I do not have Maya or 3DSMax to test, but I get the same black in babylon sandbox when imported back. The bug only appears on that particular png file, some other png I tested look black everywhere.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 4, 2022, 5:33pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/15 "2022-02-04T17:33:18Z")

</div>

I’m looking at the rotation issue for now.

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 4, 2022, 5:37pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/16 "2022-02-04T17:37:11Z")

</div>

It must be a bug with Babylon itself, because both in PG and in my local setup, and production build, the [texture appears white](https://3designer.app/p/SvSByO6e2N) on both Babylon built meshes and imported GLTF meshes.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 8, 2022, 3:19pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/17 "2022-02-08T15:19:33Z")

</div>

Here is a test I did with exported glb from the PG and loaded into [https://gltf-viewer.donmccurdy.com/](https://gltf-viewer.donmccurdy.com/) that’s using ThreeJS which is right handed.  
Big Box is at (0,0,0), sphere at z = 2 and small box at x = 2

PG with left handed scene:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/0/d02bd4d20fe6c26c6d9f997fa203bc5c2267eaa8.png)  
Result in ThreeJS:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/e/8e9f3e19b8ab47ae0da8bfed732fdd32bce16ddb.jpeg)

PG with Right handed scene:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/5/15b0a862e2be81ac814dbe15b82294b10d465eb1.png)  
In ThreeJS:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/9/c9382b1c21accdf853681bfc4199371d36e7167c.jpeg)

As I can see it, the rendering is consistent between Babylon and Three. Grid axis sign is flipped when going from LH to RH. For me, it’s an issue with Blender…or did I miss something?

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 8, 2022, 8:00pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/18 "2022-02-08T20:00:40Z")

</div>

Please notice in your first two screenshots (LHS) how the read X axis is pointing to the right for PG, and pointing to the left for Three.js.

I’s only correct for the right handed system, all axes point in the same direction, according to your screenshots.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [February 9, 2022, 8:45am UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/19 "2022-02-09T08:45:09Z")

</div>

I’m not sure to understand.

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [February 9, 2022, 8:20pm UTC](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235/20 "2022-02-09T20:20:00Z")

</div>

I believe, based on your screenshot, the LHS in Three has X azis reversed.

Three.js is irrelevant here anyway, because I need Babylon export to work with Blender for rendering with Cycles. And this bug is not from Blender side.

Perhaps someone here with a professional 3D software like 3DMax, Cinema4D, etc. can give us an exported GLTF file to test with (along with screenshot on how it looks like in their software) so I can compare it against Blender.

[Next page](https://forum.babylonjs.com/t/exported-gltf-scene-does-not-have-material-color-in-blender/27235.md?page=2)
