示例#1
0
 internal void DetermineWorkflow(MaterialProperty[] props)
 {
     if (ShaderGUI.FindProperty("_SpecGlossMap", props, false) != null && ShaderGUI.FindProperty("_SpecColor", props, false) != null)
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Specular;
     }
     else if (ShaderGUI.FindProperty("_MetallicGlossMap", props, false) != null && ShaderGUI.FindProperty("_Metallic", props, false) != null)
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Metallic;
     }
     else
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Dielectric;
     }
 }
示例#2
0
 public void FindProperties(MaterialProperty[] props)
 {
     this.blendMode     = ShaderGUI.FindProperty("_Mode", props);
     this.albedoMap     = ShaderGUI.FindProperty("_MainTex", props);
     this.albedoColor   = ShaderGUI.FindProperty("_Color", props);
     this.alphaCutoff   = ShaderGUI.FindProperty("_Cutoff", props);
     this.specularMap   = ShaderGUI.FindProperty("_SpecGlossMap", props, false);
     this.specularColor = ShaderGUI.FindProperty("_SpecColor", props, false);
     this.metallicMap   = ShaderGUI.FindProperty("_MetallicGlossMap", props, false);
     this.metallic      = ShaderGUI.FindProperty("_Metallic", props, false);
     if (this.specularMap != null && this.specularColor != null)
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Specular;
     }
     else if (this.metallicMap != null && this.metallic != null)
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Metallic;
     }
     else
     {
         this.m_WorkflowMode = WallTilingShaderGUI.WorkflowMode.Dielectric;
     }
     this.smoothness           = ShaderGUI.FindProperty("_Glossiness", props);
     this.smoothnessScale      = ShaderGUI.FindProperty("_GlossMapScale", props, false);
     this.smoothnessMapChannel = ShaderGUI.FindProperty("_SmoothnessTextureChannel", props, false);
     this.highlights           = ShaderGUI.FindProperty("_SpecularHighlights", props, false);
     this.reflections          = ShaderGUI.FindProperty("_GlossyReflections", props, false);
     this.bumpScale            = ShaderGUI.FindProperty("_BumpScale", props);
     this.bumpMap                   = ShaderGUI.FindProperty("_BumpMap", props);
     this.heigtMapScale             = ShaderGUI.FindProperty("_Parallax", props);
     this.heightMap                 = ShaderGUI.FindProperty("_ParallaxMap", props);
     this.occlusionStrength         = ShaderGUI.FindProperty("_OcclusionStrength", props);
     this.occlusionMap              = ShaderGUI.FindProperty("_OcclusionMap", props);
     this.emissionColorForRendering = ShaderGUI.FindProperty("_EmissionColor", props);
     this.emissionMap               = ShaderGUI.FindProperty("_EmissionMap", props);
     this.detailMask                = ShaderGUI.FindProperty("_DetailMask", props);
     this.detailAlbedoMap           = ShaderGUI.FindProperty("_DetailAlbedoMap", props);
     this.detailNormalMapScale      = ShaderGUI.FindProperty("_DetailNormalMapScale", props);
     this.detailNormalMap           = ShaderGUI.FindProperty("_DetailNormalMap", props);
     this.uvSetSecondary            = ShaderGUI.FindProperty("_UVSec", props);
 }
示例#3
0
        private static void SetMaterialKeywords(Material material, WallTilingShaderGUI.WorkflowMode workflowMode)
        {
            WallTilingShaderGUI.SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap"));
            if (workflowMode == WallTilingShaderGUI.WorkflowMode.Specular)
            {
                WallTilingShaderGUI.SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap"));
            }
            else if (workflowMode == WallTilingShaderGUI.WorkflowMode.Metallic)
            {
                WallTilingShaderGUI.SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap"));
            }
            WallTilingShaderGUI.SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap"));
            WallTilingShaderGUI.SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap"));
            MaterialEditor.FixupEmissiveFlag(material);
            bool state = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == MaterialGlobalIlluminationFlags.None;

            WallTilingShaderGUI.SetKeyword(material, "_EMISSION", state);
            if (material.HasProperty("_SmoothnessTextureChannel"))
            {
                WallTilingShaderGUI.SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", WallTilingShaderGUI.GetSmoothnessMapChannel(material) == WallTilingShaderGUI.SmoothnessMapChannel.AlbedoAlpha);
            }
        }
示例#4
0
 private static void MaterialChanged(Material material, WallTilingShaderGUI.WorkflowMode workflowMode)
 {
     WallTilingShaderGUI.SetupMaterialWithBlendMode(material, (WallTilingShaderGUI.BlendMode)material.GetFloat("_Mode"));
     WallTilingShaderGUI.SetMaterialKeywords(material, workflowMode);
 }