make (partialy) hidden obects visible

Hello everyone!
I dont know, if this can be done easily, the effect is used in many strategy games to make finding units easier.

is it possible to do it in a shader, maybe in combination with a multi-camera setup. like here: http://www.unifycommunity.com/wiki/index.php?title=DepthMask

these examples are from aoe3 and dawn of war

59284--2164--$hiddenobjects_100.jpg

Add a pass you your shader with a simple blended or additive color, with Ztest less.

Wow, i didnt think it would be that easy. thank you!
After playing around a bit with passes and ztest i managed to create exactly the desired effect.

Shader "seethrough" {
Properties {
		_Color ("Main Color", Color) = (1,1,1,1)
		_BlendColor ("BlendColor, Alpha", Color) = (1,1,1,1)
		_MainTex ("Base (RGB)", 2D) = "white" {}
	}
	Category {
				Tags {"Queue"="Transparent"}

	SubShader {
				Pass {
				Blend One One

				Cull Back
				Lighting Off
				Color [_BlendColor]
				
				ZWrite Off ZTest Greater

			}
	Pass {
		ZWrite On ZTest less

		Material {
			Diffuse [_Color]
			Ambient [_Color]
			Shininess [_Shininess]
			Specular [_SpecColor]
			Emission [_Emission]
		} 
		Lighting On
		SeparateSpecular On
		SetTexture [_MainTex] {
			Combine texture * primary DOUBLE, texture * primary
		}
		 
	}
	}
	} 
}

59431--2172--$seethrough_107.jpg

Cool stuff! Thanks to both of you guys for opening up a whole realm of new effects for me using this method. I came up with half a dozen new shaders today that use this effect… masking objects, revealing them, swapping textures once they’re behind or in front of another object, etc… so much fun!

It got me interested in making some boolean shaders with this technique too using ColorMask A, but I think that requires some Cg to flip normals around.

Anyway, thanks again, for some reason this topic opened my mind up just a bit more to how shaders work. So much potential craziness!

Nope, just write Cull Front to flip the normals. (though the lighting, if any, will be inverse)

Hello,

I have no idea about shader scripting but i have been looking for a shader like this for a while. The only problem i am running into is if the object you put the shader on has children.

Robot:
->Gun
->Mesh:
—>…etc

is there a way around this?

Jake

stuck on the same problem, the character part is always behind the weapon, so the occluded part on the body is always rendered will the semi-transparent pass. Any solution for this problem?

Use Material.renderqueue to draw your character’s things after you draw your character.