Skip to content

Instantly share code, notes, and snippets.

@JoeGaebel
Last active January 20, 2018 23:38
Show Gist options
  • Save JoeGaebel/92cb5d1fd5a078aea10d8714f996d01a to your computer and use it in GitHub Desktop.
Save JoeGaebel/92cb5d1fd5a078aea10d8714f996d01a to your computer and use it in GitHub Desktop.
THREE.WebGLRenderer 70
three.min.js:513:52
THREE.WebGLShader: gl.getShaderInfoLog() WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported
three.min.js:581:350
1: precision highp float;
2: precision highp int;
3:
4: #define VERTEX_TEXTURES
5:
6:
7: #define MAX_DIR_LIGHTS 0
8: #define MAX_POINT_LIGHTS 0
9: #define MAX_SPOT_LIGHTS 0
10: #define MAX_HEMI_LIGHTS 0
11: #define MAX_SHADOWS 0
12: #define MAX_BONES 251
13: #define USE_MAP
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27: #define DOUBLE_SIDED
28:
29:
30:
31:
32:
33:
34:
35: uniform mat4 modelMatrix;
36: uniform mat4 modelViewMatrix;
37: uniform mat4 projectionMatrix;
38: uniform mat4 viewMatrix;
39: uniform mat3 normalMatrix;
40: uniform vec3 cameraPosition;
41: attribute vec3 position;
42: attribute vec3 normal;
43: attribute vec2 uv;
44: attribute vec2 uv2;
45: #ifdef USE_COLOR
46: attribute vec3 color;
47: #endif
48: #ifdef USE_MORPHTARGETS
49: attribute vec3 morphTarget0;
50: attribute vec3 morphTarget1;
51: attribute vec3 morphTarget2;
52: attribute vec3 morphTarget3;
53: #ifdef USE_MORPHNORMALS
54: attribute vec3 morphNormal0;
55: attribute vec3 morphNormal1;
56: attribute vec3 morphNormal2;
57: attribute vec3 morphNormal3;
58: #else
59: attribute vec3 morphTarget4;
60: attribute vec3 morphTarget5;
61: attribute vec3 morphTarget6;
62: attribute vec3 morphTarget7;
63: #endif
64: #endif
65: #ifdef USE_SKINNING
66: attribute vec4 skinIndex;
67: attribute vec4 skinWeight;
68: #endif
69: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
70:
71: varying vec2 vUv;
72: uniform vec4 offsetRepeat;
73:
74: #endif
75:
76: #ifdef USE_LIGHTMAP
77:
78: varying vec2 vUv2;
79:
80: #endif
81: #if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )
82:
83: varying vec3 vReflect;
84:
85: uniform float refractionRatio;
86:
87: #endif
88:
89: #ifdef USE_COLOR
90:
91: varying vec3 vColor;
92:
93: #endif
94: #ifdef USE_MORPHTARGETS
95:
96: #ifndef USE_MORPHNORMALS
97:
98: uniform float morphTargetInfluences[ 8 ];
99:
100: #else
101:
102: uniform float morphTargetInfluences[ 4 ];
103:
104: #endif
105:
106: #endif
107: #ifdef USE_SKINNING
108:
109: uniform mat4 bindMatrix;
110: uniform mat4 bindMatrixInverse;
111:
112: #ifdef BONE_TEXTURE
113:
114: uniform sampler2D boneTexture;
115: uniform int boneTextureWidth;
116: uniform int boneTextureHeight;
117:
118: mat4 getBoneMatrix( const in float i ) {
119:
120: float j = i * 4.0;
121: float x = mod( j, float( boneTextureWidth ) );
122: float y = floor( j / float( boneTextureWidth ) );
123:
124: float dx = 1.0 / float( boneTextureWidth );
125: float dy = 1.0 / float( boneTextureHeight );
126:
127: y = dy * ( y + 0.5 );
128:
129: vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
130: vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
131: vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
132: vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
133:
134: mat4 bone = mat4( v1, v2, v3, v4 );
135:
136: return bone;
137:
138: }
139:
140: #else
141:
142: uniform mat4 boneGlobalMatrices[ MAX_BONES ];
143:
144: mat4 getBoneMatrix( const in float i ) {
145:
146: mat4 bone = boneGlobalMatrices[ int(i) ];
147: return bone;
148:
149: }
150:
151: #endif
152:
153: #endif
154:
155: #ifdef USE_SHADOWMAP
156:
157: varying vec4 vShadowCoord[ MAX_SHADOWS ];
158: uniform mat4 shadowMatrix[ MAX_SHADOWS ];
159:
160: #endif
161: #ifdef USE_LOGDEPTHBUF
162:
163: #ifdef USE_LOGDEPTHBUF_EXT
164:
165: varying float vFragDepth;
166:
167: #endif
168:
169: uniform float logDepthBufFC;
170:
171: #endif
172: void main() {
173: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
174:
175: vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
176:
177: #endif
178: #ifdef USE_LIGHTMAP
179:
180: vUv2 = uv2;
181:
182: #endif
183: #ifdef USE_COLOR
184:
185: #ifdef GAMMA_INPUT
186:
187: vColor = color * color;
188:
189: #else
190:
191: vColor = color;
192:
193: #endif
194:
195: #endif
196: #ifdef USE_SKINNING
197:
198: mat4 boneMatX = getBoneMatrix( skinIndex.x );
199: mat4 boneMatY = getBoneMatrix( skinIndex.y );
200: mat4 boneMatZ = getBoneMatrix( skinIndex.z );
201: mat4 boneMatW = getBoneMatrix( skinIndex.w );
202:
203: #endif
204: #ifdef USE_ENVMAP
205: #ifdef USE_MORPHNORMALS
206:
207: vec3 morphedNormal = vec3( 0.0 );
208:
209: morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
210: morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
211: morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
212: morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
213:
214: morphedNormal += normal;
215:
216: #endif
217: #ifdef USE_SKINNING
218:
219: mat4 skinMatrix = mat4( 0.0 );
220: skinMatrix += skinWeight.x * boneMatX;
221: skinMatrix += skinWeight.y * boneMatY;
222: skinMatrix += skinWeight.z * boneMatZ;
223: skinMatrix += skinWeight.w * boneMatW;
224: skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
225:
226: #ifdef USE_MORPHNORMALS
227:
228: vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
229:
230: #else
231:
232: vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
233:
234: #endif
235:
236: #endif
237:
238: #ifdef USE_SKINNING
239:
240: vec3 objectNormal = skinnedNormal.xyz;
241:
242: #elif defined( USE_MORPHNORMALS )
243:
244: vec3 objectNormal = morphedNormal;
245:
246: #else
247:
248: vec3 objectNormal = normal;
249:
250: #endif
251:
252: #ifdef FLIP_SIDED
253:
254: objectNormal = -objectNormal;
255:
256: #endif
257:
258: vec3 transformedNormal = normalMatrix * objectNormal;
259:
260: #endif
261: #ifdef USE_MORPHTARGETS
262:
263: vec3 morphed = vec3( 0.0 );
264: morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
265: morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
266: morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
267: morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
268:
269: #ifndef USE_MORPHNORMALS
270:
271: morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
272: morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
273: morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
274: morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
275:
276: #endif
277:
278: morphed += position;
279:
280: #endif
281: #ifdef USE_SKINNING
282:
283: #ifdef USE_MORPHTARGETS
284:
285: vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
286:
287: #else
288:
289: vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
290:
291: #endif
292:
293: vec4 skinned = vec4( 0.0 );
294: skinned += boneMatX * skinVertex * skinWeight.x;
295: skinned += boneMatY * skinVertex * skinWeight.y;
296: skinned += boneMatZ * skinVertex * skinWeight.z;
297: skinned += boneMatW * skinVertex * skinWeight.w;
298: skinned = bindMatrixInverse * skinned;
299:
300: #endif
301:
302: #ifdef USE_SKINNING
303:
304: vec4 mvPosition = modelViewMatrix * skinned;
305:
306: #elif defined( USE_MORPHTARGETS )
307:
308: vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );
309:
310: #else
311:
312: vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
313:
314: #endif
315:
316: gl_Position = projectionMatrix * mvPosition;
317:
318: #ifdef USE_LOGDEPTHBUF
319:
320: gl_Position.z = log2(max(1e-6, gl_Position.w + 1.0)) * logDepthBufFC;
321:
322: #ifdef USE_LOGDEPTHBUF_EXT
323:
324: vFragDepth = 1.0 + gl_Position.w;
325:
326: #else
327:
328: gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
329:
330: #endif
331:
332: #endif
333: #if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
334:
335: #ifdef USE_SKINNING
336:
337: vec4 worldPosition = modelMatrix * skinned;
338:
339: #elif defined( USE_MORPHTARGETS )
340:
341: vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );
342:
343: #else
344:
345: vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
346:
347: #endif
348:
349: #endif
350:
351: #if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )
352:
353: vec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;
354: worldNormal = normalize( worldNormal );
355:
356: vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
357:
358: #ifdef ENVMAP_MODE_REFLECTION
359:
360: vReflect = reflect( cameraToVertex, worldNormal );
361:
362: #else
363:
364: vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
365:
366: #endif
367:
368: #endif
369:
370: #ifdef USE_SHADOWMAP
371:
372: for( int i = 0; i < MAX_SHADOWS; i ++ ) {
373:
374: vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
375:
376: }
377:
378: #endif
379: }
three.min.js:581:429
THREE.WebGLShader: gl.getShaderInfoLog() WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported
three.min.js:581:350
1: precision highp float;
2: precision highp int;
3:
4:
5: #define MAX_DIR_LIGHTS 0
6: #define MAX_POINT_LIGHTS 0
7: #define MAX_SPOT_LIGHTS 0
8: #define MAX_HEMI_LIGHTS 0
9: #define MAX_SHADOWS 0
10:
11:
12:
13:
14:
15: #define USE_MAP
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28: #define DOUBLE_SIDED
29:
30:
31:
32:
33:
34:
35: uniform mat4 viewMatrix;
36: uniform vec3 cameraPosition;
37: uniform vec3 diffuse;
38: uniform float opacity;
39: #ifdef USE_COLOR
40:
41: varying vec3 vColor;
42:
43: #endif
44:
45: #if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
46:
47: varying vec2 vUv;
48:
49: #endif
50:
51: #ifdef USE_MAP
52:
53: uniform sampler2D map;
54:
55: #endif
56: #ifdef USE_ALPHAMAP
57:
58: uniform sampler2D alphaMap;
59:
60: #endif
61:
62: #ifdef USE_LIGHTMAP
63:
64: varying vec2 vUv2;
65: uniform sampler2D lightMap;
66:
67: #endif
68: #ifdef US…
three.min.js:581:429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment