最后努力能够使用最新的Three.JS我希望SO上的某个人遇到这个问题,因为Google没有给我任何东西。
我正在使用Ashima Perlin噪声着色器(参见示例) - http://www.clicktorelease.com/blog/experiments-with-perlin-noise
如果我使用的是Three.JS版本48(最新版本为59),我可以完全正常工作。
尝试使用此版本的最新版本会出现此错误:
ERROR: 0:301: 'objectMatrix' : undeclared identifier
ERROR: 0:301: 'objectMatrix' : left of '[' is not of type array, matrix, or vector
ERROR: 0:301: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:301: 'objectMatrix' : left of '[' is not of type array, matrix, or vector
ERROR: 0:301: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:301: 'objectMatrix' : left of '[' is not of type array, matrix, or vector
ERROR: 0:301: 'xyz' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:301: 'constructor' : not enough data provided for construction
three.min.js:40
这通常是我会调试,修复和推送给其他人的git但我没有C知识或着色器知识来调试它。
答案 0 :(得分:4)
好的,所以任何人都试图找到为什么这个演示不适用于最新版本的three.js:http://www.clicktorelease.com/code/perlin/chrome.html
这是因为varname的变化,你只需要在void main()中更改顶点着色器。
更改此行:
vec3 nWorld = normalize( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * modifiedNormal );
到此:
vec3 nWorld = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * modifiedNormal );
感谢@gaitat指向Three.js迁移页面的帮助,非常有帮助。