Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Editor/ShaderGraph/Targets/UniversalSimpleLitSubTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera
#endif
collector.AddFloatProperty(Property.SrcBlend, 1.0f); // always set by material inspector, ok to have incorrect values here
collector.AddFloatProperty(Property.DstBlend, 0.0f); // always set by material inspector, ok to have incorrect values here
// Set alpha blend defaults based on surface type
collector.AddFloatProperty(Property.SrcBlendAlpha, 1.0f); // One - used for both opaque and transparent
if (target.surfaceType == SurfaceType.Opaque)
{
collector.AddFloatProperty(Property.DstBlendAlpha, 0.0f); // Zero for opaque
}
else
{
collector.AddFloatProperty(Property.DstBlendAlpha, 10.0f); // OneMinusSrcAlpha for transparent (always set by material inspector)
}

collector.AddToggleProperty(Property.ZWrite, (target.surfaceType == SurfaceType.Opaque));
collector.AddFloatProperty(Property.ZWriteControl, (float)target.zWriteControl);
collector.AddFloatProperty(Property.ZTest, (float)target.zTestMode); // ztest mode is designed to directly pass as ztest
Expand Down