这不是我原创的,是我修改别人的, 原版只有一个pass,且 Cull Off,但这样
不知为什么有的边框会被遮挡(我感觉应该不会遮挡),最后我用了两个pass,
第一个 Cull Front,第二个 Cull Back,效果就Ok了,创建一个Cube,一个matirial,把
这个shader加上,调调颜色,效果很不错!,但为什么只用一个Pass把Cull 设为 Off不行呢??
Shader "Custom/WireFrame" {
Properties
{
_LineColor ("Line Color", Color) = (1,1,1,1)
_GridColor ("Grid Color", Color) = (1,1,1,0)
_LineWidth ("Line Width", float) = 0.2
}
SubShader
{
Pass
{
Tags { "RenderType" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha//这句可以注释掉,能够避免线框太粗出现的模糊效果。
//AlphaTest Greater 0.5
Cull Front//这句是后加的,取消遮挡消隐,体现出透明
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
uniform float4 _LineColor;
uniform