How to use AOMap

Hi, I need to add an AOMap for getting better output in my project. I tried a lot. Still I couldn’t find the solution. How to apply this. Please say any suggestions.
I have seen this following example in threejs.org
three.js examples
in this example, we can see the AOMap is working.
but when I download the same model and same texture and try this in threejs editor to see the AOMap effects. But in that is not working. Please help.

The examples show correct, complete use of an aoMap. If your own examples are not working you will need to share them so we can help you figure out what is not matching the correct usage.

Also note that AO (ambient occlusion) affects only ambient light sources. If your scene in the editor only uses direct lights, AO will not do anything. Also note that models must have a second UV set for use with an AO map. When loading a model using AO in GLTFLoader, the second UV set is added automatically if needed.

1 Like

Wow. Thanks for brief explanation @donmccurdy . I need to know, what is the second UV set. Because, I just loaded the same model which is used in the above example in Blender. It has a single UV only. So What do you mean by second UV set. And One more thing, I have to say is, the whole object is being black when I enable aoMap with several flip. If I not do that, then there is no effect in the model.

If you check the code from that example, it’s modifying the model after loading it to add the second UV set:

This is necessary for formats like OBJ where the file does not contain the AO map and it has to be added afterward.

5 Likes

Thank you so much for your reply @donmccurdy . Awesome. It is working :smiley:

Yeaay, it is working, Thanks :slight_smile:

In the current version of the example you mantioned uv2 is not there anymore. We don’t need to specify a 2nd uv set while using aO maps with the same uv layout or am I missing something?

This isn’t required in recent three.js versions, correct. If your aoMap was designed for a different set of UVs than other textures, you’d specify that with aoMap.channel = 1 (or whichever index).

2 Likes