Shader compilation error when using a map with extendMaterial
Closed this issue · 1 comments
Hello, it's me again, sorry!
I've seen this one reported on Discourse and it was supposedly fixed, however it seems to now cause a different issue.
I've encountered this issue in my own code and I was able to reproduce the same error on this forked pen from @prisonerjohn : https://codesandbox.io/s/extendmat-earth-forked-msqsw
"THREE.WebGLShader: gl.getShaderInfoLog() fragment
ERROR: 0:1020: 'vUv' : undeclared identifier
ERROR: 0:1020: '=' : dimension mismatch
ERROR: 0:1020: '=' : cannot convert from 'const highp float' to 'highp 2-component vector of float'"
EDIT: Forgot to give details
It happens when trying to pass a texture to the "uniforms" property in extendedMaterial
let texture = new THREE.TextureLoader().load( 'basecolor.png' );
const material = extendMaterial(THREE.MeshStandardMaterial,{
uniforms: {
map:texture
}
});
Regards.
Thank you for reporting. I've updated the code accordingly noticed there was an issue copying the getter/setter, generally i noticed applying the USE_MAP constants for example never really are needed as it is more about disguising the ShaderMaterial as internal.
For this reason CustomMaterial
is now by default used as material class, others still can be declared, but in order to use in-built features CustomMaterial
is always required.