在vertex shader中调用tex2d()函数会出现
cannot map expression to vs_4_0 instruction set at line 39 (on glcore)
错误。
用tex2dlod() 函数代替。
void vert(inout appdata_full v, out Input o) {
float4 texColor = tex2Dlod(_ColorTexture, float4(v.texcoord.xy, 0, 0));
if (texColor.a > 0.804) {
v.vertex.xyz = v.vertex.xyz;
}
else {
v.vertex.xyz = float3(v.vertex.x, 0, v.vertex.z);
}
UNITY_INITIALIZE_OUTPUT(Input, o);
}
这里实现了贴图中这个半圆形物体在模型中突起,其余部分为平面的效果