• 【Unity3d】火炬之光的X射线效果


    http://www.cnblogs.com/dosomething/archive/2012/04/03/2431149.html

    人物和摄像机之间存在例如墙壁等的阻挡时  可以修改阻挡材质的alpha呈现半透明状 

    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[i];
                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++;
            }
        }
    }                               

    也可以像火炬之光那样  显示人物的透视效果

    绘制被遮挡部分 ZTest Off,  ZTest Greater

    绘制未被遮挡部分 ZTest On, ZTest LEqual

    效果

  • 相关阅读:
    2019ICPC徐州 H.Yuuki and a problem
    wprintf 输出中文
    bit数组
    Vs2010 Atl工程手工添加连接点
    dll非模态窗口不响应按钮消息
    VC中给控件添加ToolTip
    在Dialog中添加工具条
    在Dialog中添加状态栏
    Vc添加快捷键
    在VC中调用COM组件的方法
  • 原文地址:https://www.cnblogs.com/123ing/p/4150074.html
Copyright © 2020-2023  润新知