public static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular && material.HasProperty("_SpecGlossMap")) SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic && material.HasProperty("_MetallicGlossMap")) SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(material.GetColor("_EmissionColor")); SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } SetKeyword(material, "_VERTEXCOLOR", material.GetFloat("_IntensityVC") > 0f); }
public string CreateInstance(string nodeID, string resource, WorkflowMode mode) { string instanceID = Guid.NewGuid().ToString(); string sql = "INSERT INTO T_INSTANCE(InstanceID,RelationshipID,State,Resource,Mode) VALUES(@InstanceID,@RelationshipID,@State,@Resource,@Mode)"; base.Connection.Execute(sql, new { InstanceID = instanceID, RelationshipID = nodeID, State = WorkflowInstanceState.Running.ToString(), Resource = resource, Mode = mode.ToString() }); return(instanceID); }
internal void DetermineWorkflow(MaterialProperty[] props) { if ((ShaderGUI.FindProperty("_SpecGlossMap", props, false) != null) && (ShaderGUI.FindProperty("_SpecColor", props, false) != null)) { this.m_WorkflowMode = WorkflowMode.Specular; } else if ((ShaderGUI.FindProperty("_MetallicGlossMap", props, false) != null) && (ShaderGUI.FindProperty("_Metallic", props, false) != null)) { this.m_WorkflowMode = WorkflowMode.Metallic; } else { this.m_WorkflowMode = WorkflowMode.Dielectric; } }
public string CreateInstance(string nodeID, string resource, WorkflowMode mode, Action <string, object> execute) { string instanceID = Guid.NewGuid().ToString(); execute(ResourceManage.SQL_WORKFLOW_INSTANCE_INSERT, new { InstanceID = instanceID, RelationshipID = nodeID, State = WorkflowInstanceState.Running.ToString(), Resource = resource, Mode = mode.ToString() }); return(instanceID); }
static void MaterialChanged(Material material, WorkflowMode workflowMode) { // Clamp EmissionScale to always positive if (material.GetFloat("_EmissionScaleUI") < 0.0f) material.SetFloat("_EmissionScaleUI", 0.0f); // Apply combined emission value Color emissionColorOut = EvalFinalEmissionColor(material); material.SetColor("_EmissionColor", emissionColorOut); // Handle Blending modes SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode")); SetMaterialKeywords(material, workflowMode); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap") || material.GetTexture("_TopSpecGlossMap") || material.GetTexture("_BottomSpecGlossMap") ); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap") || material.GetTexture("_TopMetallicGlossMap") || material.GetTexture("_BottomMetallicGlossMap") ); } bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(material.GetColor("_EmissionColor")) || (material.HasProperty("_TopMultiplier") && material.GetFloat("_TopMultiplier") > MIN_VALUE && ShouldEmissionBeEnabled(material.GetColor("_TopEmissionColor"))) || (material.HasProperty("_BottomMultiplier") && material.GetFloat("_BottomMultiplier") > MIN_VALUE && ShouldEmissionBeEnabled(material.GetColor("_BottomEmissionColor"))); SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); // Triplanar texture space SetKeyword(material, "_UVFREE_LOCAL", material.GetFloat("_TriplanarSpace") == (float)Space.Self); // whether the bottom is enabled SetKeyword(material, "_UVFREE_BOTTOM", material.GetFloat("_BottomMultiplier") > (0.1f / 255.0f)); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) { flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } material.globalIlluminationFlags = flags; } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular && material.HasProperty("_SpecGlossMap")) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic && material.HasProperty("_MetallicGlossMap")) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); } material.DisableKeyword("_PARALLAXMAP"); material.DisableKeyword("_POM"); if (material.GetTexture("_ParallaxMap")) { float pm = material.GetFloat("_ParallaxMode"); if (pm == 1) { material.EnableKeyword("_PARALLAXMAP"); } else if (pm == 2) { material.EnableKeyword("_POM"); } } SetKeyword(material, "_DETAIL_MULX2", material.GetFloat("_DetailMode") == 0 && (material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap"))); SetKeyword(material, "_DETAIL_SINGLE", material.GetFloat("_DetailMode") == 1 && (material.GetTexture("_DetailAlbedoSingle") || material.GetTexture("_DetailNormalSingle"))); // A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect // or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color. // The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color. //MaterialEditor.FixupEmissiveFlag(material); //bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; //SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); float emode = material.GetFloat("_EmissionMode"); SetKeyword(material, "_EMISSION", emode == 2 && material.GetTexture("_EmissionMap") != null); SetKeyword(material, "_EMISSION_COLOR", emode == 1); if (material.HasProperty("_SmoothnessTextureChannel")) { SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha); } }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); porosity = FindProperty("_Porosity", props, false); wetness = FindProperty("_Wetness", props, false); rippleMap = FindProperty("_RaindropRipple", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (porosity != null && wetness != null) { m_WorkflowMode = WorkflowMode.Wet; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); smoothnessScale = FindProperty("_GlossMapScale", props, false); smoothnessMapChannel = FindProperty("_SmoothnessTextureChannel", props, false); highlights = FindProperty("_SpecularHighlights", props, false); reflections = FindProperty("_GlossyReflections", props, false); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); cullMode = FindProperty("_CullMode", props, false); albedoMap = FindProperty("_MainTex", props); alphaMap = FindProperty("_AlphaTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); overlayMap = FindProperty("_Overlay", props); overlayColor = FindProperty("_OverlayColor", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); smoothnessTweak1 = FindProperty("_SmoothnessTweak1", props, false); smoothnessTweak2 = FindProperty("_SmoothnessTweak2", props, false); smoothnessTweaks = FindProperty("_SmoothnessTweaks", props, false); specularMapColorTweak = FindProperty("_SpecularMapColorTweak", props, false); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); orthoNormalize = FindProperty("_Orthonormalize", props, false); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); smoothnessInAlbedo = FindProperty("_SmoothnessInAlbedo", props, false); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); smoothnessScale = FindProperty("_GlossMapScale", props, false); smoothnessMapChannel = FindProperty("_SmoothnessTextureChannel", props, false); highlights = FindProperty("_SpecularHighlights", props, false); reflections = FindProperty("_GlossyReflections", props, false); disableLighting = FindProperty("_DisableLighting", props, false); useEmissiveAsIllumination = FindProperty("_UseEmissiveAsIllumination", props, false); roughness = FindProperty("_Roughness", props, false); useRoughnessAlpha = FindProperty("_UseRoughnessFromMetallicTextureAlpha", props, false); useRoughnessGreen = FindProperty("_UseRoughnessFromMetallicTextureGreen", props, false); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); alphaMode = FindProperty("_AlphaMode", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionScaleUI = FindProperty("_EmissionScaleUI", props); emissionColorUI = FindProperty("_EmissionColorUI", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); //edited terrainalbedo = FindProperty("_TerrainTex", props); terrainbump = FindProperty("_TerrainBump", props); colorcorrection = FindProperty("_ColorCorrection", props); terrainglossiness = FindProperty("_TerrainGlossiness", props); terrainmetallic = FindProperty("_TerrainMetallic", props); terrainblend = FindProperty("_Blend", props); terrainblendoffset = FindProperty("_BlendOffset", props); }
public void FindProperties(MaterialProperty[] props) { mk_glow_system_material_color = FindProperty("_MKGlowColor", props); mk_glow_system_material_glowPower = FindProperty("_MKGlowPower", props); mk_glow_system_material_glowtex = FindProperty("_MKGlowTex", props); mk_glow_system_material_glowtexColor = FindProperty("_MKGlowTexColor", props); mk_glow_system_material_glowtexColorStrength = FindProperty("_MKGlowTexStrength", props); mk_glow_system_material_glowOffset = FindProperty("_MKGlowOffSet", props); blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionScaleUI = FindProperty("_EmissionScaleUI", props); emissionColorUI = FindProperty("_EmissionColorUI", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); SetKeyword(material, "ORTHONORMALIZE_TANGENT_BASE", material.HasProperty("__orthonormalize") && material.GetFloat("__orthonormalize") > 0.5f); SetKeyword(material, "SMOOTHNESS_IN_ALBEDO", material.HasProperty("__smoothnessinalbedo") && material.GetFloat("__smoothnessinalbedo") > 0.5f && !material.GetTexture("_SpecGlossMap")); if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); } SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); }
internal void DetermineWorkflow(Material material) { var shader = material.shader; if (ShaderHasProperty(shader, _SpecGlossMap) && ShaderHasProperty(shader, _SpecColor)) { m_WorkflowMode = WorkflowMode.Specular; } else if (ShaderHasProperty(shader, _MetallicGlossMap) && ShaderHasProperty(shader, _Metallic)) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap")); if (workflowMode == WorkflowMode.SpecularGlossiness) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.MetallicRoughness) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); } bool shouldEmissionBeEnabled = material.GetColor("_EmissionColor") != Color.black; SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); smoothnessScale = FindProperty("_GlossMapScale", props, false); smoothnessMapChannel = FindProperty("_SmoothnessTextureChannel", props, false); highlights = FindProperty("_SpecularHighlights", props, false); reflections = FindProperty("_GlossyReflections", props, false); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); vertexColor = FindProperty("_IntensityVC", props); startTime = FindProperty("_StartTime", props); disSpeed = FindProperty("_DissolveSpeed", props); duration = FindProperty("_Duration", props); // noise = FindProperty("_NoiseTex", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionScaleUI = FindProperty("_EmissionScaleUI", props); emissionColorUI = FindProperty("_EmissionColorUI", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); // RTP - geom blend _TERRAIN_HeightMap = FindProperty("_TERRAIN_HeightMap", props); _TERRAIN_Control = FindProperty("_TERRAIN_Control", props); _TERRAIN_PosSize = FindProperty("_TERRAIN_PosSize", props); _TERRAIN_Tiling = FindProperty("_TERRAIN_Tiling", props); }
//static bool rimOn = true; public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); cullMode = FindProperty("_CullMode", props, false); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); smoothMap = FindProperty("_SmoothMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); smoothnessTweak1 = FindProperty("_SmoothnessTweak1", props, false); smoothnessTweak2 = FindProperty("_SmoothnessTweak2", props, false); smoothnessTweaks = FindProperty("_SmoothnessTweaks", props, false); specularMapColorTweak = FindProperty("_SpecularMapColorTweak", props, false); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); orthoNormalize = FindProperty("_Orthonormalize", props, false); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); rimColor = FindProperty("_RimColor", props); rimPower = FindProperty("_RimPower", props, false); rimLevel = FindProperty("_RimLevel", props, false); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); //alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); parallaxMode = FindProperty("_ParallaxMode", props); parallaxSteps = FindProperty("_ParallaxSteps", props); if (specularMap != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothnessMapChannel = FindProperty("_SmoothnessTextureChannel", props, false); highlights = FindProperty("_SpecularHighlights", props, false); reflections = FindProperty("_GlossyReflections", props, false); bumpMap = FindProperty("_BumpMap", props); heightMap = FindProperty("_ParallaxMap", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionMap = FindProperty("_EmissionMap", props); emissionMode = FindProperty("_EmissionMode", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMap = FindProperty("_DetailNormalMap", props); detailAlbedoSingle = FindProperty("_DetailAlbedoSingle", props); detailNormalSingle = FindProperty("_DetailNormalSingle", props); uvSetSecondary = FindProperty("_UVSec", props); detailMode = FindProperty("_DetailMode", props); attrImg = FindProperty("_AttrImg", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionScaleUI = FindProperty("_EmissionScaleUI", props); emissionColorUI = FindProperty("_EmissionColorUI", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); causticsStartLevel = FindProperty("_CausticsStartLevel", props); causticsShallowFadeDistance = FindProperty("_CausticsShallowFadeDistance", props); causticsScale = FindProperty("_CausticsScale", props); causticsDrift = FindProperty("_CausticsDrift", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); uvSetSecondary = FindProperty("_UVSec", props); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); } SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(material, material.GetColor("_EmissionColor")); SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); if (material.HasProperty("_SmoothnessTextureChannel")) { SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha); } // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) { flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } material.globalIlluminationFlags = flags; } //if we want the primary section plane to appear in material preview: //material.DisableKeyword("CLIP_PLANE");//if we want the primary section plane to appear in material preview //Shader.SetGlobalVector("_SectionPlane", new Vector3(0.707f,0,-0.2f)); //Shader.SetGlobalVector("_SectionPoint", Vector3.zero); }
public void FindProperties(MaterialProperty[] props) { triplanarSpace = FindProperty("_TriplanarSpace", props, false); texturePower = FindProperty("_TexPower", props, false); vertexColorStrength = FindProperty("_VertexColorStrength", props, false); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); heigtMapScale = FindProperty("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); occlusionMap = FindProperty("_OcclusionMap", props); emissionScaleUI = FindProperty("_EmissionScaleUI", props); emissionColorUI = FindProperty("_EmissionColorUI", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); detailMask = FindProperty("_DetailMask", props); detailAlbedoMap = FindProperty("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty("_DetailNormalMapScale", props); detailNormalMap = FindProperty("_DetailNormalMap", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty("_Mode", props); albedoMap = FindProperty("_MainTex", props); albedoColor = FindProperty("_Color", props); alphaCutoff = FindProperty("_Cutoff", props); specularMap = FindProperty("_SpecGlossMap", props, false); specularColor = FindProperty("_SpecColor", props, false); metallicMap = FindProperty("_MetallicGlossMap", props, false); metallic = FindProperty("_Metallic", props, false); if (specularMap != null && specularColor != null) { m_WorkflowMode = WorkflowMode.Specular; } else if (metallicMap != null && metallic != null) { m_WorkflowMode = WorkflowMode.Metallic; } else { m_WorkflowMode = WorkflowMode.Dielectric; } smoothness = FindProperty("_Glossiness", props); bumpScale = FindProperty("_BumpScale", props); bumpMap = FindProperty("_BumpMap", props); //heigtMapScale = FindProperty ("_Parallax", props); //heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty("_OcclusionStrength", props); //occlusionMap = FindProperty ("_OcclusionMap", props); emissionColorForRendering = FindProperty("_EmissionColor", props); emissionMap = FindProperty("_EmissionMap", props); cubeMap = FindProperty("_Cubemap", props); cubeMapStrength = FindProperty("_CubeMapStrength", props); sampleLOD = FindProperty("_SampleLOD", props); ambient = FindProperty("_Ambient", props); ambientStrength = FindProperty("_AmbientStrength", props); //detailMask = FindProperty ("_DetailMask", props); //detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props); //detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props); //detailNormalMap = FindProperty ("_DetailNormalMap", props); //uvSetSecondary = FindProperty ("_UVSec", props); }
/// <summary> /// 上一个执行跳转节点 /// </summary> /// <returns></returns> public Node GetPrevious(Node entry) { Transition transition = GetHistoryTransition(entry); if (transition == null) { return(null); } WorkflowMode mode = WorkflowGlobalServiceProvider.Resolve <IWorkflowInstanceService>().GetMode(entry.InstanceID); if (mode == WorkflowMode.Mix) { Node wrapNode = this.FindNodeByID(transition.Origin, entry.InstanceID); return(this.GetNode(wrapNode)); } else { return(base.Connection.Query <Node>(ResourceManage.SQL_WORKFLOW_NODE_SELECT_ID, new { entry.InstanceID, ID = transition.Origin }).FirstOrDefault()); } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode, TessWorkflowMode tessWorkflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); } SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); // We're setting this so that if the shader Falls back to no tessellation, the parallax height would be right material.SetFloat("_Parallax", Mathf.Lerp(0.005f, 0.08f, material.GetFloat("_Displacement"))); if (tessWorkflowMode == TessWorkflowMode.EdgeLength) { SetKeyword(material, "FT_EDGE_TESS", true); } else { SetKeyword(material, "FT_EDGE_TESS", false); } // A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect // or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color. // The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color. MaterialEditor.FixupEmissiveFlag(material); bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0; SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); if (material.HasProperty("_SmoothnessTextureChannel")) { SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha); } }
private static void MaterialChanged(Material material, WorkflowMode workflowMode) { material.SetFloat("_TemperatureMax", Mathf.Clamp(material.GetFloat("_TemperatureMax"), 0, 10000)); material.SetFloat("_TemperatureMin", Mathf.Clamp(material.GetFloat("_TemperatureMin"), 0, 10000)); SetupMaterial(material, (BlendMode)material.GetFloat("_Mode"), (CullMode)material.GetFloat("_CullMode")); SetMaterialKeywords(material, workflowMode); }
private static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); SetKeyword(material, "_EMISSION", ShouldEmissionBeEnabled(material)); SetKeyword(material, "_RADIANCE", ShouldRadianceBeEnabled(material)); SetKeyword(material, "_TEMPERATURE", ShouldTemperatureBeEnabled(material)); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!ShouldEmissionBeEnabled(material)) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword (material, "_NORMALMAP", material.GetTexture ("_BumpMap") || material.GetTexture ("_DetailNormalMap")); SetKeyword (material, "ORTHONORMALIZE_TANGENT_BASE", material.HasProperty("__orthonormalize") && material.GetFloat("__orthonormalize") > 0.5f); SetKeyword (material, "SMOOTHNESS_IN_ALBEDO", material.HasProperty("__smoothnessinalbedo") && material.GetFloat("__smoothnessinalbedo") > 0.5f && !material.GetTexture ("_SpecGlossMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword (material, "_SPECGLOSSMAP", material.GetTexture ("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword (material, "_METALLICGLOSSMAP", material.GetTexture ("_MetallicGlossMap")); SetKeyword (material, "_PARALLAXMAP", material.GetTexture ("_ParallaxMap")); SetKeyword (material, "_DETAIL_MULX2", material.GetTexture ("_DetailAlbedoMap") || material.GetTexture ("_DetailNormalMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled (material.GetColor("_EmissionColor")); SetKeyword (material, "_EMISSION", shouldEmissionBeEnabled); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } }
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 = WorkflowMode.Specular; } else if ((this.metallicMap != null) && (this.metallic != null)) { this.m_WorkflowMode = WorkflowMode.Metallic; } else { this.m_WorkflowMode = 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); }
public void FindProperties (MaterialProperty[] props) { cullMode = FindProperty ("_CullMode", props, false); albedoMap = FindProperty ("_MainTex", props); albedoColor = FindProperty ("_Color", props); specularMap = FindProperty ("_SpecGlossMap", props, false); specularColor = FindProperty ("_SpecColor", props, false); metallicMap = FindProperty ("_MetallicGlossMap", props, false); metallic = FindProperty ("_Metallic", props, false); if (specularMap != null && specularColor != null) m_WorkflowMode = WorkflowMode.Specular; else if (metallicMap != null && metallic != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; smoothness = FindProperty ("_Glossiness", props); smoothnessTweak1 = FindProperty ("_SmoothnessTweak1", props, false); smoothnessTweak2 = FindProperty ("_SmoothnessTweak2", props, false); smoothnessTweaks = FindProperty ("_SmoothnessTweaks", props, false); specularMapColorTweak = FindProperty ("_SpecularMapColorTweak", props, false); bumpScale = FindProperty ("_BumpScale", props); bumpMap = FindProperty ("_BumpMap", props); orthoNormalize = FindProperty ("_Orthonormalize", props, false); occlusionStrength = FindProperty ("_OcclusionStrength", props); occlusionMap = FindProperty ("_OcclusionMap", props); detailMask = FindProperty ("_DetailMask", props); detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props); detailNormalMap = FindProperty ("_DetailNormalMap", props); uvSetSecondary = FindProperty ("_UVSec", props); smoothnessInAlbedo = FindProperty ("_SmoothnessInAlbedo", props, false); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap")); SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled(material, material.GetColor("_EmissionColor")); SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); if (material.HasProperty("_SmoothnessTextureChannel")) { SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha); } // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } float intensity = material.GetFloat("_IntensityVC"); if (intensity <= 0f) { SetKeyword(material, "_VERTEXCOLOR_LERP", false); SetKeyword(material, "_VERTEXCOLOR", false); } else if (intensity > 0f && intensity < 1f) { SetKeyword(material, "_VERTEXCOLOR_LERP", true); SetKeyword(material, "_VERTEXCOLOR", false); } else { SetKeyword(material, "_VERTEXCOLOR_LERP", false); SetKeyword(material, "_VERTEXCOLOR", true); } }
public void FindProperties (MaterialProperty[] props) { blendMode = FindProperty ("_Mode", props); albedoMap = FindProperty ("_MainTex", props); albedoColor = FindProperty ("_Color", props); alphaCutoff = FindProperty ("_Cutoff", props); specularMap = FindProperty ("_SpecGlossMap", props, false); specularColor = FindProperty ("_SpecColor", props, false); metallicMap = FindProperty ("_MetallicGlossMap", props, false); metallic = FindProperty ("_Metallic", props, false); if (specularMap != null && specularColor != null) m_WorkflowMode = WorkflowMode.Specular; else if (metallicMap != null && metallic != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; smoothness = FindProperty ("_Glossiness", props); smoothnessScale = FindProperty ("_GlossMapScale", props, false); smoothnessMapChannel = FindProperty ("_SmoothnessTextureChannel", props, false); highlights = FindProperty ("_SpecularHighlights", props, false); reflections = FindProperty ("_GlossyReflections", props, false); disableLighting = FindProperty ("_DisableLighting", props, false); useEmissiveAsIllumination = FindProperty ("_UseEmissiveAsIllumination", props, false); roughness = FindProperty ("_Roughness", props, false); useRoughnessAlpha = FindProperty ("_UseRoughnessFromMetallicTextureAlpha", props, false); useRoughnessGreen = FindProperty ("_UseRoughnessFromMetallicTextureGreen", props, false); bumpScale = FindProperty ("_BumpScale", props); bumpMap = FindProperty ("_BumpMap", props); heigtMapScale = FindProperty ("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty ("_OcclusionStrength", props); occlusionMap = FindProperty ("_OcclusionMap", props); emissionColorForRendering = FindProperty ("_EmissionColor", props); emissionMap = FindProperty ("_EmissionMap", props); detailMask = FindProperty ("_DetailMask", props); detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props); detailNormalMap = FindProperty ("_DetailNormalMap", props); uvSetSecondary = FindProperty ("_UVSec", props); alphaMode = FindProperty ("_AlphaMode", props); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty ("_Mode", props); albedoMap = FindProperty ("_MainTex", props); albedoColor = FindProperty ("_Color", props); alphaCutoff = FindProperty ("_Cutoff", props); specularMap = FindProperty ("_SpecGlossMap", props, false); specularColor = FindProperty ("_SpecColor", props, false); metallicMap = FindProperty ("_MetallicGlossMap", props, false); metallic = FindProperty ("_Metallic", props, false); if (specularMap != null && specularColor != null) m_WorkflowMode = WorkflowMode.Specular; else if (metallicMap != null && metallic != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; smoothness = FindProperty ("_Glossiness", props); bumpScale = FindProperty ("_BumpScale", props); bumpMap = FindProperty ("_BumpMap", props); heightMapScale = FindProperty ("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty ("_OcclusionStrength", props); occlusionMap = FindProperty ("_OcclusionMap", props); emissionColorForRendering = FindProperty ("_EmissionColor", props); emissionMap = FindProperty ("_EmissionMap", props); detailMask = FindProperty ("_DetailMask", props); detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props); detailNormalMap = FindProperty ("_DetailNormalMap", props); uvSetSecondary = FindProperty ("_UVSec", props); dissolveMap = FindProperty ("_DissolveMap", props); directionMap = FindProperty ("_DirectionMap", props); dissolveAmount = FindProperty ("_DissolveAmount", props); substituteMap = FindProperty ("_SubTex", props); outerEdgeColor = FindProperty ("_OuterEdgeColor", props); innerEdgeColor = FindProperty ("_InnerEdgeColor", props); outerEdgeThickness = FindProperty ("_OuterEdgeThickness", props); innerEdgeThickness = FindProperty ("_InnerEdgeThickness", props); colorBlend = FindProperty ("_ColorBlending", props); edgeGlow = FindProperty ("_EdgeGlow", props); dissolveGlow = FindProperty ("_DissolveGlow", props); glowColor = FindProperty ("_GlowColor", props); glowIntensity = FindProperty ("_GlowIntensity", props); glowFollow = FindProperty("_GlowFollow", props); useEdgeColorRamp = FindProperty("_UseEdgeColorRamp", props); edgeColorRamp = FindProperty("_EdgeColorRamp", props); //paintGlowPower = FindProperty("_PaintGlowPower", props); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword (material, "_NORMALMAP", material.GetTexture ("_BumpMap") || material.GetTexture ("_DetailNormalMap")); SetKeyword (material, "_SUBMAP", material.GetTexture ("_SubTex")); SetKeyword (material, "_DISSOLVEMAP", material.GetTexture ("_DissolveMap"));// || material.IsKeywordEnabled("_PAINT_ON")); SetKeyword (material, "_DIRECTIONMAP", material.GetTexture ("_DirectionMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword (material, "_SPECGLOSSMAP", material.GetTexture ("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword (material, "_METALLICGLOSSMAP", material.GetTexture ("_MetallicGlossMap")); SetKeyword (material, "_PARALLAXMAP", material.GetTexture ("_ParallaxMap")); SetKeyword (material, "_DETAIL_MULX2", material.GetTexture ("_DetailAlbedoMap") || material.GetTexture ("_DetailNormalMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled (material.GetColor("_EmissionColor")) || material.IsKeywordEnabled("_DISSOLVEGLOW_ON") || material.IsKeywordEnabled("_EDGEGLOW_ON"); SetKeyword (material, "_EMISSION", shouldEmissionBeEnabled); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) if (workflowMode == WorkflowMode.Specular) SetKeyword (material, "_SPECGLOSSMAP", material.GetTexture ("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword (material, "_METALLICGLOSSMAP", material.GetTexture ("_MetallicGlossMap")); SetKeyword (material, "_PARALLAXMAP", material.GetTexture ("_ParallaxMap")); bool shouldEmissionBeEnabled = ShouldEmissionBeEnabled (material.GetColor("_EmissionColor")); SetKeyword (material, "_EMISSION", shouldEmissionBeEnabled); // Setup lightmap emissive flags MaterialGlobalIlluminationFlags flags = material.globalIlluminationFlags; if ((flags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != 0) { flags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!shouldEmissionBeEnabled) flags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; material.globalIlluminationFlags = flags; } }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty ("_Mode", props); albedoMap = FindProperty ("_MainTex", props); albedoColor = FindProperty ("_Color", props); alphaCutoff = FindProperty ("_Cutoff", props); specularMap = FindProperty ("_SpecGlossMap", props, false); specularColor = FindProperty ("_SpecColor", props, false); metallicMap = FindProperty ("_MetallicGlossMap", props, false); metallic = FindProperty ("_Metallic", props, false); if (specularMap != null && specularColor != null) m_WorkflowMode = WorkflowMode.Specular; else if (metallicMap != null && metallic != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; smoothness = FindProperty ("_Glossiness", props); heigtMapScale = FindProperty ("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty ("_OcclusionStrength", props); occlusionMap = FindProperty ("_OcclusionMap", props); emissionScaleUI = FindProperty ("_EmissionScaleUI", props); emissionColorUI = FindProperty ("_EmissionColorUI", props); emissionColorForRendering = FindProperty ("_EmissionColor", props); emissionMap = FindProperty ("_EmissionMap", props); }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword (material, "_NORMALMAP", material.GetTexture ("_BumpMap") || material.GetTexture ("_DetailNormalMap")); SetKeyword (material, "ORTHONORMALIZE_TANGENT_BASE", material.HasProperty("__orthonormalize") && material.GetFloat("__orthonormalize") > 0.5f); SetKeyword (material, "SMOOTHNESS_IN_ALBEDO", material.HasProperty("__smoothnessinalbedo") && material.GetFloat("__smoothnessinalbedo") > 0.5f && !material.GetTexture ("_SpecGlossMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword (material, "_SPECGLOSSMAP", material.GetTexture ("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword (material, "_METALLICGLOSSMAP", material.GetTexture ("_MetallicGlossMap")); SetKeyword (material, "_DETAIL_MULX2", material.GetTexture ("_DetailAlbedoMap") || material.GetTexture ("_DetailNormalMap")); }
private static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { SetKeyword(material, "_NORMALMAP", (material.GetTexture("_BumpMap") != null) || ((bool) material.GetTexture("_DetailNormalMap"))); if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", (bool) material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", (bool) material.GetTexture("_MetallicGlossMap")); } SetKeyword(material, "_PARALLAXMAP", (bool) material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", (material.GetTexture("_DetailAlbedoMap") != null) || ((bool) material.GetTexture("_DetailNormalMap"))); bool state = ShouldEmissionBeEnabled(material, material.GetColor("_EmissionColor")); SetKeyword(material, "_EMISSION", state); if (material.HasProperty("_SmoothnessTextureChannel")) { SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha); } MaterialGlobalIlluminationFlags globalIlluminationFlags = material.globalIlluminationFlags; if ((globalIlluminationFlags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != MaterialGlobalIlluminationFlags.None) { globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!state) { globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } material.globalIlluminationFlags = globalIlluminationFlags; } }
static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { // Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation // (MaterialProperty value might come from renderer material property block) SetKeyword (material, "_NORMALMAP", material.GetTexture ("_BumpMap") || material.GetTexture ("_DetailNormalMap")); if (workflowMode == WorkflowMode.Specular) SetKeyword (material, "_SPECGLOSSMAP", material.GetTexture ("_SpecGlossMap")); else if (workflowMode == WorkflowMode.Metallic) SetKeyword (material, "_METALLICGLOSSMAP", material.GetTexture ("_MetallicGlossMap")); SetKeyword (material, "_PARALLAXMAP", material.GetTexture ("_ParallaxMap")); SetKeyword (material, "_DETAIL_MULX2", material.GetTexture ("_DetailAlbedoMap") || material.GetTexture ("_DetailNormalMap")); SetKeyword (material, "_EMISSION", ShouldEmissionBeEnabled (material.GetColor("_EmissionColor"))); }
public void FindProperties(MaterialProperty[] props) { blendMode = FindProperty ("_Mode", props); albedoMap = FindProperty ("_MainTex", props); albedoColor = FindProperty ("_Color", props); alphaCutoff = FindProperty ("_Cutoff", props); specularMap = FindProperty ("_SpecGlossMap", props, false); specularColor = FindProperty ("_SpecColor", props, false); metallicMap = FindProperty ("_MetallicGlossMap", props, false); metallic = FindProperty ("_Metallic", props, false); if (specularMap != null && specularColor != null) m_WorkflowMode = WorkflowMode.Specular; else if (metallicMap != null && metallic != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; smoothness = FindProperty ("_Glossiness", props); bumpScale = FindProperty ("_BumpScale", props); bumpMap = FindProperty ("_BumpMap", props); heigtMapScale = FindProperty ("_Parallax", props); heightMap = FindProperty("_ParallaxMap", props); occlusionStrength = FindProperty ("_OcclusionStrength", props); occlusionMap = FindProperty ("_OcclusionMap", props); emissionColorForRendering = FindProperty ("_EmissionColor", props); emissionMap = FindProperty ("_EmissionMap", props); detailMask = FindProperty ("_DetailMask", props); detailAlbedoMap = FindProperty ("_DetailAlbedoMap", props); detailNormalMapScale = FindProperty ("_DetailNormalMapScale", props); detailNormalMap = FindProperty ("_DetailNormalMap", props); uvSetSecondary = FindProperty ("_UVSec", props); silhouetteColor = FindProperty("_SilhouetteColor", props); }
internal void DetermineWorkflow(MaterialProperty[] props) { if (FindProperty("_SpecGlossMap", props, false) != null && FindProperty("_SpecColor", props, false) != null) m_WorkflowMode = WorkflowMode.Specular; else if (FindProperty("_MetallicGlossMap", props, false) != null && FindProperty("_Metallic", props, false) != null) m_WorkflowMode = WorkflowMode.Metallic; else m_WorkflowMode = WorkflowMode.Dielectric; }
static void MaterialChanged(Material material, WorkflowMode workflowMode) { SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode")); SetMaterialKeywords(material, workflowMode); }
private static void SetMaterialKeywords(Material material, WorkflowMode workflowMode) { SetKeyword(material, "_NORMALMAP", (material.GetTexture("_BumpMap") != null) || ((bool) material.GetTexture("_DetailNormalMap"))); if (workflowMode == WorkflowMode.Specular) { SetKeyword(material, "_SPECGLOSSMAP", (bool) material.GetTexture("_SpecGlossMap")); } else if (workflowMode == WorkflowMode.Metallic) { SetKeyword(material, "_METALLICGLOSSMAP", (bool) material.GetTexture("_MetallicGlossMap")); } SetKeyword(material, "_PARALLAXMAP", (bool) material.GetTexture("_ParallaxMap")); SetKeyword(material, "_DETAIL_MULX2", (material.GetTexture("_DetailAlbedoMap") != null) || ((bool) material.GetTexture("_DetailNormalMap"))); bool state = ShouldEmissionBeEnabled(material.GetColor("_EmissionColor")); SetKeyword(material, "_EMISSION", state); MaterialGlobalIlluminationFlags globalIlluminationFlags = material.globalIlluminationFlags; if ((globalIlluminationFlags & (MaterialGlobalIlluminationFlags.BakedEmissive | MaterialGlobalIlluminationFlags.RealtimeEmissive)) != MaterialGlobalIlluminationFlags.None) { globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack; if (!state) { globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; } material.globalIlluminationFlags = globalIlluminationFlags; } }