FadedMaterialPool.FadedVersionOf Full Opaque or Full Transparent

Started by soulkata, March 25, 2015, 08:48:56 PM

Previous topic - Next topic

soulkata

Hi,
I want to draw a faded material, here is my code:


Material material = this.Graphic.MatSingle;
material = FadedMaterialPool.FadedVersionOf(material, 0.2f);

UnityEngine.Matrix4x4 matrix = default(UnityEngine.Matrix4x4);
matrix.SetTRS(this.exactPosition, UnityEngine.Quaternion.AngleAxis(this.exactRotation, UnityEngine.Vector3.up), this.exactScale);
UnityEngine.Graphics.DrawMesh(MeshPool.plane10, matrix, material, 0);


This draw a full opaque sprite (like 1.0 alpha) or a transparent sprite (like 0.0 alpha), what I am missing?

Rikiki

You just need to define your material shader as transparent:
Material scanSpot = MaterialPool.MatFrom("Effects/ScanSpot", ShaderDatabase.Transparent);

You can find this working example in the M&Co. MMS mod. :)

soulkata

Quote from: Rikiki on March 27, 2015, 08:25:12 PM
You just need to define your material shader as transparent:
Material scanSpot = MaterialPool.MatFrom("Effects/ScanSpot", ShaderDatabase.Transparent);

You can find this working example in the M&Co. MMS mod. :)

Thanks!

:)