我有一个THREE.js动画,我把它变成一个球体。这个动画有两个版本,第一个是原始版本,第二个是使用函数更结构化的。
在Firefox上,当我加载这个动画并点击图片后,我有很多像这样的奇怪警告:
THREE.WebGLShader: gl.getShaderInfoLog() vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported
1: precision highp float;
2: precision highp int;
3: #define SHADER_NAME MeshPhongMaterial
4: #define VERTEX_TEXTURES
5: #define GAMMA_FACTOR 2
6: #define MAX_BONES 251
7: #define FLAT_SHADED
8: uniform mat4 modelMatrix;
9: uniform mat4 modelViewMatrix;
10: uniform mat4 projectionMatrix;
11: uniform mat4 viewMatrix;
12: uniform mat3 normalMatrix;
13: uniform vec3 cameraPosition;
14: attribute vec3 position;
15: attribute vec3 normal;
16: attribute vec2 uv;
17: #ifdef USE_COLOR
18: attribute vec3 color;
19: #endif
20: #ifdef USE_MORPHTARGETS
21: attribute vec3 morphTarget0;
22: attribute vec3 morphTarget1;
23: attribute vec3 morphTarget2;
24: attribute vec3 morphTarget3;
25: #ifdef USE_MORPHNORMALS
26: attribute vec3 morphNormal0;
27: attribute vec3 morphNormal1;
28: attribute vec3 morphNormal2;
29: attribute vec3 morphNormal3;
30: #else
31: attribute vec3 morphTarget4;
32: attribute vec3 morphTarget5;
33: attribute vec3 morphTarget6;
34: attribute vec3 morphTarge[…] three.min.js:716:348
THREE.WebGLShader: gl.getShaderInfoLog() fragment WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported
1: #extension GL_OES_standard_derivatives : enable
2: precision highp float;
3: precision highp int;
4: #define SHADER_NAME MeshPhongMaterial
5: #define GAMMA_FACTOR 2
6: #define FLAT_SHADED
7: uniform mat4 viewMatrix;
8: uniform vec3 cameraPosition;
9: #define TONE_MAPPING
10: #define saturate(a) clamp( a, 0.0, 1.0 )
11: uniform float toneMappingExposure;
12: uniform float toneMappingWhitePoint;
13: vec3 LinearToneMapping( vec3 color ) {
14: return toneMappingExposure * color;
15: }
16: vec3 ReinhardToneMapping( vec3 color ) {
17: color *= toneMappingExposure;
18: return saturate( color / ( vec3( 1.0 ) + color ) );
19: }
20: #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
21: vec3 Uncharted2ToneMapping( vec3 color ) {
22: color *= toneMappingExposure;
23: return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
24: }
25: ve[…] three.min.js:716:348
THREE.WebGLShader: gl.getShaderInfoLog() vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported
1: precision highp float;
2: precision highp int;
3: #define SHADER_NAME LineBasicMaterial
4: #define VERTEX_TEXTURES
5: #define GAMMA_FACTOR 2
6: #define MAX_BONES 251
7: uniform mat4 modelMatrix;
8: uniform mat4 modelViewMatrix;
9: uniform mat4 projectionMatrix;
10: uniform mat4 viewMatrix;
11: uniform mat3 normalMatrix;
12: uniform vec3 cameraPosition;
13: attribute vec3 position;
14: attribute vec3 normal;
15: attribute vec2 uv;
16: #ifdef USE_COLOR
17: attribute vec3 color;
18: #endif
19: #ifdef USE_MORPHTARGETS
20: attribute vec3 morphTarget0;
21: attribute vec3 morphTarget1;
22: attribute vec3 morphTarget2;
23: attribute vec3 morphTarget3;
24: #ifdef USE_MORPHNORMALS
25: attribute vec3 morphNormal0;
26: attribute vec3 morphNormal1;
27: attribute vec3 morphNormal2;
28: attribute vec3 morphNormal3;
29: #else
30: attribute vec3 morphTarget4;
31: attribute vec3 morphTarget5;
32: attribute vec3 morphTarget6;
33: attribute vec3 morphTarget7;
34: #endif
35: #endif
36: #ifdef USE_SKINNING
37: attribute vec4 skinIndex;
38: attribute vec4 skinWeight;
39: #endif
40:
41: #define PI 3.14159
42: #define PI2 6.28318
43: #define RECIPROCAL_PI 0.31830988618
44: #define RECIPROCAL_PI2 0.15915494
45: #define LOG2 1.442695
46: #define EPSILON 1e-6
47: #define saturate(a) clamp( a, 0.0, 1.0 )
48: #define whiteCompliment(a) ( 1.0 - saturate( a ) )
49: float pow2( const in float x ) { return x*x; }
50: float pow3( const in float x ) { return x*x*x; }
51: float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
52: float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
53: struct IncidentLight {
54: vec3 color;
55: vec3 direction;
56: bool visible;
57: };
58: struct ReflectedLight {
59: vec3 directDiffuse;
60: vec3 directSpecular;
61: vec3 indirectDiffuse;
62: vec3 indirectSpecular;
63: };
64: struct GeometricContext {
65: vec3 position;
66: vec3 normal;
67: vec3 viewDir;
68: };
69: vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
70: return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
71: }
72: vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
73: return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
74: }
75: vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
76: float distance = dot( planeNormal, point - pointOnPlane );
77: return - distance * planeNormal + point;
78: }
79: float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
80: return sign( dot( point - pointOnPlane, planeNormal ) );
81: }
82: vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
83: return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
84: }
85:
86: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
87: varying vec2 vUv;
88: uniform vec4 offsetRepeat;
89: #endif
90:
91: #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
92: attribute vec2 uv2;
93: varying vec2 vUv2;
94: #endif
95: #if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )
96: varying vec3 vReflect;
97: uniform float refractionRatio;
98: #endif
99:
100: #ifdef USE_COLOR
101: varying vec3 vColor;
102: #endif
103: #ifdef USE_MORPHTARGETS
104: #ifndef USE_MORPHNORMALS
105: uniform float morphTargetInfluences[ 8 ];
106: #else
107: uniform float morphTargetInfluences[ 4 ];
108: #endif
109: #endif
110: #ifdef USE_SKINNING
111: uniform mat4 bindMatrix;
112: uniform mat4 bindMatrixInverse;
113: #ifdef BONE_TEXTURE
114: uniform sampler2D boneTexture;
115: uniform int boneTextureWidth;
116: uniform int boneTextureHeight;
117: mat4 getBoneMatrix( const in float i ) {
118: float j = i * 4.0;
119: float x = mod( j, float( boneTextureWidth ) );
120: float y = floor( j / float( boneTextureWidth ) );
121: float dx = 1.0 / float( boneTextureWidth );
122: float dy = 1.0 / float( boneTextureHeight );
123: y = dy * ( y + 0.5 );
124: vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
125: vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
126: vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
127: vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
128: mat4 bone = mat4( v1, v2, v3, v4 );
129: return bone;
130: }
131: #else
132: uniform mat4 boneGlobalMatrices[ MAX_BONES ];
133: mat4 getBoneMatrix( const in float i ) {
134: mat4 bone = boneGlobalMatrices[ int(i) ];
135: return bone;
136: }
137: #endif
138: #endif
139:
140: #ifdef USE_LOGDEPTHBUF
141: #ifdef USE_LOGDEPTHBUF_EXT
142: varying float vFragDepth;
143: #endif
144: uniform float logDepthBufFC;
145: #endif
146: void main() {
147: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
148: vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
149: #endif
150: #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
151: vUv2 = uv2;
152: #endif
153: #ifdef USE_COLOR
154: vColor.xyz = color.xyz;
155: #endif
156: #ifdef USE_SKINNING
157: mat4 boneMatX = getBoneMatrix( skinIndex.x );
158: mat4 boneMatY = getBoneMatrix( skinIndex.y );
159: mat4 boneMatZ = getBoneMatrix( skinIndex.z );
160: mat4 boneMatW = getBoneMatrix( skinIndex.w );
161: #endif
162: #ifdef USE_ENVMAP
163:
164: vec3 objectNormal = vec3( normal );
165:
166: #ifdef USE_MORPHNORMALS
167: objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
168: objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
169: objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
170: objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
171: #endif
172:
173: #ifdef USE_SKINNING
174: mat4 skinMatrix = mat4( 0.0 );
175: skinMatrix += skinWeight.x * boneMatX;
176: skinMatrix += skinWeight.y * boneMatY;
177: skinMatrix += skinWeight.z * boneMatZ;
178: skinMatrix += skinWeight.w * boneMatW;
179: skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
180: objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
181: #endif
182:
183: #ifdef FLIP_SIDED
184: objectNormal = -objectNormal;
185: #endif
186: vec3 transformedNormal = normalMatrix * objectNormal;
187:
188: #endif
189:
190: vec3 transformed = vec3( position );
191:
192: #ifdef USE_MORPHTARGETS
193: transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
194: transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
195: transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
196: transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
197: #ifndef USE_MORPHNORMALS
198: transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
199: transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
200: transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
201: transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
202: #endif
203: #endif
204:
205: #ifdef USE_SKINNING
206: vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
207: vec4 skinned = vec4( 0.0 );
208: skinned += boneMatX * skinVertex * skinWeight.x;
209: skinned += boneMatY * skinVertex * skinWeight.y;
210: skinned += boneMatZ * skinVertex * skinWeight.z;
211: skinned += boneMatW * skinVertex * skinWeight.w;
212: skinned = bindMatrixInverse * skinned;
213: #endif
214:
215: #ifdef USE_SKINNING
216: vec4 mvPosition = modelViewMatrix * skinned;
217: #else
218: vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
219: #endif
220: gl_Position = projectionMatrix * mvPosition;
221:
222: #ifdef USE_LOGDEPTHBUF
223: gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
224: #ifdef USE_LOGDEPTHBUF_EXT
225: vFragDepth = 1.0 + gl_Position.w;
226: #else
227: gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
228: #endif
229: #endif
230:
231: #if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
232: #ifdef USE_SKINNING
233: vec4 worldPosition = modelMatrix * skinned;
234: #else
235: vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
236: #endif
237: #endif
238:
239: #if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )
240: vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
241: vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
242: #ifdef ENVMAP_MODE_REFLECTION
243: vReflect = reflect( cameraToVertex, worldNormal );
244: #else
245: vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
246: #endif
247: #endif
248:
249: }
250: three.min.js:716:348
为什么我会收到这些奇怪的警告?它们来自哪里?
在Chrome上,我没有收到这些警告。