Skip to content

Commit

Permalink
Shader Graph: add float material property for Alpha to Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Delt06 committed Nov 10, 2023
1 parent fe8dd43 commit 7678648
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class PropertyNames

public const string SurfaceType = "_SurfaceType";
public const string AlphaClipping = "_AlphaClipping";
public const string AlphaToCoverage = "_AlphaToCoverage";
public const string AlphaClipThreshold = "_AlphaClipThreshold";
public const string BlendMode = "_BlendMode";
public const string BlendSrc = "_BlendSrc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public override void ProcessPreviewMaterial(Material material)
material.SetFloat(PropertyNames.SurfaceType, (float) target.SurfaceType);
material.SetFloat(PropertyNames.BlendMode, (float) target.AlphaMode);
material.SetFloat(PropertyNames.AlphaClipping, target.AlphaClip ? 1.0f : 0.0f);
material.SetFloat(PropertyNames.AlphaToCoverage, target.AlphaToCoverage ? 1.0f : 0.0f);
material.SetFloat(PropertyNames.ForceDisableFogPropertyName, !target.Fog ? 1.0f : 0.0f);
material.SetFloat(PropertyNames.RenderFace, (int) target.RenderFace);
material.SetFloat(PropertyNames.CastShadows, target.CastShadows ? 1.0f : 0.0f);
Expand Down Expand Up @@ -110,6 +111,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera
collector.AddFloatProperty(PropertyNames.SurfaceType, (float) target.SurfaceType);
collector.AddFloatProperty(PropertyNames.BlendMode, (float) target.AlphaMode);
collector.AddFloatProperty(PropertyNames.AlphaClipping, target.AlphaClip ? 1.0f : 0.0f);
collector.AddFloatProperty(PropertyNames.AlphaToCoverage, target.AlphaToCoverage ? 1.0f : 0.0f);
collector.AddFloatProperty(PropertyNames.ForceDisableFogPropertyName, !target.Fog ? 1.0f : 0.0f);
collector.AddFloatProperty(PropertyNames.BlendSrc, 1.0f
); // always set by material inspector, ok to have incorrect values here
Expand Down

0 comments on commit 7678648

Please sign in to comment.