Why am I getting this error when I change directionalLight.castShadow = true?
THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
code:
var directionalLight= new THREE.DirectionalLight(0xffffff,.2);
directionalLight.position.set(5,5,5);
// directionalLight.castShadow = true
.
Thanks,
Binoy
You’re most likely using some custom material (or a mix of them) that does not support light shadows properly - but it’s hard to say without knowing more details about the project / dependencies you’re using.
I am using MeshStandardMaterial. I have applied some properties such as roughness and metalness and has an envMap
And there are absolutely no other dependencies installed or custom shader materials used in the app, besides three
?
Could you show the code of how you create the material?
function setMaterials(model) {
model.traverse((mesh) => {
if(mesh.isObject3D){
mesh.castShadow = true
mesh.recieveShadow = true
}
if (!mesh.isMesh) return;
material = mesh.material
material.opacity = material?.userData?.opacity;
material.emissive = material?.userData?.color;
material.color = material?.userData?.color;
material.specularColor = material?.userData?.specular;
material.roughness = 1 - material?.userData?.shininess / 100;
material.metalness = material?.userData?.shininess / 100;
material.side = material?.userData?.side;
material.transparent = material?.userData?.transparent;
});
return model;
}
Yes, there are no shaders added. I added three in a separate file. THREE.REVISION is
‘148’. The error only occurs when directionalLight.castShadow is true