Multiple Render Targets

http://devmaster.net/posts/3100/shader-effects-glow-bloom. Using this to create my own custom glow pipeline.

Found this function below which I think will let me efficiently render glow maps. Couple questions.

static function SetRenderTarget (colorBuffers : RenderBuffer[], depthBuffer : RenderBuffer) : void
  1. What shader models are supported by this? I assume GL ES 2.0 doesn’t but just curious. If all that’s pretty cool.

  2. How on earth do I output this from my shader?

struct PSoutput
{
   float4 main : Color0;
   float4 emissive : Color1;
   float   depth :smile:EPTH;
};

PSoutput frag(fragmentInput v2f)
{
   PSoutput o;
   //initialize color0 and color1 but depth should do itself 
   return o;
}

is my guess but that doesn’t seem right.

  1. Do I need to set the depth buffer value or will that automatically be grabbed? if I need to set it what value is it? just position.z in screenSpace?

  2. Will other shaders default to using colorbuffer0 automatically or would I have to rewrite the whole shader library >.<.

Just want more information before I tread to far forward into this murky territory.

You didn’t happen to get it working, did you? I’m trying it myself, pretty much the same code as you have there, and the shader works just fine. But it seems like Unity sets the rendertargets itself somewhere before OnPreRender. If i use SetRenderTargets in Start nothing happens. The two textures are empty but i can still see the same i had before.
If i use SetRenderTargets later in i.e. OnPreRender all i get is black. Nothing inside the rendertargets, just pure black and the gamewindow is black as well. Got no clue what i’m doing wrong or if it is even possible to properly use it outside of post processing effects.

EDIT:
Checked it again. Still doesn’t work, but what i can see is that the textures do in fact get cleared. But nothing is drawn, although the shader clearly works just fine.