public void UpdateMaterials() { if (innerMaterial == null) { innerMaterial = SgtHelper.CreateTempMaterial("Corona Inner (Generated)", SgtHelper.ShaderNamePrefix + "CoronaInner"); CachedSharedMaterial.Material = innerMaterial; } if (outerMaterial == null) { outerMaterial = SgtHelper.CreateTempMaterial("Corona Outer (Generated)", SgtHelper.ShaderNamePrefix + "CoronaOuter"); if (model != null) { model.SetMaterial(outerMaterial); } } var color = SgtHelper.Brighten(Color, Brightness); innerMaterial.renderQueue = outerMaterial.renderQueue = RenderQueue; innerMaterial.SetColor("_Color", color); outerMaterial.SetColor("_Color", color); innerMaterial.SetTexture("_DepthTex", InnerDepthTex); outerMaterial.SetTexture("_DepthTex", OuterDepthTex); UpdateMaterialNonSerialized(); }
public void UpdateMaterials() { if (innerMaterial == null) { innerMaterial = SgtHelper.CreateTempMaterial("Corona Inner (Generated)", SgtHelper.ShaderNamePrefix + "CoronaInner"); CachedSharedMaterial.Material = innerMaterial; } if (outerMaterial == null) { outerMaterial = SgtHelper.CreateTempMaterial("Corona Outer (Generated)", SgtHelper.ShaderNamePrefix + "CoronaOuter"); if (model != null) { model.SetMaterial(outerMaterial); } } var color = SgtHelper.Brighten(Color, Brightness); var innerRatio = SgtHelper.Divide(InnerMeshRadius, OuterRadius); innerMaterial.renderQueue = outerMaterial.renderQueue = RenderQueue; innerMaterial.SetColor(SgtShader._Color, color); outerMaterial.SetColor(SgtShader._Color, color); innerMaterial.SetTexture(SgtShader._DepthTex, InnerDepthTex); outerMaterial.SetTexture(SgtShader._DepthTex, OuterDepthTex); innerMaterial.SetFloat(SgtShader._InnerRatio, innerRatio); innerMaterial.SetFloat(SgtShader._InnerScale, 1.0f / (1.0f - innerRatio)); if (OuterSoftness > 0.0f) { SgtHelper.EnableKeyword("SGT_A", outerMaterial); // Softness outerMaterial.SetFloat(SgtShader._SoftParticlesFactor, SgtHelper.Reciprocal(OuterSoftness)); } else { SgtHelper.DisableKeyword("SGT_A", outerMaterial); // Softness } UpdateMaterialNonSerialized(); }