我在过去3个月里一直在使用 Three.js 进行开发,并且已经在几台浏览器和计算机上使用它了。上周在我的家用电脑上,每当我尝试加载我的网站时都会收到此错误:
three.js:29948 THREE.WebGLProgram: shader error: 0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(254,9-30): error X3004: undeclared identifier 'IncidentLight'
Warning: D3D shader compilation failed with default flags. (vs_3_0)
Retrying with avoid flow control
C:\fakepath(254,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'
Warning: D3D shader compilation failed with avoid flow control flags. (vs_3_0)
Retrying with prefer flow control
C:\fakepath(254,9-30): error X3004: undeclared identifier 'webgl_45daf4aa877f103d'
Warning: D3D shader compilation failed with prefer flow control flags. (vs_3_0)
Failed to create D3D shaders.
该网站是实时的,并不适用于严格的少数计算机,但可以在工作的计算机上运行。我已确保检查网站不的浏览器是否已启用 WebGL 但是已启用。
答案 0 :(得分:3)
这可能是某些硬件的已知问题,出现在新的Three.js版本中 - https://github.com/mrdoob/three.js/issues/8161
该问题已在dev分支中修复。但有一个解决方法:
编译在函数
IncidentLight getPointDirectLight
和IncidentLight getDirectionalDirectLight
上失败。将这些函数修改为void类型:
void getDirectionalDirectLight( out IncidentLight directLight, const in DirectionalLight directionalLight, const in GeometricContext geometry );
void getPointDirectLight( out IncidentLight directLight, const in PointLight pointLight, const in GeometricContext geometry );