我尝试为简单几何体实现三视图绘制着色器,并使用此着色器进行测试,简单如下:
float doCos = dot(viewDirection, normalDirection);
float4 texColor;
//2. need board
bool isBackSide = doCos < 0;
if(isBackSide) {
//_Dotted is a 2d texture the board is black dot line
texColor = tex2D(_Dotted, i.tex.xy * _Dotted_ST.xy + _Dotted_ST.zw);
} else {
//_Dotted is a 2d texture the board is black entity line
texColor = tex2D(_Entity, i.tex.xy * _Entity_ST.xy + _Entity_ST.zw);
}
//ignore some color
if(texColor.x > 0.5f) {
discard;
}
return texColor;
有一个问题,当前方平面变得陡峭时,虚线会明显然后是实体线。另外,我添加了一条边线,但它没有点,所以我忽略了它。
为了澄清,我用了两个问题:
1.如何修改着色器解决虚线问题?
2.是否存在专业的三视图图形着色器?(尚未找到)