How do I bind multiple outputs of a shader to multiple textures with Threejs? I can not find any code about gl.COLOR_ATTACHMENT1~16 in Three.js,it seems always only use gl.COLOR_ATTACHMENT0.
This feature is called multiple render targets (MRT).
The reason it’s not used much is due to lack of device support. You need to use the WEBGL_draw_buffers extension, which has around 37% support, or WebGL2, which has around 54% support.
There’s a PR to add WebGL2 MRT to three.js:
It would be nice to add WebGL1 support using draw_buffers as well. But until the level of support goes up, I guess there’s just not much interest.
1 Like
Thank you for answering my question. It was very helpful
/cc