【问题标题】:Three.js shader error on different computers (same browser)Three.js着色器在不同计算机上的错误(相同的浏览器)
【发布时间】:2016-06-04 03:19:24
【问题描述】:

在过去的 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

【问题讨论】:

  • 是什么让您认为它取决于浏览器类型?
  • @enkryptor 这通常是我研究有关 Three.js 使用某些浏览器而不是其他浏览器的问题时的常见原因,所以这就是我的想法。
  • 您的着色器是否需要一些 webgl 扩展?如果我不得不猜测,某些计算机没有您或 three.js 需要的 webgl 扩展。另外,你有哪个版本的 Three.js?
  • 但这是您现在的猜测,还是您真的尝试在具有不同浏览器的家用计算机上运行它?那么哪些浏览器可以工作呢?
  • 对不起,如果这听起来冒犯,但你说“不能在严格的少数计算机上工作,但在工作的计算机上工作”,这是关于不同的计算机,而不是不同的浏览器.我在询问同一台计算机上的不同浏览器。其中哪些有效,哪些无效?

标签: javascript three.js webgl


【解决方案1】:

这可能是某些硬件的已知问题,出现在新的 Three.js 版本中 - https://github.com/mrdoob/three.js/issues/8161

该问题已在 dev 分支中修复。不过有一个解决方法:

函数 IncidentLight getPointDirectLightIncidentLight 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 );

【讨论】:

  • 多一点摘要细节可能会很好,以防万一链接消失。
猜你喜欢
  • 2014-09-22
  • 1970-01-01
  • 2021-04-16
  • 1970-01-01
  • 1970-01-01
  • 2012-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多