|
|
|
|
|
|
|
|
|
|
switch (masterNode.alphaMode) |
|
|
|
{ |
|
|
|
case PBRMasterNode.AlphaMode.Transparent: |
|
|
|
case PBRMasterNode.AlphaMode.Fade: |
|
|
|
case PBRMasterNode.AlphaMode.Additive: |
|
|
|
case PBRMasterNode.AlphaMode.Multiply: |
|
|
|
case PBRMasterNode.AlphaMode.AlphaBlend: |
|
|
|
case PBRMasterNode.AlphaMode.AdditiveBlend: |
|
|
|
defines.AddShaderChunk("#define _AlphaOut 1", true); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
case PBRMasterNode.AlphaMode.Opaque: |
|
|
|
materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; |
|
|
|
materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
case PBRMasterNode.AlphaMode.Transparent: |
|
|
|
materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; |
|
|
|
materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; |
|
|
|
materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; |
|
|
|
materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; |
|
|
|
materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; |
|
|
|
materialOptions.renderType = SurfaceMaterialOptions.RenderType.Transparent; |
|
|
|
break; |
|
|
|
case PBRMasterNode.AlphaMode.Fade: |
|
|
|
case PBRMasterNode.AlphaMode.AlphaBlend: |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
case PBRMasterNode.AlphaMode.Additive: |
|
|
|
case PBRMasterNode.AlphaMode.AdditiveBlend: |
|
|
|
materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; |
|
|
|
materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; |
|
|
|
materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; |
|
|
|
materialOptions.renderType = SurfaceMaterialOptions.RenderType.Transparent; |
|
|
|
break; |
|
|
|
case PBRMasterNode.AlphaMode.Multiply: |
|
|
|
materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.DstColor; |
|
|
|
materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; |
|
|
|
materialOptions.cullMode = SurfaceMaterialOptions.CullMode.Back; |
|
|
|
materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; |
|
|
|
materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; |
|
|
|
materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; |
|
|
|
|
|
|
|
|
|
|
materialOptions.cullMode = masterNode.cullMode; |
|
|
|
|
|
|
|
var tagsVisitor = new ShaderGenerator(); |
|
|
|
materialOptions.GetTags(tagsVisitor); |
|
|
|
|
|
|
return new[] { subShader.GetShaderString(0) }; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |