In my project I have a few hundred textures (color maps and corresponding bump maps), all of identical size. I want to put all of them in two array textures, add an extra dimension to BufferGeometry
’s uv attribute which will take the texture layer index, and render the geometry using MeshPhongMaterial
.
I keep getting shader errors because apparently the material can’t handle the array texture. I used MeshBasicMaterial
here, but the error is the same.
THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Material Name:
Material Type: MeshBasicMaterial
Program Info Log: Must have a compiled vertex shader attached:
SHADER_INFO_LOG:
ERROR: 0:338: 'uvundefined' : undeclared identifier
ERROR: 0:338: 'constructor' : not enough data provided for construction
VERTEX
ERROR: 0:338: 'uvundefined' : undeclared identifier
ERROR: 0:338: 'constructor' : not enough data provided for construction
333: void main() {
334: #if defined( USE_UV ) || defined( USE_ANISOTROPY )
335: vUv = vec3( uv, 1 ).xy;
336: #endif
337: #ifdef USE_MAP
> 338: vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
339: #endif
Note the uvundefined
identifier in the error message.
My question is: do I have to write my own shaders to make this work with array textures or is there an easier way?