Exemplo n.º 1
0
        public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
        {
            if (material.HasProperty(MKGlassFreeMaterialHelper.PropertyNames.EMISSION))
            {
                MKGlassFreeMaterialHelper.SetEmissionColor(material, material.GetColor(MKGlassFreeMaterialHelper.PropertyNames.EMISSION));
            }

            base.AssignNewShaderToMaterial(material, oldShader, newShader);

            MaterialProperty[] properties = MaterialEditor.GetMaterialProperties(new Material[] { material });
            FindProperties(properties, material);

            SetGIFlags();
        }
Exemplo n.º 2
0
        //Setup GI emission
        private void SetGIFlags()
        {
            foreach (Material obj in emissionColor.targets)
            {
                bool emissive = true;
                if (MKGlassFreeMaterialHelper.GetEmissionColor(obj) == Color.black)
                {
                    emissive = false;
                }
                MaterialGlobalIlluminationFlags flags = obj.globalIlluminationFlags;
                if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0)
                {
                    flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack;
                    if (!emissive)
                    {
                        flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
                    }

                    obj.globalIlluminationFlags = flags;
                }
            }
        }