Welcome to Unity Learning,Unity training ,UnityEnterprise TrainingEducation Area, there are manyUnity3d Resources,Unity3d Training Video,Unity3d Tutorials,Unity3d Frequently Asked questions,Unity3d Project Source code, the "Dog Planing Learning Network" Unity's Ultimate Academy, dedicated to building the industry unity3d Training , learning the first brand.
You can modify the alpha representation of a blocking material when there is a barrier between the character and the camera, such as a wall.
Using Unityengine;
Using System.Collections;
public class Example:monobehaviour {
void Update () {
Raycasthit[]
Hits
hits = Physics.raycastall (Transform.position, Transform.forward, 100.0F);
int i = 0;
while (I hits. Length) {
Raycasthit hit = Hits
;
Renderer Renderer = hit.collider.renderer;
if (renderer) {
Renderer.material.shader = Shader.find ("Transparent/diffuse");
Renderer.material.color = new Color (RENDERER.MATERIAL.COLOR.R,
RENDERER.MATERIAL.COLOR.G,
Renderer.material.color.b,
0.3F);
}
i++;
}
}
}
You can also show the perspective of a person like the light of a torch.
Draw occluded part ZTest Off, ZTest Greater
Draw the ZTest part of the mask on, ztestlequal
Effect
For more information, please visit the "Dog Planing Learning Network" Unity Ultimate Academy
Statement: This document comes from the "Dog Planing Learning Network" Community-unity Extreme College, is a self-published Unity3d study articles, if anything violates your relevant interests, please communicate with the official, we will deal with the real-time.
X-ray effect of "Unity3d" Torch Light