我为InstancedBufferGeometry对象创建了一个RawShaderMaterial,该对象使用1个sampler2D均匀渲染。一旦它使用第二个sampler2D制服,它就会产生很多垂直撕裂
这是片段着色器:
precision highp float;
uniform sampler2D utexture1;
uniform sampler2D utexture2;
varying float vindex;
varying vec2 vUv;
varying vec3 mapcolor;
vec4 gettexture(){
vec4 color;
if(vindex==0.){
color = texture2D(utexture1, vUv)*vec4(mapcolor,1.);
}else if(vindex==1.){
color = texture2D(utexture1, vUv)*vec4(mapcolor,1.);
}else if(vindex==2.){
color = texture2D(utexture2, vUv)*vec4(mapcolor,1.);
}else if(vindex==3.){
color = texture2D(utexture2, vUv)*vec4(mapcolor,1.);
}
return color;
}
void main() {
gl_FragColor = gettexture();
}
注意:用于sampler2D的2个纹理具有相同的大小(512x512),并且在创建材料之前加载它们。
任何人都知道这些垂直撕裂来自哪里?
提前感谢您的帮助!