I use Blender to export objects, it seems that AO Map is not loaded
My soludtion : I will merge AO map (red chanel) with base corlor , but It is not perfect
The information on AO in this documentation is correct: https://docs.blender.org/manual/en/dev/addons/io_gltf2.html. You have to do some setup (make a custom node, with an “Occlusion” socket) to export AO, because Blender’s Principled material doesn’t have it.
I’m actually struggling with this same issue. I’ve added the AO map with the custom node in Blender, and I’ve read in the threejs documentation that I also need to include an additional UV map (which I’ve also added), but I don’t seem to be able to connect everything together. When I load the resulting GLTF, the “aoMap” property still says “null” and I don’t see any difference in the model.
So my question is: Do I need to do something in Blender to connect the AO map to the UV, or do I need to do something in my threejs implementation to turn it on, or is it just supposed to work and I’m totally doing it wrong?
Sorry I have to ask the seemingly basic question, but I haven’t been able to find any examples/tutorials that actually show how the setup is supposed to be implemented.—Thank you!
GLTFLoader should do this automatically, if it sees that additional UVs are needed. But adding the extra UV set doesn’t hurt. Sounds like you’ve set things up correctly to me, can you share a .blend? Or a screenshot of the material configuration in Blender?
After some further testing, I think I might have found the problem. My project contains multiple meshes and I was trying to create an AO map for each of them, but when I inspect the GLTF with “gltf tools” it looks like it’s only exporting one of the AO maps. So I’m wondering if I can’t export multiple AOs from blender to GLTF?
If you think that might not be the case, I could still post screens of my material setup (unfortunately this is a project for work so I can’t post the actual blend file). By that, did you mean the nodes that I’m using or the actual materials panel? Thank you!
glTF certainly supports it… but if your model has multiple materials, I think you do need to set up the custom node in each of the materials. And, sometimes, a single mesh has multiple materials in Blender and (while that’s supported) it complicates export a bit. You may need to file an issue on the Blender addon at GitHub - KhronosGroup/glTF-Blender-IO: Blender glTF 2.0 importer and exporter. I think a screenshot of either the material nodes or the materials panel would be enough, but I’m not sure how to set up AO using the material panel rather than nodes, that may not be possible.
Thank you, Don! I think your suggestion drove me to find another piece of the puzzle. I stumbled on the blender documentation for gltf and I found this:
However, if the exporter finds a custom node group by the name of glTF Settings , and finds an input named Occlusion on that node group, it will look for an Image Texture attached there to use as the occlusion map in glTF.
I can only name 1 of my custom nodes “gltf settings.” When I add an AO map to another mesh and then try to set up the nodes, the name of the node is automatically changed to “gltf settings.001”. So I’m now wondering if that’s breaking it.
I’ll go through the github issues and see if I can find anything. If I find any solutions, I’ll report back. —Thanks!