aoMap from a 2d canvas?

Edit: Got it working…

I’m having a heck of time trying to use a 2d canvas for my dynamic aoMap in my MeshStandardMaterial. I simply can’t get them to cooperate, and the ao does not appear on mesh. While testing I am able to pop the same canvas into a (regular) MeshStandardMaterial map, without changing anything, and it works fine. Can aoMaps ( and roughnessMaps etc) only use loaded textures via THREE.TextureLoader()? Someone please tell me it is possible to use a canvas for aoMaps…

Three.js (webGL rasterizer) does not care how the texture is constructed as long as the texture is in a valid format.

Have you tried to save the created canvas image to use it directly? How the canvas buffer is passed to the texture object may cause the issue. Try to use a “simple canvas” and see where the process fails…

To see the changes, if you are passing the canvas at run time, you have to call the

texture.needsUpdate = true;

You can check out this “unofficial” example for reference Using canvas as ThreeJS texture · GitHub