This is now possible. However, I would NOT recommend it - the way to do it involves using undocumented functions and private variables. This is very bad practice.
In other words, do it this way only if you MUST do it now and cannot wait for wade 3.8. Because in wade 3.8 there will be a much nicer (and much easier) way of doing this.
Having said that, here's how you can read the pixels from other layers without slowing things down. For this example, let's say that you have a sprite on Layer 1 that wants to read the pixels of Layer 2 and Layer 3.
First of all, you need to set Layer 2 and Layer 3 to use off-screen render targets. You do this by calling wade.setLayerRenderMode after loading your scene. It is important to do it after loading the scene, because the scene loading code sets the layer render mode and may override what you're doing manually
wade.setLayerRenderMode(2, 'webgl', {offScreenTarget: true});
wade.setLayerRenderMode(3, 'webgl', {offScreenTarget: true});
Now if you create an object on layer 1, when it is added to the scene you can do this to bind the layer 2 and layer 3 textures to pixel shader uniforms called t2 and t3 (for example you can do this in the object's onAddToScene):
// first draw all layers at least once
wade.draw();
// then change the draw function of the sprite
var sprite = this.getSprite();
sprite.setDrawFunction(function(gl)
{
// get layers directly - wade.getLayer is undocumented, so this is BAD
var l2 = wade.getLayer(2);
var l3 = wade.getLayer(3);
// get the main render target textures - private variables == BAD
var t2 = l2._mainRenderTarget.texture;
var t3 = l3._mainRenderTarget.texture;
// bind layer textures to the gl context and set them up
gl.activeTexture(gl.TEXTURE1);
gl.bindTexture(gl.TEXTURE_2D, t2);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.textures.t2 = t2;
gl.activeTexture(gl.TEXTURE2);
gl.bindTexture(gl.TEXTURE_2D, t3);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.textures.t3 = t3;
gl.activeTexture(gl.TEXTURE0);
// call the default draw function
this.drawStatic_gl(gl);
});
Then edit your object's sprite and add 2 shader uniforms called t2 and t3, both of type sampler2D.
Finally, edit the sprite pixel shader to use textures t2 and t3 to do whatever you like. For example:
vec2 uv = uvAlphaTime.xy;
uv.y = 1. - uv.y; // flip Y axis
vec4 c2 = texture2D(t2, uv);
vec4 c3 = texture2D(t3, uv);
gl_FragColor = c2 + c3;