Glow shader on selective objects?

Hello! I've understood that the glow shader affects objects based on the alpha channel. I have an object in my scene that I don't want to be affected by glow, but it needs to have an alpha activated. The reason for this is that when other glowing objects pass over it, the glow effect gets multiplied or something which looks awesome but crazy. And unfortunately we cannot ship with that "feature" =P

Can I use a twin camera technique or something? Have one camera that sees everything that's supposed to glow and then overlay that to the camera the player looks through?

I have Pro. Thanks for reading! Phil

EDIT - quote from forum:

I think there's still some confusion in this thread as to how the glow effect works. As Jonathan said, most built-in shaders allow you to change the glow on a per-texel basis using the alpha channel of the main texture, and modulate it using the main colour's alpha (just like you can modulate the colour of the whole object).

The only time you need a special shader is when you have a shader that uses its texture alpha channel for something else. Usually, these shaders do not write to the screen's alpha, and so you can do one of two things:

  1. Add a pass (and possibly a source texture) to the shader in that writes alpha to the screen.
  2. Duplicate the geometry you want to glow, and use an alpha-only shader, such as "Fire zee alpha" from above, or something that gives you a source texture.

I'd like to really understand this matter, which I don't right now. Sorry for the n00bish nonsense coming up.

I understand from above that the shader written in the thread (Fire ze alpha) will make stuff glow. This is fine. But my problem remains; I have stuff in scene that glows because they use alpha for a semi-transparent texture (in some areas transparent, it's a galaxy picture). How will this help me if two semi-transparent textures get on top of each other and fire off this huge bloom?

I'm really sorry for being so daft.. I have no experience with shader programming and I didn't really understand the whole concept from the unity-video explaining how shaders work. I'm really grateful for any explanation as I'm having a hard time grasping it all (I suspect there are more than me!) :)

Cant you place the non glow objects on a separate layer and use a second camera that renders only those objects without the glow effect?

Hey phildude,

I recently came across the exact same bump. There is actually a few threads on the forums that discuss this as well. There is a shader example in the thread here that should give you a helping hand.

[Edit]

In response to your edit above -

What the glow shader does is go over your fully rendered frame, and use the alpha value of all of your objects to determine how much glow shows (full opaque is max glow, full transparent is no glow).

I believe this much you already know. So, the question is how you get an object that actually uses the alpha channel to give the material translucency to not glow.

What I did was duplicate the object I wanted to override the alpha of and apply an Alpha Override material to it.

The alpha override material used this shader:

Shader "Alpha Override" {
Properties
{
   _Color ("Main Color", Color) = (1,1,1,1)
   _GlowMap ("Glow (A)", 2D) = "bump" {}
   }
   Category
{
   Tags {"Queue" = "Transparent" }
      SubShader
   {
            Pass
      {                 
        ZWrite Off
              Offset -1, -1
              Cull Back
        Colormask A
        SetTexture [_GlowMap]
        {
           constantColor [_Color]
           combine constant, texture * constant
        }

      }
     }
  }

--it got a little messed up in copying it over but meh, it's all there.

I suppose you could also attach this as a second material to the same Mesh Renderer as well, but for what I used it for I needed a separate transform all together.

Hope that helps!

==

Which shader specifically is the model that you don't want to glow using?

Since the problem is that it renders its final alpha into the alpha of the color buffer, would not simply disabling writing to alpha fix the issue? Off hand I don't think disabling writing the alpha would stop it being rendered with alpha, but have never tested it myself. However if you have several alpha textured models overlaying each other using this method it might cause graphical issues, so may not be a fix for all cases.

To be clear I'm talking about adding, ColorMask RGB to the shader pass, this means only RGB values are written into the colour buffer, but not alpha.