Share the same texture uniform input and WebGLRenderTarget

Share the same texture uniform input and WebGLRenderTarget within the same draw call.

Is this possible to do and is it going to have any performance hit?

Am I correct that with each draw call the texture of the render target within the frame buffer will be updated and I’m able to read this texture data result in uniform for the next object draw call?

It is not possible to use a texture to read and write from/into a framebuffer in the same frame. The WebGL spec considers this as an invalid operation.

In three.js terms that means you can use the texture property of a render target as a input texture (e.g. material.map = renderTarget.texture) and also use the render target as the render destination (meaning renderer.setRenderTarget( renderTarget )) in the same frame.

2 Likes