赞
踩
private void ModelMaterialBlur(GameObject _goModel) { Transform[] _trans = _goModel.GetComponentsInChildren<Transform>(); if (_trans != null && _trans.Length != 0) { for (int i = 0; i < _trans.Length; i++) { MeshRenderer _meshs = _trans[i].GetComponent<MeshRenderer>(); if (_meshs != null) { foreach (Material mat in _meshs.materials) { if (!mat.HasProperty("_Color")) continue; mat.SetFloat("_Mode", 2); Color color = mat.color; color.a = 0.2f; mat.SetColor("_Color", color); mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha); mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); mat.SetInt("_ZWrite", 0); mat.DisableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.renderQueue = 3000; } } } } }
private void UnModelMaterialBlur(GameObject _goModel) { Transform[] _trans = _goModel.GetComponentsInChildren<Transform>(); if (_trans != null && _trans.Length != 0) { for (int i = 0; i < _trans.Length; i++) { MeshRenderer _meshs = _trans[i].GetComponent<MeshRenderer>(); if (_meshs != null) { foreach (Material mat in _meshs.materials) { if (!mat.HasProperty("_Color")) continue; mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); mat.SetInt("_ZWrite", 1); mat.DisableKeyword("_ALPHATEST_ON"); mat.DisableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.renderQueue = -1; } } } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。