- Home /
Overdraw view on specific objects?
Hello,
I was messing around on Unity, and I was able to change the viewing from RGB to a feature called 'Overdraw' - this looks kind of cool for objects that 'need placing' within the game.
How would I go about having this Overdraw on a specific object, like a material or something?
Thanks
Answer by Peter G · Mar 15, 2011 at 08:28 PM
You just need an alpha-blended shader, and I'm not going to mess with image effects. You could add one if you think you need it though.Here is a simple shader:
Shader "Overdraw" { Properties { _MainColor ("Color (RGB) Alpha (A)" , Color ) = (0, 0, 0, 0) } SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } //Tags are important. Queue tells Unity to render this object after we render all the solid geometry. //Otherwise they would write over us.
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
//Alpha Blending (_MainColor.rgb * _MainColor.a + _CurrentPixelColor.rgb * (1 - _MainColor.a) = Final Color on Screen.
Pass {
Color [_MainColor]
}
}
}
You could add a texture in if you wanted, but this just colors the object one color, and alpha blends based on the colors alpha.
Steps:
Create a material with this shader.
Choose the color you want. Unity uses orange.
Adjust the alpha. You do this in the color picker. There is a alpha slider option.
Answer by efge · Mar 15, 2011 at 07:10 PM
You could use a simple self-illumination shader like Self-Illumin/Diffuse for the objects and a Glow Image Effect on your camera. The alpha channel texture for the shader controls the self-illumination, so make sure only your specific objects have this texture or shader applied. You can assign this texture via script by Material.SetTexture.