Active draw buffers with missing fragment shader outputs

I just wanted to share some notes about this error, since i encountered it a while back, solved it, and then recently took me a while to remember what it was about.

When drawing to multiple render targets we need to specify outputs like so:

layout(location = 0) out vec4 foo;
layout(location = 1) out vec4 bar;

We can still draw whatever, eg new MeshBasicMaterial or some arbitrary ShaderMaterial but if these outputs are not specified (location=0,location=1 for the WebGLRenderTarget count of 2) we get this error.

I forgot that i added a copy of an object to display the wireframe and kept seeing this error.

3 Likes