Ambient Texture from Blender?

What would be the correct way to export ambient textures from blender? I know it defaults to emissive, but I need to find a way to have that be on the ambient channel not emissive.

I am stupid with creation tools but it depends the kind of material PBR/Standard, your export type Babylon/GLTF and your blender material type I would guess.

With this we could seek help from @JCPalmer or @PatrickRyan

@Pryme8, I am going to assume you are talking about an ambient occlusion texture. I originally assumed you were referring to the texture assigned to the ambientTexture property of PBRMaterial but you mentioned it defaulting to the emissive channel which won’t render correctly at all. So please let me know if I’ve misunderstood your question. But if you are talking about an AO texture, I would always channel pack the texture to an ORM (occlusion, roughness, metallic) texture and then wire up the channels to roughness and metallic in the Principled BSDF shader and export to glTF. The glTF export and our loader should them correctly place the texture in to the ambientTexture property.

Yeah, I was talking about the ambientTexture. It seems like when we export the assets as unlit it’s binding the texture to the emmisiveTexture. I’ll link the artist to your post I’m sure what you are saying will make sense to them.

If ambient texture is a property of the PBRmaterial then that’s not going to work for our models. They were made to use unlit materials with all lighting baked to a texture.

The issue is that we have models that are using unlit materials with baked textures that are glowing from a glow post process and we don’t want them to be glowing. It seems that babylon is automatically assigning the material as an emissive material when it really shouldn’t be, it should just be showing pure texture data.

@Sol_Hunter can you share a repro ?

  1. When you say unlit, do you mean a simple texture being displayed ? if yes PBR displays Diffuse + emissive in unlit mode as the gltf spec defines so if you place the texture in the albedo channel without emissive you will be all good.
  2. When you say unlit, do you mean simulating the material in a place without lights ? in this case the material would need to be fully emissive to display something cause the albedo would be ignored. You would also need to drop its environmentIntensity to 0 as well as excluding the mesh from all the lights.
  3. About the export, I do not understand the relationship between AO and the emissive channel. There should not be any. In blender (assuming the use of GLTF) you would either bake AO in diffuse (in eralier versions) or you use the gltf export node glTF 2.0 — Blender Manual.
  4. About the ambient texture being a material property, I assume you want to see the ambient effect but with your unlit mode. In this case, you can bake ambient in your diffuse as mentioned in the video from the 3rd point and use this as your albedo so that the unlit mode would work without emissive.
  5. About the glow layer, it by defaults to work from emissive but you can override per mesh the emissive colors/texture in use if necessary: Making Meshes Glow | Babylon.js Documentation.
  6. If your process requires a highly specific material I would recommend to rely on NME where glow could also be controlled Making Meshes Glow | Babylon.js Documentation.

Was linked to this topic, but looks more like a GLTF thing. Did notice that assets are missing from the PG’s in the Making Meshes Glow Doc. Did no check all the PG’s, but the little pictures all show the Neon Pipe.

Did not seem worth another topic.

Let me add @RaananW on this one as it is related to a recent CDN move I believe.

So If I export a pbr material from blender, if the material is tagged as unlit in the gltf, it will display pure texture data without any lighting/normal influence? If so, How can I get blender to assign the unlit tag to a material on export? edit: from the blenderr docs:

A material exported with the unlit extension will indeed display pure texture data.

Maybe @PirateJC or @PatrickRyan would know but I would advise to check with the blender folks for this one.

Can you check your exported gltf or share one with us if you want us to have a look ?

So there are a couple of different ways for AO if anyones interested.

On my projects I use Occlusion Roughness Metalness (ORM) map. I set this texture to the metallicTexture map slot, and then use the following:

    pbrMaterial.useAmbientOcclusionFromMetallicTextureRed = true;
    pbrMaterial.useRoughnessFromMetallicTextureAlpha = false;
    pbrMaterial.useRoughnessFromMetallicTextureGreen = true;
    pbrMaterial.useMetallnessFromMetallicTextureBlue = true;

@Sol_Hunter, to get Blender to tag a material as KHR_materials_unlit, one way is to set the material up as a background material. Here is a very simple setup where I am just passing a UV test texture as the background color:

When exporting this file, a simple cube with this material assigned, the material is tagged as unlit:


When loading the glTF into our sandbox, you can see that the Advanced Parameter for unlit is enabled:

1 Like