Jump to content

PBR crash on android


Hersir
 Share

Recommended Posts

Hi, 

Got error on android device with hdr material (updated using babylonjs extension,  size 128).

Device: Galaxy Tab 3

WebGl: renderer:"PowerVR SGX 544MP2", vendor:"Imagination Technologies", version:"WebGL 1.0 (OpenGL ES 2.0 Chromium)"

Android: 4.4.2

Error:

[.Offscreen-For-WebGL-0x714d4da0]GL ERROR :GL_INVALID_ENUM : GetIntegerv: <- error from previous GL command
[.Offscreen-For-WebGL-0x714d4da0]GL ERROR :GL_INVALID_ENUM : glTexImage2D: <- error from previous GL command
[.Offscreen-For-WebGL-0x714d4da0]GL ERROR :GL_OUT_OF_MEMORY : GetShaderiv: <- error from previous GL command
[.Offscreen-For-WebGL-0x714d4da0]GL ERROR :GL_OUT_OF_MEMORY : glFramebufferTexture2DMultisample: <- error from previous GL command

Unable to compile effect:
Attributes:  position, normal, uv
Vertex shader: default
Fragment shader: default
Trying next fallback.
Unable to compile effect:
Attributes:  position, normal, uv
Vertex shader: default
Fragment shader: default
WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost
Unable to compile effect:
Attributes:  position, normal, uv, uv2
Vertex shader: pbr
Fragment shader: pbr
Error: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Cannot set property 'isCube' of null

There are more error logs as all shaders are logged, if more info is needed I can attach something more

Link to comment
Share on other sites

Vertex shader: default
1	#define DIFFUSE
2	#define SPECULAROVERALPHA
3	#define SPECULARTERM
4	#define NORMAL
5	#define UV1
6	#define UV2
7	#define NUM_BONE_INFLUENCERS 0
8	#define BonesPerMesh 0
9	#define NUM_MORPH_INFLUENCERS 0
10	#define LIGHT0
11	#define HEMILIGHT0
12	#define LIGHT1
13	#define DIRLIGHT1
14	#define SHADOW1
15	#define SHADOWS
16	
17	precision highp float;
18	
19	uniform mat4 viewProjection;
20	uniform mat4 view;
21	#ifdef DIFFUSE
22	uniform mat4 diffuseMatrix;
23	uniform vec2 vDiffuseInfos;
24	#endif
25	#ifdef AMBIENT
26	uniform mat4 ambientMatrix;
27	uniform vec2 vAmbientInfos;
28	#endif
29	#ifdef OPACITY
30	uniform mat4 opacityMatrix;
31	uniform vec2 vOpacityInfos;
32	#endif
33	#ifdef EMISSIVE
34	uniform vec2 vEmissiveInfos;
35	uniform mat4 emissiveMatrix;
36	#endif
37	#ifdef LIGHTMAP
38	uniform vec2 vLightmapInfos;
39	uniform mat4 lightmapMatrix;
40	#endif
41	#if defined(SPECULAR) && defined(SPECULARTERM)
42	uniform vec2 vSpecularInfos;
43	uniform mat4 specularMatrix;
44	#endif
45	#ifdef BUMP
46	uniform vec3 vBumpInfos;
47	uniform mat4 bumpMatrix;
48	#endif
49	#ifdef POINTSIZE
50	uniform float pointSize;
51	#endif
52	
53	
54	attribute vec3 position;
55	#ifdef NORMAL
56	attribute vec3 normal;
57	#endif
58	#ifdef TANGENT
59	attribute vec4 tangent;
60	#endif
61	#ifdef UV1
62	attribute vec2 uv;
63	#endif
64	#ifdef UV2
65	attribute vec2 uv2;
66	#endif
67	#ifdef VERTEXCOLOR
68	attribute vec4 color;
69	#endif
70	#if NUM_BONE_INFLUENCERS>0
71	uniform mat4 mBones[BonesPerMesh];
72	attribute vec4 matricesIndices;
73	attribute vec4 matricesWeights;
74	#if NUM_BONE_INFLUENCERS>4
75	attribute vec4 matricesIndicesExtra;
76	attribute vec4 matricesWeightsExtra;
77	#endif
78	#endif
79	
80	#ifdef INSTANCES
81	attribute vec4 world0;
82	attribute vec4 world1;
83	attribute vec4 world2;
84	attribute vec4 world3;
85	#else
86	uniform mat4 world;
87	#endif
88	#ifdef DIFFUSE
89	varying vec2 vDiffuseUV;
90	#endif
91	#ifdef AMBIENT
92	varying vec2 vAmbientUV;
93	#endif
94	#ifdef OPACITY
95	varying vec2 vOpacityUV;
96	#endif
97	#ifdef EMISSIVE
98	varying vec2 vEmissiveUV;
99	#endif
100	#ifdef LIGHTMAP
101	varying vec2 vLightmapUV;
102	#endif
103	#if defined(SPECULAR) && defined(SPECULARTERM)
104	varying vec2 vSpecularUV;
105	#endif
106	#ifdef BUMP
107	varying vec2 vBumpUV;
108	#endif
109	
110	varying vec3 vPositionW;
111	#ifdef NORMAL
112	varying vec3 vNormalW;
113	#endif
114	#ifdef VERTEXCOLOR
115	varying vec4 vColor;
116	#endif
117	#if defined(BUMP) || defined(PARALLAX)
118	#if defined(TANGENT) && defined(NORMAL) 
119	varying mat3 vTBN;
120	#endif
121	#endif
122	
123	#ifdef CLIPPLANE
124	uniform vec4 vClipPlane;
125	varying float fClipDistance;
126	#endif
127	#ifdef FOG
128	varying vec3 vFogDistance;
129	#endif
130	#ifdef SHADOWS
131	#if defined(SPOTLIGHT0) || defined(DIRLIGHT0)
132	uniform mat4 lightMatrix0;
133	varying vec4 vPositionFromLight0;
134	#endif
135	#endif
136	
137	#ifdef SHADOWS
138	#if defined(SPOTLIGHT1) || defined(DIRLIGHT1)
139	uniform mat4 lightMatrix1;
140	varying vec4 vPositionFromLight1;
141	#endif
142	#endif
143	
144	#ifdef SHADOWS
145	#if defined(SPOTLIGHT2) || defined(DIRLIGHT2)
146	uniform mat4 lightMatrix2;
147	varying vec4 vPositionFromLight2;
148	#endif
149	#endif
150	
151	#ifdef SHADOWS
152	#if defined(SPOTLIGHT3) || defined(DIRLIGHT3)
153	uniform mat4 lightMatrix3;
154	varying vec4 vPositionFromLight3;
155	#endif
156	#endif
157	
158	
159	#ifdef MORPHTARGETS
160	uniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];
161	#endif
162	
163	#ifdef REFLECTIONMAP_SKYBOX
164	varying vec3 vPositionUVW;
165	#endif
166	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
167	varying vec3 vDirectionW;
168	#endif
169	#ifdef LOGARITHMICDEPTH
170	uniform float logarithmicDepthConstant;
171	varying float vFragmentDepth;
172	#endif
173	void main(void) {
174	vec3 positionUpdated=position;
175	#ifdef NORMAL 
176	vec3 normalUpdated=normal;
177	#endif
178	#ifdef TANGENT
179	vec4 tangentUpdated=tangent;
180	#endif
181	
182	#ifdef REFLECTIONMAP_SKYBOX
183	vPositionUVW=positionUpdated;
184	#endif 
185	#ifdef INSTANCES
186	mat4 finalWorld=mat4(world0,world1,world2,world3);
187	#else
188	mat4 finalWorld=world;
189	#endif
190	#if NUM_BONE_INFLUENCERS>0
191	mat4 influence;
192	influence=mBones[int(matricesIndices[0])]*matricesWeights[0];
193	#if NUM_BONE_INFLUENCERS>1
194	influence+=mBones[int(matricesIndices[1])]*matricesWeights[1];
195	#endif 
196	#if NUM_BONE_INFLUENCERS>2
197	influence+=mBones[int(matricesIndices[2])]*matricesWeights[2];
198	#endif 
199	#if NUM_BONE_INFLUENCERS>3
200	influence+=mBones[int(matricesIndices[3])]*matricesWeights[3];
201	#endif 
202	#if NUM_BONE_INFLUENCERS>4
203	influence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];
204	#endif 
205	#if NUM_BONE_INFLUENCERS>5
206	influence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];
207	#endif 
208	#if NUM_BONE_INFLUENCERS>6
209	influence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];
210	#endif 
211	#if NUM_BONE_INFLUENCERS>7
212	influence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];
213	#endif 
214	finalWorld=finalWorld*influence;
215	#endif
216	gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);
217	vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
218	vPositionW=vec3(worldPos);
219	#ifdef NORMAL
220	vNormalW=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));
221	#endif
222	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
223	vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));
224	#endif
225	
226	#ifndef UV1
227	vec2 uv=vec2(0.,0.);
228	#endif
229	#ifndef UV2
230	vec2 uv2=vec2(0.,0.);
231	#endif
232	#ifdef DIFFUSE
233	if (vDiffuseInfos.x == 0.)
234	{
235	vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
236	}
237	else
238	{
239	vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
240	}
241	#endif
242	#ifdef AMBIENT
243	if (vAmbientInfos.x == 0.)
244	{
245	vAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));
246	}
247	else
248	{
249	vAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));
250	}
251	#endif
252	#ifdef OPACITY
253	if (vOpacityInfos.x == 0.)
254	{
255	vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));
256	}
257	else
258	{
259	vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));
260	}
261	#endif
262	#ifdef EMISSIVE
263	if (vEmissiveInfos.x == 0.)
264	{
265	vEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));
266	}
267	else
268	{
269	vEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));
270	}
271	#endif
272	#ifdef LIGHTMAP
273	if (vLightmapInfos.x == 0.)
274	{
275	vLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));
276	}
277	else
278	{
279	vLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));
280	}
281	#endif
282	#if defined(SPECULAR) && defined(SPECULARTERM)
283	if (vSpecularInfos.x == 0.)
284	{
285	vSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));
286	}
287	else
288	{
289	vSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));
290	}
291	#endif
292	#ifdef BUMP
293	if (vBumpInfos.x == 0.)
294	{
295	vBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));
296	}
297	else
298	{
299	vBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));
300	}
301	#endif
302	#if defined(BUMP) || defined(PARALLAX)
303	#if defined(TANGENT) && defined(NORMAL)
304	vec3 normalW=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));
305	vec3 tangentW=normalize(vec3(finalWorld*vec4(tangentUpdated.xyz,0.0)));
306	vec3 bitangentW=cross(normalW,tangentW)*tangentUpdated.w;
307	vTBN=mat3(tangentW,bitangentW,normalW);
308	#endif
309	#endif
310	#ifdef CLIPPLANE
311	fClipDistance=dot(worldPos,vClipPlane);
312	#endif
313	#ifdef FOG
314	vFogDistance=(view*worldPos).xyz;
315	#endif
316	#ifdef SHADOWS
317	#if defined(SPOTLIGHT0) || defined(DIRLIGHT0)
318	vPositionFromLight0=lightMatrix0*worldPos;
319	#endif
320	#endif
321	#ifdef SHADOWS
322	#if defined(SPOTLIGHT1) || defined(DIRLIGHT1)
323	vPositionFromLight1=lightMatrix1*worldPos;
324	#endif
325	#endif
326	#ifdef SHADOWS
327	#if defined(SPOTLIGHT2) || defined(DIRLIGHT2)
328	vPositionFromLight2=lightMatrix2*worldPos;
329	#endif
330	#endif
331	#ifdef SHADOWS
332	#if defined(SPOTLIGHT3) || defined(DIRLIGHT3)
333	vPositionFromLight3=lightMatrix3*worldPos;
334	#endif
335	#endif
336	
337	#ifdef VERTEXCOLOR
338	
339	vColor=color;
340	#endif
341	#ifdef POINTSIZE
342	gl_PointSize=pointSize;
343	#endif
344	#ifdef LOGARITHMICDEPTH
345	vFragmentDepth=1.0+gl_Position.w;
346	gl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;
347	#endif
348	}
Fragment shader: default
1	#define DIFFUSE
2	#define SPECULAROVERALPHA
3	#define SPECULARTERM
4	#define NORMAL
5	#define UV1
6	#define UV2
7	#define NUM_BONE_INFLUENCERS 0
8	#define BonesPerMesh 0
9	#define NUM_MORPH_INFLUENCERS 0
10	#define LIGHT0
11	#define HEMILIGHT0
12	#define LIGHT1
13	#define DIRLIGHT1
14	#define SHADOW1
15	#define SHADOWS
16	
17	precision highp float;
18	uniform vec4 vDiffuseColor;
19	#ifdef SPECULARTERM
20	uniform vec4 vSpecularColor;
21	#endif
22	uniform vec3 vEmissiveColor;
23	
24	#ifdef DIFFUSE
25	uniform vec2 vDiffuseInfos;
26	#endif
27	#ifdef AMBIENT
28	uniform vec2 vAmbientInfos;
29	#endif
30	#ifdef OPACITY 
31	uniform vec2 vOpacityInfos;
32	#endif
33	#ifdef EMISSIVE
34	uniform vec2 vEmissiveInfos;
35	#endif
36	#ifdef LIGHTMAP
37	uniform vec2 vLightmapInfos;
38	#endif
39	#ifdef BUMP
40	uniform vec3 vBumpInfos;
41	#endif
42	#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)
43	uniform mat4 view;
44	#endif
45	#ifdef REFRACTION
46	uniform vec4 vRefractionInfos;
47	#ifndef REFRACTIONMAP_3D
48	uniform mat4 refractionMatrix;
49	#endif
50	#ifdef REFRACTIONFRESNEL
51	uniform vec4 refractionLeftColor;
52	uniform vec4 refractionRightColor;
53	#endif
54	#endif
55	#if defined(SPECULAR) && defined(SPECULARTERM)
56	uniform vec2 vSpecularInfos;
57	#endif
58	#ifdef DIFFUSEFRESNEL
59	uniform vec4 diffuseLeftColor;
60	uniform vec4 diffuseRightColor;
61	#endif
62	#ifdef OPACITYFRESNEL
63	uniform vec4 opacityParts;
64	#endif
65	#ifdef EMISSIVEFRESNEL
66	uniform vec4 emissiveLeftColor;
67	uniform vec4 emissiveRightColor;
68	#endif
69	
70	#ifdef REFLECTION
71	uniform vec2 vReflectionInfos;
72	#ifdef REFLECTIONMAP_SKYBOX
73	#else
74	#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)
75	uniform mat4 reflectionMatrix;
76	#endif
77	#endif
78	#ifdef REFLECTIONFRESNEL
79	uniform vec4 reflectionLeftColor;
80	uniform vec4 reflectionRightColor;
81	#endif
82	#endif
83	#ifdef BUMP
84	#extension GL_OES_standard_derivatives : enable
85	#endif
86	#ifdef LOGARITHMICDEPTH
87	#extension GL_EXT_frag_depth : enable
88	#endif
89	
90	#define RECIPROCAL_PI2 0.15915494
91	uniform vec3 vEyePosition;
92	uniform vec3 vAmbientColor;
93	
94	varying vec3 vPositionW;
95	#ifdef NORMAL
96	varying vec3 vNormalW;
97	#endif
98	#ifdef VERTEXCOLOR
99	varying vec4 vColor;
100	#endif
101	
102	mat3 transposeMat3(mat3 inMatrix) {
103	vec3 i0=inMatrix[0];
104	vec3 i1=inMatrix[1];
105	vec3 i2=inMatrix[2];
106	mat3 outMatrix=mat3(
107	vec3(i0.x,i1.x,i2.x),
108	vec3(i0.y,i1.y,i2.y),
109	vec3(i0.z,i1.z,i2.z)
110	);
111	return outMatrix;
112	}
113	
114	#ifdef LIGHT0
115	uniform vec4 vLightData0;
116	uniform vec4 vLightDiffuse0;
117	#ifdef SPECULARTERM
118	uniform vec3 vLightSpecular0;
119	#else
120	vec3 vLightSpecular0=vec3(0.);
121	#endif
122	#ifdef SHADOW0
123	#if defined(SPOTLIGHT0) || defined(DIRLIGHT0)
124	varying vec4 vPositionFromLight0;
125	uniform sampler2D shadowSampler0;
126	#else
127	uniform samplerCube shadowSampler0;
128	#endif
129	uniform vec3 shadowsInfo0;
130	#endif
131	#ifdef SPOTLIGHT0
132	uniform vec4 vLightDirection0;
133	#endif
134	#ifdef HEMILIGHT0
135	uniform vec3 vLightGround0;
136	#endif
137	#endif
138	#ifdef LIGHT1
139	uniform vec4 vLightData1;
140	uniform vec4 vLightDiffuse1;
141	#ifdef SPECULARTERM
142	uniform vec3 vLightSpecular1;
143	#else
144	vec3 vLightSpecular1=vec3(0.);
145	#endif
146	#ifdef SHADOW1
147	#if defined(SPOTLIGHT1) || defined(DIRLIGHT1)
148	varying vec4 vPositionFromLight1;
149	uniform sampler2D shadowSampler1;
150	#else
151	uniform samplerCube shadowSampler1;
152	#endif
153	uniform vec3 shadowsInfo1;
154	#endif
155	#ifdef SPOTLIGHT1
156	uniform vec4 vLightDirection1;
157	#endif
158	#ifdef HEMILIGHT1
159	uniform vec3 vLightGround1;
160	#endif
161	#endif
162	#ifdef LIGHT2
163	uniform vec4 vLightData2;
164	uniform vec4 vLightDiffuse2;
165	#ifdef SPECULARTERM
166	uniform vec3 vLightSpecular2;
167	#else
168	vec3 vLightSpecular2=vec3(0.);
169	#endif
170	#ifdef SHADOW2
171	#if defined(SPOTLIGHT2) || defined(DIRLIGHT2)
172	varying vec4 vPositionFromLight2;
173	uniform sampler2D shadowSampler2;
174	#else
175	uniform samplerCube shadowSampler2;
176	#endif
177	uniform vec3 shadowsInfo2;
178	#endif
179	#ifdef SPOTLIGHT2
180	uniform vec4 vLightDirection2;
181	#endif
182	#ifdef HEMILIGHT2
183	uniform vec3 vLightGround2;
184	#endif
185	#endif
186	#ifdef LIGHT3
187	uniform vec4 vLightData3;
188	uniform vec4 vLightDiffuse3;
189	#ifdef SPECULARTERM
190	uniform vec3 vLightSpecular3;
191	#else
192	vec3 vLightSpecular3=vec3(0.);
193	#endif
194	#ifdef SHADOW3
195	#if defined(SPOTLIGHT3) || defined(DIRLIGHT3)
196	varying vec4 vPositionFromLight3;
197	uniform sampler2D shadowSampler3;
198	#else
199	uniform samplerCube shadowSampler3;
200	#endif
201	uniform vec3 shadowsInfo3;
202	#endif
203	#ifdef SPOTLIGHT3
204	uniform vec4 vLightDirection3;
205	#endif
206	#ifdef HEMILIGHT3
207	uniform vec3 vLightGround3;
208	#endif
209	#endif
210	
211	
212	struct lightingInfo
213	{
214	vec3 diffuse;
215	#ifdef SPECULARTERM
216	vec3 specular;
217	#endif
218	#ifdef NDOTL
219	float ndl;
220	#endif
221	};
222	lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {
223	lightingInfo result;
224	vec3 lightVectorW;
225	float attenuation=1.0;
226	if (lightData.w == 0.)
227	{
228	vec3 direction=lightData.xyz-vPositionW;
229	attenuation=max(0.,1.0-length(direction)/range);
230	lightVectorW=normalize(direction);
231	}
232	else
233	{
234	lightVectorW=normalize(-lightData.xyz);
235	}
236	
237	float ndl=max(0.,dot(vNormal,lightVectorW));
238	#ifdef NDOTL
239	result.ndl=ndl;
240	#endif
241	result.diffuse=ndl*diffuseColor*attenuation;
242	#ifdef SPECULARTERM
243	
244	vec3 angleW=normalize(viewDirectionW+lightVectorW);
245	float specComp=max(0.,dot(vNormal,angleW));
246	specComp=pow(specComp,max(1.,glossiness));
247	result.specular=specComp*specularColor*attenuation;
248	#endif
249	return result;
250	}
251	lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {
252	lightingInfo result;
253	vec3 direction=lightData.xyz-vPositionW;
254	vec3 lightVectorW=normalize(direction);
255	float attenuation=max(0.,1.0-length(direction)/range);
256	
257	float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));
258	if (cosAngle>=lightDirection.w)
259	{
260	cosAngle=max(0.,pow(cosAngle,lightData.w));
261	attenuation*=cosAngle;
262	
263	float ndl=max(0.,dot(vNormal,lightVectorW));
264	#ifdef NDOTL
265	result.ndl=ndl;
266	#endif
267	result.diffuse=ndl*diffuseColor*attenuation;
268	#ifdef SPECULARTERM
269	
270	vec3 angleW=normalize(viewDirectionW+lightVectorW);
271	float specComp=max(0.,dot(vNormal,angleW));
272	specComp=pow(specComp,max(1.,glossiness));
273	result.specular=specComp*specularColor*attenuation;
274	#endif
275	return result;
276	}
277	result.diffuse=vec3(0.);
278	#ifdef SPECULARTERM
279	result.specular=vec3(0.);
280	#endif
281	#ifdef NDOTL
282	result.ndl=0.;
283	#endif
284	return result;
285	}
286	lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {
287	lightingInfo result;
288	
289	float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;
290	#ifdef NDOTL
291	result.ndl=ndl;
292	#endif
293	result.diffuse=mix(groundColor,diffuseColor,ndl);
294	#ifdef SPECULARTERM
295	
296	vec3 angleW=normalize(viewDirectionW+lightData.xyz);
297	float specComp=max(0.,dot(vNormal,angleW));
298	specComp=pow(specComp,max(1.,glossiness));
299	result.specular=specComp*specularColor;
300	#endif
301	return result;
302	}
303	
304	#ifdef SHADOWS
305	#ifndef SHADOWFULLFLOAT
306	float unpack(vec4 color)
307	{
308	const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);
309	return dot(color,bit_shift);
310	}
311	#endif
312	uniform vec2 depthValues;
313	float computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness)
314	{
315	vec3 directionToLight=vPositionW-lightPosition;
316	float depth=length(directionToLight);
317	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
318	depth=clamp(depth,0.,1.0);
319	directionToLight=normalize(directionToLight);
320	directionToLight.y=-directionToLight.y;
321	#ifndef SHADOWFULLFLOAT
322	float shadow=unpack(textureCube(shadowSampler,directionToLight));
323	#else
324	float shadow=textureCube(shadowSampler,directionToLight).x;
325	#endif
326	if (depth>shadow)
327	{
328	#ifdef OVERLOADEDSHADOWVALUES
329	return mix(1.0,darkness,vOverloadedShadowIntensity.x);
330	#else
331	return darkness;
332	#endif
333	}
334	return 1.0;
335	}
336	float computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness)
337	{
338	vec3 directionToLight=vPositionW-lightPosition;
339	float depth=length(directionToLight);
340	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
341	depth=clamp(depth,0.,1.0);
342	directionToLight=normalize(directionToLight);
343	directionToLight.y=-directionToLight.y;
344	float visibility=1.;
345	vec3 poissonDisk[4];
346	poissonDisk[0]=vec3(-1.0,1.0,-1.0);
347	poissonDisk[1]=vec3(1.0,-1.0,-1.0);
348	poissonDisk[2]=vec3(-1.0,-1.0,-1.0);
349	poissonDisk[3]=vec3(1.0,-1.0,1.0);
350	
351	#ifndef SHADOWFULLFLOAT
352	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;
353	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;
354	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;
355	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;
356	#else
357	if (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;
358	if (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;
359	if (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;
360	if (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;
361	#endif
362	#ifdef OVERLOADEDSHADOWVALUES
363	return min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));
364	#else
365	return min(1.0,visibility+darkness);
366	#endif
367	}
368	float computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale)
369	{
370	vec3 directionToLight=vPositionW-lightPosition;
371	float depth=length(directionToLight);
372	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
373	float shadowPixelDepth=clamp(depth,0.,1.0);
374	directionToLight=normalize(directionToLight);
375	directionToLight.y=-directionToLight.y;
376	#ifndef SHADOWFULLFLOAT
377	float shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));
378	#else
379	float shadowMapSample=textureCube(shadowSampler,directionToLight).x;
380	#endif
381	float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample-darkness,0.,1.); 
382	#ifdef OVERLOADEDSHADOWVALUES
383	return mix(1.0,esm,vOverloadedShadowIntensity.x);
384	#else
385	return esm;
386	#endif
387	}
388	float computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness)
389	{
390	vec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;
391	depth=0.5*depth+vec3(0.5);
392	vec2 uv=depth.xy;
393	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
394	{
395	return 1.0;
396	}
397	#ifndef SHADOWFULLFLOAT
398	float shadow=unpack(texture2D(shadowSampler,uv));
399	#else
400	float shadow=texture2D(shadowSampler,uv).x;
401	#endif
402	if (depth.z>shadow)
403	{
404	#ifdef OVERLOADEDSHADOWVALUES
405	return mix(1.0,darkness,vOverloadedShadowIntensity.x);
406	#else
407	return darkness;
408	#endif
409	}
410	return 1.;
411	}
412	float computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float darkness)
413	{
414	vec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;
415	depth=0.5*depth+vec3(0.5);
416	vec2 uv=depth.xy;
417	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
418	{
419	return 1.0;
420	}
421	float visibility=1.;
422	vec2 poissonDisk[4];
423	poissonDisk[0]=vec2(-0.94201624,-0.39906216);
424	poissonDisk[1]=vec2(0.94558609,-0.76890725);
425	poissonDisk[2]=vec2(-0.094184101,-0.92938870);
426	poissonDisk[3]=vec2(0.34495938,0.29387760);
427	
428	#ifndef SHADOWFULLFLOAT
429	if (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<depth.z) visibility-=0.25;
430	if (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<depth.z) visibility-=0.25;
431	if (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<depth.z) visibility-=0.25;
432	if (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<depth.z) visibility-=0.25;
433	#else
434	if (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<depth.z) visibility-=0.25;
435	if (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<depth.z) visibility-=0.25;
436	if (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<depth.z) visibility-=0.25;
437	if (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<depth.z) visibility-=0.25;
438	#endif
439	#ifdef OVERLOADEDSHADOWVALUES
440	return mix(1.0,min(1.0,visibility+darkness),vOverloadedShadowIntensity.x);
441	#else
442	return min(1.0,visibility+darkness);
443	#endif
444	}
445	float computeShadowWithESM(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float depthScale)
446	{
447	vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;
448	vec3 depth=0.5*clipSpace+vec3(0.5);
449	vec2 uv=depth.xy;
450	float shadowPixelDepth=depth.z;
451	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
452	{
453	return 1.0;
454	}
455	#ifndef SHADOWFULLFLOAT
456	float shadowMapSample=unpack(texture2D(shadowSampler,uv));
457	#else
458	float shadowMapSample=texture2D(shadowSampler,uv).x;
459	#endif
460	float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample-darkness,0.,1.); 
461	
462	
463	
464	
465	
466	#ifdef OVERLOADEDSHADOWVALUES
467	return mix(1.0,esm,vOverloadedShadowIntensity.x);
468	#else
469	return esm;
470	#endif
471	}
472	#endif
473	
474	#ifdef DIFFUSE
475	varying vec2 vDiffuseUV;
476	uniform sampler2D diffuseSampler;
477	#endif
478	#ifdef AMBIENT
479	varying vec2 vAmbientUV;
480	uniform sampler2D ambientSampler;
481	#endif
482	#ifdef OPACITY 
483	varying vec2 vOpacityUV;
484	uniform sampler2D opacitySampler;
485	#endif
486	#ifdef EMISSIVE
487	varying vec2 vEmissiveUV;
488	uniform sampler2D emissiveSampler;
489	#endif
490	#ifdef LIGHTMAP
491	varying vec2 vLightmapUV;
492	uniform sampler2D lightmapSampler;
493	#endif
494	#ifdef REFRACTION
495	#ifdef REFRACTIONMAP_3D
496	uniform samplerCube refractionCubeSampler;
497	#else
498	uniform sampler2D refraction2DSampler;
499	#endif
500	#endif
501	#if defined(SPECULAR) && defined(SPECULARTERM)
502	varying vec2 vSpecularUV;
503	uniform sampler2D specularSampler;
504	#endif
505	
506	#ifdef FRESNEL
507	float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
508	{
509	float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);
510	return clamp(fresnelTerm,0.,1.);
511	}
512	#endif
513	
514	#ifdef REFLECTION
515	#ifdef REFLECTIONMAP_3D
516	uniform samplerCube reflectionCubeSampler;
517	#else
518	uniform sampler2D reflection2DSampler;
519	#endif
520	#ifdef REFLECTIONMAP_SKYBOX
521	varying vec3 vPositionUVW;
522	#else
523	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
524	varying vec3 vDirectionW;
525	#endif
526	#endif
527	vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)
528	{
529	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
530	vec3 direction=normalize(vDirectionW);
531	float t=clamp(direction.y*-0.5+0.5,0.,1.0);
532	float s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;
533	#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
534	return vec3(1.0-s,t,0);
535	#else
536	return vec3(s,t,0);
537	#endif
538	#endif
539	#ifdef REFLECTIONMAP_EQUIRECTANGULAR
540	vec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition);
541	vec3 r=reflect(cameraToVertex,worldNormal);
542	float t=clamp(r.y*-0.5+0.5,0.,1.0);
543	float s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;
544	return vec3(s,t,0);
545	#endif
546	#ifdef REFLECTIONMAP_SPHERICAL
547	vec3 viewDir=normalize(vec3(view*worldPos));
548	vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));
549	vec3 r=reflect(viewDir,viewNormal);
550	r.z=r.z-1.0;
551	float m=2.0*length(r);
552	return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);
553	#endif
554	#ifdef REFLECTIONMAP_PLANAR
555	vec3 viewDir=worldPos.xyz-vEyePosition;
556	vec3 coords=normalize(reflect(viewDir,worldNormal));
557	return vec3(reflectionMatrix*vec4(coords,1));
558	#endif
559	#ifdef REFLECTIONMAP_CUBIC
560	vec3 viewDir=worldPos.xyz-vEyePosition;
561	vec3 coords=reflect(viewDir,worldNormal);
562	#ifdef INVERTCUBICMAP
563	coords.y=1.0-coords.y;
564	#endif
565	return vec3(reflectionMatrix*vec4(coords,0));
566	#endif
567	#ifdef REFLECTIONMAP_PROJECTION
568	return vec3(reflectionMatrix*(view*worldPos));
569	#endif
570	#ifdef REFLECTIONMAP_SKYBOX
571	return vPositionUVW;
572	#endif
573	#ifdef REFLECTIONMAP_EXPLICIT
574	return vec3(0,0,0);
575	#endif
576	}
577	#endif
578	#ifdef CAMERACOLORGRADING
579	uniform sampler2D cameraColorGrading2DSampler;
580	uniform vec4 vCameraColorGradingInfos;
581	uniform vec4 vCameraColorGradingScaleOffset; 
582	vec4 colorGrades(vec4 color) 
583	{ 
584	
585	float sliceContinuous=color.z*vCameraColorGradingInfos.z;
586	float sliceInteger=floor(sliceContinuous);
587	
588	
589	float sliceFraction=sliceContinuous-sliceInteger; 
590	
591	vec2 sliceUV=color.xy*vCameraColorGradingScaleOffset.xy+vCameraColorGradingScaleOffset.zw;
592	
593	
594	sliceUV.x+=sliceInteger*vCameraColorGradingInfos.w;
595	vec4 slice0Color=texture2D(cameraColorGrading2DSampler,sliceUV);
596	sliceUV.x+=vCameraColorGradingInfos.w;
597	vec4 slice1Color=texture2D(cameraColorGrading2DSampler,sliceUV);
598	vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);
599	color.rgb=mix(color.rgb,result,vCameraColorGradingInfos.x);
600	return color;
601	}
602	#endif
603	#ifdef CAMERACOLORCURVES
604	uniform vec4 vCameraColorCurveNeutral;
605	uniform vec4 vCameraColorCurvePositive;
606	uniform vec4 vCameraColorCurveNegative;
607	const vec3 HDTVRec709_RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);
608	vec3 applyColorCurves(vec3 original) {
609	vec3 result=original;
610	
611	
612	
613	float luma=dot(result.rgb,HDTVRec709_RGBLuminanceCoefficients);
614	vec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0,0.0),vec2(1.0,1.0));
615	vec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;
616	result.rgb*=colorCurve.rgb;
617	result.rgb=mix(vec3(luma,luma,luma),result.rgb,colorCurve.a);
618	return result;
619	}
620	#endif
621	#ifdef BUMP
622	varying vec2 vBumpUV;
623	uniform sampler2D bumpSampler;
624	#if defined(TANGENT) && defined(NORMAL) 
625	varying mat3 vTBN;
626	#endif
627	
628	mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)
629	{
630	
631	uv=gl_FrontFacing ? uv : -uv;
632	
633	vec3 dp1=dFdx(p);
634	vec3 dp2=dFdy(p);
635	vec2 duv1=dFdx(uv);
636	vec2 duv2=dFdy(uv);
637	
638	vec3 dp2perp=cross(dp2,normal);
639	vec3 dp1perp=cross(normal,dp1);
640	vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;
641	vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;
642	
643	float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));
644	return mat3(tangent*invmax,binormal*invmax,normal);
645	}
646	vec3 perturbNormal(mat3 cotangentFrame,vec2 uv)
647	{
648	vec3 map=texture2D(bumpSampler,uv).xyz;
649	#ifdef INVERTNORMALMAPX
650	map.x=1.0-map.x;
651	#endif
652	#ifdef INVERTNORMALMAPY
653	map.y=1.0-map.y;
654	#endif
655	map=map*255./127.-128./127.;
656	return normalize(cotangentFrame*map);
657	}
658	#ifdef PARALLAX
659	const float minSamples=4.;
660	const float maxSamples=15.;
661	const int iMaxSamples=15;
662	
663	vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {
664	float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;
665	parallaxLimit*=parallaxScale;
666	vec2 vOffsetDir=normalize(vViewDirCoT.xy);
667	vec2 vMaxOffset=vOffsetDir*parallaxLimit;
668	float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));
669	float stepSize=1.0/numSamples;
670	
671	float currRayHeight=1.0;
672	vec2 vCurrOffset=vec2(0,0);
673	vec2 vLastOffset=vec2(0,0);
674	float lastSampledHeight=1.0;
675	float currSampledHeight=1.0;
676	for (int i=0; i<iMaxSamples; i++)
677	{
678	currSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;
679	
680	if (currSampledHeight>currRayHeight)
681	{
682	float delta1=currSampledHeight-currRayHeight;
683	float delta2=(currRayHeight+stepSize)-lastSampledHeight;
684	float ratio=delta1/(delta1+delta2);
685	vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;
686	
687	break;
688	}
689	else
690	{
691	currRayHeight-=stepSize;
692	vLastOffset=vCurrOffset;
693	vCurrOffset+=stepSize*vMaxOffset;
694	lastSampledHeight=currSampledHeight;
695	}
696	}
697	return vCurrOffset;
698	}
699	vec2 parallaxOffset(vec3 viewDir,float heightScale)
700	{
701	
702	float height=texture2D(bumpSampler,vBumpUV).w;
703	vec2 texCoordOffset=heightScale*viewDir.xy*height;
704	return -texCoordOffset;
705	}
706	#endif
707	#endif
708	#ifdef CLIPPLANE
709	varying float fClipDistance;
710	#endif
711	#ifdef LOGARITHMICDEPTH
712	uniform float logarithmicDepthConstant;
713	varying float vFragmentDepth;
714	#endif
715	#ifdef FOG
716	#define FOGMODE_NONE 0.
717	#define FOGMODE_EXP 1.
718	#define FOGMODE_EXP2 2.
719	#define FOGMODE_LINEAR 3.
720	#define E 2.71828
721	uniform vec4 vFogInfos;
722	uniform vec3 vFogColor;
723	varying vec3 vFogDistance;
724	float CalcFogFactor()
725	{
726	float fogCoeff=1.0;
727	float fogStart=vFogInfos.y;
728	float fogEnd=vFogInfos.z;
729	float fogDensity=vFogInfos.w;
730	float fogDistance=length(vFogDistance);
731	if (FOGMODE_LINEAR == vFogInfos.x)
732	{
733	fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);
734	}
735	else if (FOGMODE_EXP == vFogInfos.x)
736	{
737	fogCoeff=1.0/pow(E,fogDistance*fogDensity);
738	}
739	else if (FOGMODE_EXP2 == vFogInfos.x)
740	{
741	fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);
742	}
743	return clamp(fogCoeff,0.0,1.0);
744	}
745	#endif
746	void main(void) {
747	#ifdef CLIPPLANE
748	if (fClipDistance>0.0)
749	{
750	discard;
751	}
752	#endif
753	vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
754	
755	vec4 baseColor=vec4(1.,1.,1.,1.);
756	vec3 diffuseColor=vDiffuseColor.rgb;
757	
758	float alpha=vDiffuseColor.a;
759	
760	#ifdef NORMAL
761	vec3 normalW=normalize(vNormalW);
762	#else
763	vec3 normalW=vec3(1.0,1.0,1.0);
764	#endif
765	vec2 uvOffset=vec2(0.0,0.0);
766	#if defined(BUMP) || defined(PARALLAX)
767	#if defined(TANGENT) && defined(NORMAL)
768	mat3 TBN=vTBN;
769	#else
770	mat3 TBN=cotangent_frame(normalW*vBumpInfos.y,vPositionW,vBumpUV);
771	#endif
772	#endif
773	#ifdef PARALLAX
774	mat3 invTBN=transposeMat3(TBN);
775	#ifdef PARALLAXOCCLUSION
776	uvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);
777	#else
778	uvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);
779	#endif
780	#endif
781	#ifdef BUMP
782	normalW=perturbNormal(TBN,vBumpUV+uvOffset);
783	#endif
784	#ifdef TWOSIDEDLIGHTING
785	normalW=gl_FrontFacing ? normalW : -normalW;
786	#endif
787	#ifdef DIFFUSE
788	baseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);
789	#ifdef ALPHATEST
790	if (baseColor.a<0.4)
791	discard;
792	#endif
793	#ifdef ALPHAFROMDIFFUSE
794	alpha*=baseColor.a;
795	#endif
796	baseColor.rgb*=vDiffuseInfos.y;
797	#endif
798	#ifdef VERTEXCOLOR
799	baseColor.rgb*=vColor.rgb;
800	#endif
801	
802	vec3 baseAmbientColor=vec3(1.,1.,1.);
803	#ifdef AMBIENT
804	baseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;
805	#endif
806	
807	#ifdef SPECULARTERM
808	float glossiness=vSpecularColor.a;
809	vec3 specularColor=vSpecularColor.rgb;
810	#ifdef SPECULAR
811	vec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);
812	specularColor=specularMapColor.rgb;
813	#ifdef GLOSSINESS
814	glossiness=glossiness*specularMapColor.a;
815	#endif
816	#endif
817	#else
818	float glossiness=0.;
819	#endif
820	
821	vec3 diffuseBase=vec3(0.,0.,0.);
822	lightingInfo info;
823	#ifdef SPECULARTERM
824	vec3 specularBase=vec3(0.,0.,0.);
825	#endif
826	float shadow=1.;
827	#ifdef LIGHTMAP
828	vec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;
829	#endif
830	#ifdef LIGHT0
831	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED0) && defined(LIGHTMAPNOSPECULAR0)
832	
833	#else
834	#ifdef SPOTLIGHT0
835	info=computeSpotLighting(viewDirectionW,normalW,vLightData0,vLightDirection0,vLightDiffuse0.rgb,vLightSpecular0,vLightDiffuse0.a,glossiness);
836	#endif
837	#ifdef HEMILIGHT0
838	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData0,vLightDiffuse0.rgb,vLightSpecular0,vLightGround0,glossiness);
839	#endif
840	#if defined(POINTLIGHT0) || defined(DIRLIGHT0)
841	info=computeLighting(viewDirectionW,normalW,vLightData0,vLightDiffuse0.rgb,vLightSpecular0,vLightDiffuse0.a,glossiness);
842	#endif
843	#endif
844	#ifdef SHADOW0
845	#ifdef SHADOWESM0
846	#if defined(POINTLIGHT0)
847	shadow=computeShadowWithESMCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.x,shadowsInfo0.z);
848	#else
849	shadow=computeShadowWithESM(vPositionFromLight0,shadowSampler0,shadowsInfo0.x,shadowsInfo0.z);
850	#endif
851	#else 
852	#ifdef SHADOWPCF0
853	#if defined(POINTLIGHT0)
854	shadow=computeShadowWithPCFCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.y,shadowsInfo0.x);
855	#else
856	shadow=computeShadowWithPCF(vPositionFromLight0,shadowSampler0,shadowsInfo0.y,shadowsInfo0.x);
857	#endif
858	#else
859	#if defined(POINTLIGHT0)
860	shadow=computeShadowCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.x);
861	#else
862	shadow=computeShadow(vPositionFromLight0,shadowSampler0,shadowsInfo0.x);
863	#endif
864	#endif
865	#endif
866	#else
867	shadow=1.;
868	#endif
869	#ifdef CUSTOMUSERLIGHTING
870	diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);
871	#ifdef SPECULARTERM
872	specularBase+=computeCustomSpecularLighting(info,specularBase,shadow);
873	#endif
874	#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED0)
875	diffuseBase+=lightmapColor*shadow;
876	#ifdef SPECULARTERM
877	#ifndef LIGHTMAPNOSPECULAR0
878	specularBase+=info.specular*shadow*lightmapColor;
879	#endif
880	#endif
881	#else
882	diffuseBase+=info.diffuse*shadow;
883	#ifdef SPECULARTERM
884	specularBase+=info.specular*shadow;
885	#endif
886	#endif
887	#endif
888	#ifdef LIGHT1
889	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED1) && defined(LIGHTMAPNOSPECULAR1)
890	
891	#else
892	#ifdef SPOTLIGHT1
893	info=computeSpotLighting(viewDirectionW,normalW,vLightData1,vLightDirection1,vLightDiffuse1.rgb,vLightSpecular1,vLightDiffuse1.a,glossiness);
894	#endif
895	#ifdef HEMILIGHT1
896	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData1,vLightDiffuse1.rgb,vLightSpecular1,vLightGround1,glossiness);
897	#endif
898	#if defined(POINTLIGHT1) || defined(DIRLIGHT1)
899	info=computeLighting(viewDirectionW,normalW,vLightData1,vLightDiffuse1.rgb,vLightSpecular1,vLightDiffuse1.a,glossiness);
900	#endif
901	#endif
902	#ifdef SHADOW1
903	#ifdef SHADOWESM1
904	#if defined(POINTLIGHT1)
905	shadow=computeShadowWithESMCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.x,shadowsInfo1.z);
906	#else
907	shadow=computeShadowWithESM(vPositionFromLight1,shadowSampler1,shadowsInfo1.x,shadowsInfo1.z);
908	#endif
909	#else 
910	#ifdef SHADOWPCF1
911	#if defined(POINTLIGHT1)
912	shadow=computeShadowWithPCFCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.y,shadowsInfo1.x);
913	#else
914	shadow=computeShadowWithPCF(vPositionFromLight1,shadowSampler1,shadowsInfo1.y,shadowsInfo1.x);
915	#endif
916	#else
917	#if defined(POINTLIGHT1)
918	shadow=computeShadowCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.x);
919	#else
920	shadow=computeShadow(vPositionFromLight1,shadowSampler1,shadowsInfo1.x);
921	#endif
922	#endif
923	#endif
924	#else
925	shadow=1.;
926	#endif
927	#ifdef CUSTOMUSERLIGHTING
928	diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);
929	#ifdef SPECULARTERM
930	specularBase+=computeCustomSpecularLighting(info,specularBase,shadow);
931	#endif
932	#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED1)
933	diffuseBase+=lightmapColor*shadow;
934	#ifdef SPECULARTERM
935	#ifndef LIGHTMAPNOSPECULAR1
936	specularBase+=info.specular*shadow*lightmapColor;
937	#endif
938	#endif
939	#else
940	diffuseBase+=info.diffuse*shadow;
941	#ifdef SPECULARTERM
942	specularBase+=info.specular*shadow;
943	#endif
944	#endif
945	#endif
946	#ifdef LIGHT2
947	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED2) && defined(LIGHTMAPNOSPECULAR2)
948	
949	#else
950	#ifdef SPOTLIGHT2
951	info=computeSpotLighting(viewDirectionW,normalW,vLightData2,vLightDirection2,vLightDiffuse2.rgb,vLightSpecular2,vLightDiffuse2.a,glossiness);
952	#endif
953	#ifdef HEMILIGHT2
954	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData2,vLightDiffuse2.rgb,vLightSpecular2,vLightGround2,glossiness);
955	#endif
956	#if defined(POINTLIGHT2) || defined(DIRLIGHT2)
957	info=computeLighting(viewDirectionW,normalW,vLightData2,vLightDiffuse2.rgb,vLightSpecular2,vLightDiffuse2.a,glossiness);
958	#endif
959	#endif
960	#ifdef SHADOW2
961	#ifdef SHADOWESM2
962	#if defined(POINTLIGHT2)
963	shadow=computeShadowWithESMCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.x,shadowsInfo2.z);
964	#else
965	shadow=computeShadowWithESM(vPositionFromLight2,shadowSampler2,shadowsInfo2.x,shadowsInfo2.z);
966	#endif
967	#else 
968	#ifdef SHADOWPCF2
969	#if defined(POINTLIGHT2)
970	shadow=computeShadowWithPCFCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.y,shadowsInfo2.x);
971	#else
972	shadow=computeShadowWithPCF(vPositionFromLight2,shadowSampler2,shadowsInfo2.y,shadowsInfo2.x);
973	#endif
974	#else
975	#if defined(POINTLIGHT2)
976	shadow=computeShadowCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.x);
977	#else
978	shadow=computeShadow(vPositionFromLight2,shadowSampler2,shadowsInfo2.x);
979	#endif
980	#endif
981	#endif
982	#else
983	shadow=1.;
984	#endif
985	#ifdef CUSTOMUSERLIGHTING
986	diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);
987	#ifdef SPECULARTERM
988	specularBase+=computeCustomSpecularLighting(info,specularBase,shadow);
989	#endif
990	#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED2)
991	diffuseBase+=lightmapColor*shadow;
992	#ifdef SPECULARTERM
993	#ifndef LIGHTMAPNOSPECULAR2
994	specularBase+=info.specular*shadow*lightmapColor;
995	#endif
996	#endif
997	#else
998	diffuseBase+=info.diffuse*shadow;
999	#ifdef SPECULARTERM
1000	specularBase+=info.specular*shadow;
1001	#endif
1002	#endif
1003	#endif
1004	#ifdef LIGHT3
1005	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED3) && defined(LIGHTMAPNOSPECULAR3)
1006	
1007	#else
1008	#ifdef SPOTLIGHT3
1009	info=computeSpotLighting(viewDirectionW,normalW,vLightData3,vLightDirection3,vLightDiffuse3.rgb,vLightSpecular3,vLightDiffuse3.a,glossiness);
1010	#endif
1011	#ifdef HEMILIGHT3
1012	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData3,vLightDiffuse3.rgb,vLightSpecular3,vLightGround3,glossiness);
1013	#endif
1014	#if defined(POINTLIGHT3) || defined(DIRLIGHT3)
1015	info=computeLighting(viewDirectionW,normalW,vLightData3,vLightDiffuse3.rgb,vLightSpecular3,vLightDiffuse3.a,glossiness);
1016	#endif
1017	#endif
1018	#ifdef SHADOW3
1019	#ifdef SHADOWESM3
1020	#if defined(POINTLIGHT3)
1021	shadow=computeShadowWithESMCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.x,shadowsInfo3.z);
1022	#else
1023	shadow=computeShadowWithESM(vPositionFromLight3,shadowSampler3,shadowsInfo3.x,shadowsInfo3.z);
1024	#endif
1025	#else 
1026	#ifdef SHADOWPCF3
1027	#if defined(POINTLIGHT3)
1028	shadow=computeShadowWithPCFCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.y,shadowsInfo3.x);
1029	#else
1030	shadow=computeShadowWithPCF(vPositionFromLight3,shadowSampler3,shadowsInfo3.y,shadowsInfo3.x);
1031	#endif
1032	#else
1033	#if defined(POINTLIGHT3)
1034	shadow=computeShadowCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.x);
1035	#else
1036	shadow=computeShadow(vPositionFromLight3,shadowSampler3,shadowsInfo3.x);
1037	#endif
1038	#endif
1039	#endif
1040	#else
1041	shadow=1.;
1042	#endif
1043	#ifdef CUSTOMUSERLIGHTING
1044	diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);
1045	#ifdef SPECULARTERM
1046	specularBase+=computeCustomSpecularLighting(info,specularBase,shadow);
1047	#endif
1048	#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED3)
1049	diffuseBase+=lightmapColor*shadow;
1050	#ifdef SPECULARTERM
1051	#ifndef LIGHTMAPNOSPECULAR3
1052	specularBase+=info.specular*shadow*lightmapColor;
1053	#endif
1054	#endif
1055	#else
1056	diffuseBase+=info.diffuse*shadow;
1057	#ifdef SPECULARTERM
1058	specularBase+=info.specular*shadow;
1059	#endif
1060	#endif
1061	#endif
1062	
1063	
1064	vec3 refractionColor=vec3(0.,0.,0.);
1065	#ifdef REFRACTION
1066	vec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));
1067	#ifdef REFRACTIONMAP_3D
1068	refractionVector.y=refractionVector.y*vRefractionInfos.w;
1069	if (dot(refractionVector,viewDirectionW)<1.0)
1070	{
1071	refractionColor=textureCube(refractionCubeSampler,refractionVector).rgb*vRefractionInfos.x;
1072	}
1073	#else
1074	vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));
1075	vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;
1076	refractionCoords.y=1.0-refractionCoords.y;
1077	refractionColor=texture2D(refraction2DSampler,refractionCoords).rgb*vRefractionInfos.x;
1078	#endif
1079	#endif
1080	
1081	vec3 reflectionColor=vec3(0.,0.,0.);
1082	#ifdef REFLECTION
1083	vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
1084	#ifdef REFLECTIONMAP_3D
1085	#ifdef ROUGHNESS
1086	float bias=vReflectionInfos.y;
1087	#ifdef SPECULARTERM
1088	#ifdef SPECULAR
1089	#ifdef GLOSSINESS
1090	bias*=(1.0-specularMapColor.a);
1091	#endif
1092	#endif
1093	#endif
1094	reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb*vReflectionInfos.x;
1095	#else
1096	reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb*vReflectionInfos.x;
1097	#endif
1098	#else
1099	vec2 coords=vReflectionUVW.xy;
1100	#ifdef REFLECTIONMAP_PROJECTION
1101	coords/=vReflectionUVW.z;
1102	#endif
1103	coords.y=1.0-coords.y;
1104	reflectionColor=texture2D(reflection2DSampler,coords).rgb*vReflectionInfos.x;
1105	#endif
1106	#ifdef REFLECTIONFRESNEL
1107	float reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);
1108	#ifdef REFLECTIONFRESNELFROMSPECULAR
1109	#ifdef SPECULARTERM
1110	reflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
1111	#else
1112	reflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
1113	#endif
1114	#else
1115	reflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
1116	#endif
1117	#endif
1118	#endif
1119	#ifdef REFRACTIONFRESNEL
1120	float refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);
1121	refractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;
1122	#endif
1123	#ifdef OPACITY
1124	vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
1125	#ifdef OPACITYRGB
1126	opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);
1127	alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;
1128	#else
1129	alpha*=opacityMap.a*vOpacityInfos.y;
1130	#endif
1131	#endif
1132	#ifdef VERTEXALPHA
1133	alpha*=vColor.a;
1134	#endif
1135	#ifdef OPACITYFRESNEL
1136	float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);
1137	alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;
1138	#endif
1139	
1140	vec3 emissiveColor=vEmissiveColor;
1141	#ifdef EMISSIVE
1142	emissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;
1143	#endif
1144	#ifdef EMISSIVEFRESNEL
1145	float emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);
1146	emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;
1147	#endif
1148	
1149	#ifdef DIFFUSEFRESNEL
1150	float diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);
1151	diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;
1152	#endif
1153	
1154	#ifdef EMISSIVEASILLUMINATION
1155	vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
1156	#else
1157	#ifdef LINKEMISSIVEWITHDIFFUSE
1158	vec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
1159	#else
1160	vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
1161	#endif
1162	#endif
1163	#ifdef SPECULARTERM
1164	vec3 finalSpecular=specularBase*specularColor;
1165	#ifdef SPECULAROVERALPHA
1166	alpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);
1167	#endif
1168	#else
1169	vec3 finalSpecular=vec3(0.0);
1170	#endif
1171	#ifdef REFLECTIONOVERALPHA
1172	alpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);
1173	#endif
1174	
1175	#ifdef EMISSIVEASILLUMINATION
1176	vec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);
1177	#else
1178	vec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);
1179	#endif
1180	
1181	#ifdef LIGHTMAP
1182	#ifndef LIGHTMAPEXCLUDED
1183	#ifdef USELIGHTMAPASSHADOWMAP
1184	color.rgb*=lightmapColor;
1185	#else
1186	color.rgb+=lightmapColor;
1187	#endif
1188	#endif
1189	#endif
1190	#ifdef LOGARITHMICDEPTH
1191	gl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;
1192	#endif
1193	#ifdef FOG
1194	float fog=CalcFogFactor();
1195	color.rgb=fog*color.rgb+(1.0-fog)*vFogColor;
1196	#endif
1197	#ifdef CAMERACOLORGRADING
1198	color=colorGrades(color);
1199	#endif
1200	#ifdef CAMERACOLORCURVES
1201	color.rgb=applyColorCurves(color.rgb);
1202	#endif
1203	gl_FragColor=color;
1204	}
Fragment shader: pbr
1	#define ALBEDO
2	
3	
4	
5	#define NORMAL
6	#define UV1
7	#define UV2
8	#define NUM_BONE_INFLUENCERS 0
9	#define BonesPerMesh 0
10	#define REFLECTIONMAP_3D
11	#define REFLECTIONMAP_CUBIC
12	#define USESPHERICALFROMREFLECTIONMAP
13	#define LODBASEDMICROSFURACE
14	#define USEPHYSICALLIGHTFALLOFF
15	#define RADIANCEOVERALPHA
16	#define USEPMREMREFLECTION
17	#define NUM_MORPH_INFLUENCERS 0
18	#define LIGHT0
19	#define HEMILIGHT0
20	
21	#define DIRLIGHT1
22	
23	#define SHADOWS
24	
25	#if defined(BUMP)|| !defined(NORMAL)
26	#extension GL_OES_standard_derivatives : enable
27	#endif
28	#ifdef LODBASEDMICROSFURACE
29	#extension GL_EXT_shader_texture_lod : enable
30	#endif
31	#ifdef LOGARITHMICDEPTH
32	#extension GL_EXT_frag_depth : enable
33	#endif
34	precision highp float;
35	uniform vec3 vReflectionColor;
36	uniform vec4 vAlbedoColor;
37	
38	uniform vec4 vLightingIntensity;
39	#ifdef OVERLOADEDVALUES
40	uniform vec4 vOverloadedIntensity;
41	uniform vec3 vOverloadedAmbient;
42	uniform vec3 vOverloadedAlbedo;
43	uniform vec3 vOverloadedReflectivity;
44	uniform vec3 vOverloadedEmissive;
45	uniform vec3 vOverloadedReflection;
46	uniform vec3 vOverloadedMicroSurface;
47	#endif
48	#ifdef OVERLOADEDSHADOWVALUES
49	uniform vec4 vOverloadedShadowIntensity;
50	#endif
51	#if defined(REFLECTION) || defined(REFRACTION)
52	uniform vec2 vMicrosurfaceTextureLods;
53	#endif
54	uniform vec4 vReflectivityColor;
55	uniform vec3 vEmissiveColor;
56	
57	#ifdef ALBEDO
58	uniform vec2 vAlbedoInfos;
59	#endif
60	#ifdef AMBIENT
61	uniform vec3 vAmbientInfos;
62	#endif
63	#ifdef BUMP
64	uniform vec3 vBumpInfos;
65	#endif
66	#ifdef OPACITY 
67	uniform vec2 vOpacityInfos;
68	#endif
69	#ifdef EMISSIVE
70	uniform vec2 vEmissiveInfos;
71	#endif
72	#ifdef LIGHTMAP
73	uniform vec2 vLightmapInfos;
74	#endif
75	#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) 
76	uniform vec3 vReflectivityInfos;
77	#endif
78	#ifdef MICROSURFACEMAP
79	uniform vec2 vMicroSurfaceSamplerInfos;
80	#endif
81	#ifdef OPACITYFRESNEL
82	uniform vec4 opacityParts;
83	#endif
84	#ifdef EMISSIVEFRESNEL
85	uniform vec4 emissiveLeftColor;
86	uniform vec4 emissiveRightColor;
87	#endif
88	
89	#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)
90	uniform mat4 view;
91	#endif
92	
93	#ifdef REFRACTION
94	uniform vec4 vRefractionInfos;
95	#ifdef REFRACTIONMAP_3D
96	#else
97	uniform mat4 refractionMatrix;
98	#endif
99	#endif
100	
101	#ifdef REFLECTION
102	uniform vec2 vReflectionInfos;
103	#ifdef REFLECTIONMAP_SKYBOX
104	#else
105	#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)
106	uniform mat4 reflectionMatrix;
107	#endif
108	#endif
109	#endif
110	uniform vec3 vEyePosition;
111	uniform vec3 vAmbientColor;
112	uniform vec4 vCameraInfos;
113	
114	varying vec3 vPositionW;
115	#ifdef NORMAL
116	varying vec3 vNormalW;
117	#endif
118	#ifdef VERTEXCOLOR
119	varying vec4 vColor;
120	#endif
121	
122	#ifdef LIGHT0
123	uniform vec4 vLightData0;
124	uniform vec4 vLightDiffuse0;
125	#ifdef SPECULARTERM
126	uniform vec3 vLightSpecular0;
127	#else
128	vec3 vLightSpecular0=vec3(0.);
129	#endif
130	#ifdef SHADOW0
131	#if defined(SPOTLIGHT0) || defined(DIRLIGHT0)
132	varying vec4 vPositionFromLight0;
133	uniform sampler2D shadowSampler0;
134	#else
135	uniform samplerCube shadowSampler0;
136	#endif
137	uniform vec3 shadowsInfo0;
138	#endif
139	#ifdef SPOTLIGHT0
140	uniform vec4 vLightDirection0;
141	#endif
142	#ifdef HEMILIGHT0
143	uniform vec3 vLightGround0;
144	#endif
145	#endif
146	#ifdef LIGHT1
147	uniform vec4 vLightData1;
148	uniform vec4 vLightDiffuse1;
149	#ifdef SPECULARTERM
150	uniform vec3 vLightSpecular1;
151	#else
152	vec3 vLightSpecular1=vec3(0.);
153	#endif
154	#ifdef SHADOW1
155	#if defined(SPOTLIGHT1) || defined(DIRLIGHT1)
156	varying vec4 vPositionFromLight1;
157	uniform sampler2D shadowSampler1;
158	#else
159	uniform samplerCube shadowSampler1;
160	#endif
161	uniform vec3 shadowsInfo1;
162	#endif
163	#ifdef SPOTLIGHT1
164	uniform vec4 vLightDirection1;
165	#endif
166	#ifdef HEMILIGHT1
167	uniform vec3 vLightGround1;
168	#endif
169	#endif
170	#ifdef LIGHT2
171	uniform vec4 vLightData2;
172	uniform vec4 vLightDiffuse2;
173	#ifdef SPECULARTERM
174	uniform vec3 vLightSpecular2;
175	#else
176	vec3 vLightSpecular2=vec3(0.);
177	#endif
178	#ifdef SHADOW2
179	#if defined(SPOTLIGHT2) || defined(DIRLIGHT2)
180	varying vec4 vPositionFromLight2;
181	uniform sampler2D shadowSampler2;
182	#else
183	uniform samplerCube shadowSampler2;
184	#endif
185	uniform vec3 shadowsInfo2;
186	#endif
187	#ifdef SPOTLIGHT2
188	uniform vec4 vLightDirection2;
189	#endif
190	#ifdef HEMILIGHT2
191	uniform vec3 vLightGround2;
192	#endif
193	#endif
194	#ifdef LIGHT3
195	uniform vec4 vLightData3;
196	uniform vec4 vLightDiffuse3;
197	#ifdef SPECULARTERM
198	uniform vec3 vLightSpecular3;
199	#else
200	vec3 vLightSpecular3=vec3(0.);
201	#endif
202	#ifdef SHADOW3
203	#if defined(SPOTLIGHT3) || defined(DIRLIGHT3)
204	varying vec4 vPositionFromLight3;
205	uniform sampler2D shadowSampler3;
206	#else
207	uniform samplerCube shadowSampler3;
208	#endif
209	uniform vec3 shadowsInfo3;
210	#endif
211	#ifdef SPOTLIGHT3
212	uniform vec4 vLightDirection3;
213	#endif
214	#ifdef HEMILIGHT3
215	uniform vec3 vLightGround3;
216	#endif
217	#endif
218	
219	
220	#ifdef ALBEDO
221	varying vec2 vAlbedoUV;
222	uniform sampler2D albedoSampler;
223	#endif
224	#ifdef AMBIENT
225	varying vec2 vAmbientUV;
226	uniform sampler2D ambientSampler;
227	#endif
228	#ifdef OPACITY 
229	varying vec2 vOpacityUV;
230	uniform sampler2D opacitySampler;
231	#endif
232	#ifdef EMISSIVE
233	varying vec2 vEmissiveUV;
234	uniform sampler2D emissiveSampler;
235	#endif
236	#ifdef LIGHTMAP
237	varying vec2 vLightmapUV;
238	uniform sampler2D lightmapSampler;
239	#endif
240	#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) 
241	varying vec2 vReflectivityUV;
242	uniform sampler2D reflectivitySampler;
243	#endif
244	#ifdef MICROSURFACEMAP
245	varying vec2 vMicroSurfaceSamplerUV;
246	uniform sampler2D microSurfaceSampler;
247	#endif
248	
249	#ifdef FRESNEL
250	float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
251	{
252	float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);
253	return clamp(fresnelTerm,0.,1.);
254	}
255	#endif
256	
257	#ifdef REFRACTION
258	#ifdef REFRACTIONMAP_3D
259	uniform samplerCube refractionCubeSampler;
260	#else
261	uniform sampler2D refraction2DSampler;
262	#endif
263	#endif
264	
265	#ifdef REFLECTION
266	#ifdef REFLECTIONMAP_3D
267	uniform samplerCube reflectionCubeSampler;
268	#else
269	uniform sampler2D reflection2DSampler;
270	#endif
271	#ifdef REFLECTIONMAP_SKYBOX
272	varying vec3 vPositionUVW;
273	#else
274	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
275	varying vec3 vDirectionW;
276	#endif
277	#endif
278	vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)
279	{
280	#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
281	vec3 direction=normalize(vDirectionW);
282	float t=clamp(direction.y*-0.5+0.5,0.,1.0);
283	float s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;
284	#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
285	return vec3(1.0-s,t,0);
286	#else
287	return vec3(s,t,0);
288	#endif
289	#endif
290	#ifdef REFLECTIONMAP_EQUIRECTANGULAR
291	vec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition);
292	vec3 r=reflect(cameraToVertex,worldNormal);
293	float t=clamp(r.y*-0.5+0.5,0.,1.0);
294	float s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;
295	return vec3(s,t,0);
296	#endif
297	#ifdef REFLECTIONMAP_SPHERICAL
298	vec3 viewDir=normalize(vec3(view*worldPos));
299	vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));
300	vec3 r=reflect(viewDir,viewNormal);
301	r.z=r.z-1.0;
302	float m=2.0*length(r);
303	return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);
304	#endif
305	#ifdef REFLECTIONMAP_PLANAR
306	vec3 viewDir=worldPos.xyz-vEyePosition;
307	vec3 coords=normalize(reflect(viewDir,worldNormal));
308	return vec3(reflectionMatrix*vec4(coords,1));
309	#endif
310	#ifdef REFLECTIONMAP_CUBIC
311	vec3 viewDir=worldPos.xyz-vEyePosition;
312	vec3 coords=reflect(viewDir,worldNormal);
313	#ifdef INVERTCUBICMAP
314	coords.y=1.0-coords.y;
315	#endif
316	return vec3(reflectionMatrix*vec4(coords,0));
317	#endif
318	#ifdef REFLECTIONMAP_PROJECTION
319	return vec3(reflectionMatrix*(view*worldPos));
320	#endif
321	#ifdef REFLECTIONMAP_SKYBOX
322	return vPositionUVW;
323	#endif
324	#ifdef REFLECTIONMAP_EXPLICIT
325	return vec3(0,0,0);
326	#endif
327	}
328	#endif
329	#ifdef CAMERACOLORGRADING
330	uniform sampler2D cameraColorGrading2DSampler;
331	uniform vec4 vCameraColorGradingInfos;
332	uniform vec4 vCameraColorGradingScaleOffset;
333	#endif
334	#ifdef CAMERACOLORCURVES
335	uniform vec4 vCameraColorCurveNeutral;
336	uniform vec4 vCameraColorCurvePositive;
337	uniform vec4 vCameraColorCurveNegative;
338	#endif
339	
340	#ifdef SHADOWS
341	#ifndef SHADOWFULLFLOAT
342	float unpack(vec4 color)
343	{
344	const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);
345	return dot(color,bit_shift);
346	}
347	#endif
348	uniform vec2 depthValues;
349	float computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness)
350	{
351	vec3 directionToLight=vPositionW-lightPosition;
352	float depth=length(directionToLight);
353	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
354	depth=clamp(depth,0.,1.0);
355	directionToLight=normalize(directionToLight);
356	directionToLight.y=-directionToLight.y;
357	#ifndef SHADOWFULLFLOAT
358	float shadow=unpack(textureCube(shadowSampler,directionToLight));
359	#else
360	float shadow=textureCube(shadowSampler,directionToLight).x;
361	#endif
362	if (depth>shadow)
363	{
364	#ifdef OVERLOADEDSHADOWVALUES
365	return mix(1.0,darkness,vOverloadedShadowIntensity.x);
366	#else
367	return darkness;
368	#endif
369	}
370	return 1.0;
371	}
372	float computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness)
373	{
374	vec3 directionToLight=vPositionW-lightPosition;
375	float depth=length(directionToLight);
376	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
377	depth=clamp(depth,0.,1.0);
378	directionToLight=normalize(directionToLight);
379	directionToLight.y=-directionToLight.y;
380	float visibility=1.;
381	vec3 poissonDisk[4];
382	poissonDisk[0]=vec3(-1.0,1.0,-1.0);
383	poissonDisk[1]=vec3(1.0,-1.0,-1.0);
384	poissonDisk[2]=vec3(-1.0,-1.0,-1.0);
385	poissonDisk[3]=vec3(1.0,-1.0,1.0);
386	
387	#ifndef SHADOWFULLFLOAT
388	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;
389	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;
390	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;
391	if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;
392	#else
393	if (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;
394	if (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;
395	if (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;
396	if (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;
397	#endif
398	#ifdef OVERLOADEDSHADOWVALUES
399	return min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));
400	#else
401	return min(1.0,visibility+darkness);
402	#endif
403	}
404	float computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale)
405	{
406	vec3 directionToLight=vPositionW-lightPosition;
407	float depth=length(directionToLight);
408	depth=(depth-depthValues.x)/(depthValues.y-depthValues.x);
409	float shadowPixelDepth=clamp(depth,0.,1.0);
410	directionToLight=normalize(directionToLight);
411	directionToLight.y=-directionToLight.y;
412	#ifndef SHADOWFULLFLOAT
413	float shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));
414	#else
415	float shadowMapSample=textureCube(shadowSampler,directionToLight).x;
416	#endif
417	float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample-darkness,0.,1.); 
418	#ifdef OVERLOADEDSHADOWVALUES
419	return mix(1.0,esm,vOverloadedShadowIntensity.x);
420	#else
421	return esm;
422	#endif
423	}
424	float computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness)
425	{
426	vec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;
427	depth=0.5*depth+vec3(0.5);
428	vec2 uv=depth.xy;
429	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
430	{
431	return 1.0;
432	}
433	#ifndef SHADOWFULLFLOAT
434	float shadow=unpack(texture2D(shadowSampler,uv));
435	#else
436	float shadow=texture2D(shadowSampler,uv).x;
437	#endif
438	if (depth.z>shadow)
439	{
440	#ifdef OVERLOADEDSHADOWVALUES
441	return mix(1.0,darkness,vOverloadedShadowIntensity.x);
442	#else
443	return darkness;
444	#endif
445	}
446	return 1.;
447	}
448	float computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float darkness)
449	{
450	vec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;
451	depth=0.5*depth+vec3(0.5);
452	vec2 uv=depth.xy;
453	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
454	{
455	return 1.0;
456	}
457	float visibility=1.;
458	vec2 poissonDisk[4];
459	poissonDisk[0]=vec2(-0.94201624,-0.39906216);
460	poissonDisk[1]=vec2(0.94558609,-0.76890725);
461	poissonDisk[2]=vec2(-0.094184101,-0.92938870);
462	poissonDisk[3]=vec2(0.34495938,0.29387760);
463	
464	#ifndef SHADOWFULLFLOAT
465	if (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<depth.z) visibility-=0.25;
466	if (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<depth.z) visibility-=0.25;
467	if (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<depth.z) visibility-=0.25;
468	if (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<depth.z) visibility-=0.25;
469	#else
470	if (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<depth.z) visibility-=0.25;
471	if (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<depth.z) visibility-=0.25;
472	if (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<depth.z) visibility-=0.25;
473	if (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<depth.z) visibility-=0.25;
474	#endif
475	#ifdef OVERLOADEDSHADOWVALUES
476	return mix(1.0,min(1.0,visibility+darkness),vOverloadedShadowIntensity.x);
477	#else
478	return min(1.0,visibility+darkness);
479	#endif
480	}
481	float computeShadowWithESM(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float depthScale)
482	{
483	vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;
484	vec3 depth=0.5*clipSpace+vec3(0.5);
485	vec2 uv=depth.xy;
486	float shadowPixelDepth=depth.z;
487	if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
488	{
489	return 1.0;
490	}
491	#ifndef SHADOWFULLFLOAT
492	float shadowMapSample=unpack(texture2D(shadowSampler,uv));
493	#else
494	float shadowMapSample=texture2D(shadowSampler,uv).x;
495	#endif
496	float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample-darkness,0.,1.); 
497	
498	
499	
500	
501	
502	#ifdef OVERLOADEDSHADOWVALUES
503	return mix(1.0,esm,vOverloadedShadowIntensity.x);
504	#else
505	return esm;
506	#endif
507	}
508	#endif
509	
510	#define RECIPROCAL_PI2 0.15915494
511	#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
512	
513	const float kPi=3.1415926535897932384626433832795;
514	const float kRougnhessToAlphaScale=0.1;
515	const float kRougnhessToAlphaOffset=0.29248125;
516	float Square(float value)
517	{
518	return value*value;
519	}
520	float getLuminance(vec3 color)
521	{
522	return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);
523	}
524	float convertRoughnessToAverageSlope(float roughness)
525	{
526	
527	const float kMinimumVariance=0.0005;
528	float alphaG=Square(roughness)+kMinimumVariance;
529	return alphaG;
530	}
531	
532	float getMipMapIndexFromAverageSlope(float maxMipLevel,float alpha)
533	{
534	
535	
536	
537	
538	
539	
540	
541	float mip=kRougnhessToAlphaOffset+maxMipLevel+(maxMipLevel*kRougnhessToAlphaScale*log2(alpha));
542	return clamp(mip,0.,maxMipLevel);
543	}
544	float getMipMapIndexFromAverageSlopeWithPMREM(float maxMipLevel,float alphaG)
545	{
546	float specularPower=clamp(2./alphaG-2.,0.000001,2048.);
547	
548	return clamp(- 0.5*log2(specularPower)+5.5,0.,maxMipLevel);
549	}
550	
551	float smithVisibilityG1_TrowbridgeReitzGGX(float dot,float alphaG)
552	{
553	float tanSquared=(1.0-dot*dot)/(dot*dot);
554	return 2.0/(1.0+sqrt(1.0+alphaG*alphaG*tanSquared));
555	}
556	float smithVisibilityG_TrowbridgeReitzGGX_Walter(float NdotL,float NdotV,float alphaG)
557	{
558	return smithVisibilityG1_TrowbridgeReitzGGX(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGX(NdotV,alphaG);
559	}
560	
561	
562	float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
563	{
564	
565	
566	
567	float a2=Square(alphaG);
568	float d=NdotH*NdotH*(a2-1.0)+1.0;
569	return a2/(kPi*d*d);
570	}
571	vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
572	{
573	return reflectance0+(reflectance90-reflectance0)*pow(clamp(1.0-VdotH,0.,1.),5.0);
574	}
575	vec3 FresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
576	{
577	
578	float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);
579	return reflectance0+weight*(reflectance90-reflectance0)*pow(clamp(1.0-VdotN,0.,1.),5.0);
580	}
581	
582	vec3 computeSpecularTerm(float NdotH,float NdotL,float NdotV,float VdotH,float roughness,vec3 specularColor,vec3 reflectance90)
583	{
584	float alphaG=convertRoughnessToAverageSlope(roughness);
585	float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
586	float visibility=smithVisibilityG_TrowbridgeReitzGGX_Walter(NdotL,NdotV,alphaG);
587	visibility/=(4.0*NdotL*NdotV); 
588	vec3 fresnel=fresnelSchlickGGX(VdotH,specularColor,reflectance90);
589	float specTerm=max(0.,visibility*distribution)*NdotL;
590	return fresnel*specTerm*kPi; 
591	}
592	float computeDiffuseTerm(float NdotL,float NdotV,float VdotH,float roughness)
593	{
594	
595	
596	float diffuseFresnelNV=pow(clamp(1.0-NdotL,0.000001,1.),5.0);
597	float diffuseFresnelNL=pow(clamp(1.0-NdotV,0.000001,1.),5.0);
598	float diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;
599	float diffuseFresnelTerm =
600	(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
601	(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);
602	return diffuseFresnelTerm*NdotL;
603	
604	
605	}
606	float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance)
607	{
608	#ifdef USEPHYSICALLIGHTFALLOFF
609	
610	float lightRoughness=lightRadius/lightDistance;
611	
612	float totalRoughness=clamp(lightRoughness+roughness,0.,1.);
613	return totalRoughness;
614	#else
615	return roughness;
616	#endif
617	}
618	float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
619	{
620	float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;
621	float reflectivityLuminance=getLuminance(reflectivityColor);
622	float reflectivityLuma=sqrt(reflectivityLuminance);
623	microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;
624	return microSurface;
625	}
626	vec3 toLinearSpace(vec3 color)
627	{
628	return vec3(pow(color.r,2.2),pow(color.g,2.2),pow(color.b,2.2));
629	}
630	vec3 toGammaSpace(vec3 color)
631	{
632	return vec3(pow(color.r,1.0/2.2),pow(color.g,1.0/2.2),pow(color.b,1.0/2.2));
633	}
634	#ifdef CAMERATONEMAP
635	vec3 toneMaps(vec3 color)
636	{
637	color=max(color,0.0);
638	
639	color.rgb=color.rgb*vCameraInfos.x;
640	float tuning=1.5; 
641	
642	
643	vec3 tonemapped=1.0-exp2(-color.rgb*tuning); 
644	color.rgb=mix(color.rgb,tonemapped,1.0);
645	return color;
646	}
647	#endif
648	#ifdef CAMERACONTRAST
649	vec4 contrasts(vec4 color)
650	{
651	color=clamp(color,0.0,1.0);
652	vec3 resultHighContrast=color.rgb*color.rgb*(3.0-2.0*color.rgb);
653	float contrast=vCameraInfos.y;
654	if (contrast<1.0)
655	{
656	
657	color.rgb=mix(vec3(0.5,0.5,0.5),color.rgb,contrast);
658	}
659	else
660	{
661	
662	color.rgb=mix(color.rgb,resultHighContrast,contrast-1.0);
663	}
664	return color;
665	}
666	#endif
667	#ifdef CAMERACOLORGRADING
668	vec4 colorGrades(vec4 color) 
669	{ 
670	
671	float sliceContinuous=color.z*vCameraColorGradingInfos.z;
672	float sliceInteger=floor(sliceContinuous);
673	
674	
675	float sliceFraction=sliceContinuous-sliceInteger; 
676	
677	vec2 sliceUV=color.xy*vCameraColorGradingScaleOffset.xy+vCameraColorGradingScaleOffset.zw;
678	
679	
680	sliceUV.x+=sliceInteger*vCameraColorGradingInfos.w;
681	vec4 slice0Color=texture2D(cameraColorGrading2DSampler,sliceUV);
682	sliceUV.x+=vCameraColorGradingInfos.w;
683	vec4 slice1Color=texture2D(cameraColorGrading2DSampler,sliceUV);
684	vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);
685	color.rgb=mix(color.rgb,result,vCameraColorGradingInfos.x);
686	return color;
687	}
688	#endif
689	#ifdef CAMERACOLORCURVES
690	const vec3 HDTVRec709_RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);
691	vec3 applyColorCurves(vec3 original) {
692	vec3 result=original;
693	
694	
695	
696	float luma=dot(result.rgb,HDTVRec709_RGBLuminanceCoefficients);
697	vec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0,0.0),vec2(1.0,1.0));
698	vec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;
699	result.rgb*=colorCurve.rgb;
700	result.rgb=mix(vec3(luma,luma,luma),result.rgb,colorCurve.a);
701	return result;
702	}
703	#endif
704	#ifdef USESPHERICALFROMREFLECTIONMAP
705	uniform vec3 vSphericalX;
706	uniform vec3 vSphericalY;
707	uniform vec3 vSphericalZ;
708	uniform vec3 vSphericalXX;
709	uniform vec3 vSphericalYY;
710	uniform vec3 vSphericalZZ;
711	uniform vec3 vSphericalXY;
712	uniform vec3 vSphericalYZ;
713	uniform vec3 vSphericalZX;
714	vec3 EnvironmentIrradiance(vec3 normal)
715	{
716	
717	
718	
719	vec3 result =
720	vSphericalX*normal.x +
721	vSphericalY*normal.y +
722	vSphericalZ*normal.z +
723	vSphericalXX*normal.x*normal.x +
724	vSphericalYY*normal.y*normal.y +
725	vSphericalZZ*normal.z*normal.z +
726	vSphericalYZ*normal.y*normal.z +
727	vSphericalZX*normal.z*normal.x +
728	vSphericalXY*normal.x*normal.y;
729	return result.rgb;
730	}
731	#endif
732	
733	struct lightingInfo
734	{
735	vec3 diffuse;
736	#ifdef SPECULARTERM
737	vec3 specular;
738	#endif
739	};
740	float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range)
741	{ 
742	#ifdef USEPHYSICALLIGHTFALLOFF
743	float lightDistanceFalloff=1.0/((lightDistanceSquared+0.0001));
744	#else
745	float lightDistanceFalloff=max(0.,1.0-length(lightOffset)/range);
746	#endif
747	return lightDistanceFalloff;
748	}
749	float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngle,float exponent)
750	{
751	float falloff=0.0;
752	#ifdef USEPHYSICALLIGHTFALLOFF
753	float cosHalfAngle=cos(lightAngle*0.5);
754	const float kMinusLog2ConeAngleIntensityRatio=6.64385618977; 
755	
756	
757	
758	
759	
760	float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);
761	
762	
763	vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);
764	falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));
765	#else
766	float cosAngle=max(0.000000000000001,dot(-lightDirection,directionToLightCenterW));
767	if (cosAngle>=lightAngle)
768	{
769	falloff=max(0.,pow(cosAngle,exponent));
770	}
771	#endif
772	return falloff;
773	}
774	lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {
775	lightingInfo result;
776	vec3 lightDirection;
777	float attenuation=1.0;
778	float lightDistance;
779	
780	if (lightData.w == 0.)
781	{
782	vec3 lightOffset=lightData.xyz-vPositionW;
783	float lightDistanceSquared=dot(lightOffset,lightOffset);
784	attenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);
785	lightDistance=sqrt(lightDistanceSquared);
786	lightDirection=normalize(lightOffset);
787	}
788	
789	else
790	{
791	lightDistance=length(-lightData.xyz);
792	lightDirection=normalize(-lightData.xyz);
793	}
794	
795	roughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);
796	
797	vec3 H=normalize(viewDirectionW+lightDirection);
798	NdotL=max(0.00000000001,dot(vNormal,lightDirection));
799	float VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));
800	float diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);
801	result.diffuse=diffuseTerm*diffuseColor*attenuation;
802	#ifdef SPECULARTERM
803	
804	float NdotH=max(0.00000000001,dot(vNormal,H));
805	vec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);
806	result.specular=specTerm*attenuation;
807	#endif
808	return result;
809	}
810	lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {
811	lightingInfo result;
812	vec3 lightOffset=lightData.xyz-vPositionW;
813	vec3 directionToLightCenterW=normalize(lightOffset);
814	
815	float lightDistanceSquared=dot(lightOffset,lightOffset);
816	float attenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);
817	
818	float directionalAttenuation=computeDirectionalLightFalloff(lightDirection.xyz,directionToLightCenterW,lightDirection.w,lightData.w);
819	attenuation*=directionalAttenuation;
820	
821	float lightDistance=sqrt(lightDistanceSquared);
822	roughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);
823	
824	vec3 H=normalize(viewDirectionW+directionToLightCenterW);
825	NdotL=max(0.00000000001,dot(vNormal,directionToLightCenterW));
826	float VdotH=clamp(dot(viewDirectionW,H),0.00000000001,1.0);
827	float diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);
828	result.diffuse=diffuseTerm*diffuseColor*attenuation;
829	#ifdef SPECULARTERM
830	
831	float NdotH=max(0.00000000001,dot(vNormal,H));
832	vec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);
833	result.specular=specTerm*attenuation;
834	#endif
835	return result;
836	}
837	lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {
838	lightingInfo result;
839	
840	
841	
842	NdotL=dot(vNormal,lightData.xyz)*0.5+0.5;
843	result.diffuse=mix(groundColor,diffuseColor,NdotL);
844	#ifdef SPECULARTERM
845	
846	vec3 lightVectorW=normalize(lightData.xyz);
847	vec3 H=normalize(viewDirectionW+lightVectorW);
848	float NdotH=max(0.00000000001,dot(vNormal,H));
849	NdotL=max(0.00000000001,NdotL);
850	float VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));
851	vec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);
852	result.specular=specTerm;
853	#endif
854	return result;
855	}
856	mat3 transposeMat3(mat3 inMatrix) {
857	vec3 i0=inMatrix[0];
858	vec3 i1=inMatrix[1];
859	vec3 i2=inMatrix[2];
860	mat3 outMatrix=mat3(
861	vec3(i0.x,i1.x,i2.x),
862	vec3(i0.y,i1.y,i2.y),
863	vec3(i0.z,i1.z,i2.z)
864	);
865	return outMatrix;
866	}
867	#ifdef BUMP
868	varying vec2 vBumpUV;
869	uniform sampler2D bumpSampler;
870	#if defined(TANGENT) && defined(NORMAL) 
871	varying mat3 vTBN;
872	#endif
873	
874	mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)
875	{
876	
877	uv=gl_FrontFacing ? uv : -uv;
878	
879	vec3 dp1=dFdx(p);
880	vec3 dp2=dFdy(p);
881	vec2 duv1=dFdx(uv);
882	vec2 duv2=dFdy(uv);
883	
884	vec3 dp2perp=cross(dp2,normal);
885	vec3 dp1perp=cross(normal,dp1);
886	vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;
887	vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;
888	
889	float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));
890	return mat3(tangent*invmax,binormal*invmax,normal);
891	}
892	vec3 perturbNormal(mat3 cotangentFrame,vec2 uv)
893	{
894	vec3 map=texture2D(bumpSampler,uv).xyz;
895	#ifdef INVERTNORMALMAPX
896	map.x=1.0-map.x;
897	#endif
898	#ifdef INVERTNORMALMAPY
899	map.y=1.0-map.y;
900	#endif
901	map=map*255./127.-128./127.;
902	return normalize(cotangentFrame*map);
903	}
904	#ifdef PARALLAX
905	const float minSamples=4.;
906	const float maxSamples=15.;
907	const int iMaxSamples=15;
908	
909	vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {
910	float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;
911	parallaxLimit*=parallaxScale;
912	vec2 vOffsetDir=normalize(vViewDirCoT.xy);
913	vec2 vMaxOffset=vOffsetDir*parallaxLimit;
914	float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));
915	float stepSize=1.0/numSamples;
916	
917	float currRayHeight=1.0;
918	vec2 vCurrOffset=vec2(0,0);
919	vec2 vLastOffset=vec2(0,0);
920	float lastSampledHeight=1.0;
921	float currSampledHeight=1.0;
922	for (int i=0; i<iMaxSamples; i++)
923	{
924	currSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;
925	
926	if (currSampledHeight>currRayHeight)
927	{
928	float delta1=currSampledHeight-currRayHeight;
929	float delta2=(currRayHeight+stepSize)-lastSampledHeight;
930	float ratio=delta1/(delta1+delta2);
931	vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;
932	
933	break;
934	}
935	else
936	{
937	currRayHeight-=stepSize;
938	vLastOffset=vCurrOffset;
939	vCurrOffset+=stepSize*vMaxOffset;
940	lastSampledHeight=currSampledHeight;
941	}
942	}
943	return vCurrOffset;
944	}
945	vec2 parallaxOffset(vec3 viewDir,float heightScale)
946	{
947	
948	float height=texture2D(bumpSampler,vBumpUV).w;
949	vec2 texCoordOffset=heightScale*viewDir.xy*height;
950	return -texCoordOffset;
951	}
952	#endif
953	#endif
954	#ifdef CLIPPLANE
955	varying float fClipDistance;
956	#endif
957	#ifdef LOGARITHMICDEPTH
958	uniform float logarithmicDepthConstant;
959	varying float vFragmentDepth;
960	#endif
961	
962	#ifdef FOG
963	#define FOGMODE_NONE 0.
964	#define FOGMODE_EXP 1.
965	#define FOGMODE_EXP2 2.
966	#define FOGMODE_LINEAR 3.
967	#define E 2.71828
968	uniform vec4 vFogInfos;
969	uniform vec3 vFogColor;
970	varying vec3 vFogDistance;
971	float CalcFogFactor()
972	{
973	float fogCoeff=1.0;
974	float fogStart=vFogInfos.y;
975	float fogEnd=vFogInfos.z;
976	float fogDensity=vFogInfos.w;
977	float fogDistance=length(vFogDistance);
978	if (FOGMODE_LINEAR == vFogInfos.x)
979	{
980	fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);
981	}
982	else if (FOGMODE_EXP == vFogInfos.x)
983	{
984	fogCoeff=1.0/pow(E,fogDistance*fogDensity);
985	}
986	else if (FOGMODE_EXP2 == vFogInfos.x)
987	{
988	fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);
989	}
990	return clamp(fogCoeff,0.0,1.0);
991	}
992	#endif
993	void main(void) {
994	#ifdef CLIPPLANE
995	if (fClipDistance>0.0)
996	{
997	discard;
998	}
999	#endif
1000	vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
1001	
1002	#ifdef NORMAL
1003	vec3 normalW=normalize(vNormalW);
1004	#else
1005	vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)));
1006	#endif
1007	vec2 uvOffset=vec2(0.0,0.0);
1008	#if defined(BUMP) || defined(PARALLAX)
1009	#if defined(TANGENT) && defined(NORMAL)
1010	mat3 TBN=vTBN;
1011	#else
1012	mat3 TBN=cotangent_frame(normalW*vBumpInfos.y,vPositionW,vBumpUV);
1013	#endif
1014	#endif
1015	#ifdef PARALLAX
1016	mat3 invTBN=transposeMat3(TBN);
1017	#ifdef PARALLAXOCCLUSION
1018	uvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);
1019	#else
1020	uvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);
1021	#endif
1022	#endif
1023	#ifdef BUMP
1024	normalW=perturbNormal(TBN,vBumpUV+uvOffset);
1025	#endif
1026	#ifdef TWOSIDEDLIGHTING
1027	normalW=gl_FrontFacing ? normalW : -normalW;
1028	#endif
1029	
1030	vec4 surfaceAlbedo=vec4(1.,1.,1.,1.);
1031	vec3 surfaceAlbedoContribution=vAlbedoColor.rgb;
1032	
1033	float alpha=vAlbedoColor.a;
1034	#ifdef ALBEDO
1035	surfaceAlbedo=texture2D(albedoSampler,vAlbedoUV+uvOffset);
1036	surfaceAlbedo=vec4(toLinearSpace(surfaceAlbedo.rgb),surfaceAlbedo.a);
1037	#ifndef LINKREFRACTIONTOTRANSPARENCY
1038	#ifdef ALPHATEST
1039	if (surfaceAlbedo.a<0.4)
1040	discard;
1041	#endif
1042	#endif
1043	#ifdef ALPHAFROMALBEDO
1044	alpha*=surfaceAlbedo.a;
1045	#endif
1046	surfaceAlbedo.rgb*=vAlbedoInfos.y;
1047	#else
1048	
1049	surfaceAlbedo.rgb=surfaceAlbedoContribution;
1050	surfaceAlbedoContribution=vec3(1.,1.,1.);
1051	#endif
1052	#ifdef VERTEXCOLOR
1053	surfaceAlbedo.rgb*=vColor.rgb;
1054	#endif
1055	#ifdef OVERLOADEDVALUES
1056	surfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,vOverloadedAlbedo,vOverloadedIntensity.y);
1057	#endif
1058	
1059	vec3 ambientOcclusionColor=vec3(1.,1.,1.);
1060	#ifdef AMBIENT
1061	vec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;
1062	#ifdef AMBIENTINGRAYSCALE 
1063	ambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);
1064	#endif
1065	ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);
1066	#ifdef OVERLOADEDVALUES
1067	ambientOcclusionColor.rgb=mix(ambientOcclusionColor.rgb,vOverloadedAmbient,vOverloadedIntensity.x);
1068	#endif
1069	#endif
1070	
1071	float microSurface=vReflectivityColor.a;
1072	vec3 surfaceReflectivityColor=vReflectivityColor.rgb;
1073	#ifdef REFLECTIVITY
1074	vec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);
1075	surfaceReflectivityColor=surfaceReflectivityColorMap.rgb;
1076	surfaceReflectivityColor=toLinearSpace(surfaceReflectivityColor);
1077	surfaceReflectivityColor*=vReflectivityInfos.y;
1078	#ifdef OVERLOADEDVALUES
1079	surfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);
1080	#endif
1081	#ifdef MICROSURFACEFROMREFLECTIVITYMAP
1082	microSurface=surfaceReflectivityColorMap.a*vReflectivityInfos.z;
1083	#else
1084	#ifdef MICROSURFACEAUTOMATIC
1085	microSurface=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);
1086	#endif
1087	#endif
1088	#else
1089	#ifdef OVERLOADEDVALUES
1090	surfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);
1091	#endif
1092	#endif
1093	#ifdef METALLICWORKFLOW
1094	vec2 metallicRoughness=surfaceReflectivityColor.rg;
1095	#ifdef METALLICMAP
1096	vec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);
1097	#ifdef AOSTOREINMETALMAPRED 
1098	vec3 aoStoreInMetalMap=vec3(surfaceMetallicColorMap.r,surfaceMetallicColorMap.r,surfaceMetallicColorMap.r);
1099	ambientOcclusionColor=mix(ambientOcclusionColor,aoStoreInMetalMap,vReflectivityInfos.z);
1100	#endif
1101	#ifdef METALLNESSSTOREINMETALMAPBLUE
1102	metallicRoughness.r*=surfaceMetallicColorMap.b;
1103	#else
1104	metallicRoughness.r*=surfaceMetallicColorMap.r;
1105	#endif
1106	#ifdef ROUGHNESSSTOREINMETALMAPALPHA
1107	metallicRoughness.g*=surfaceMetallicColorMap.a;
1108	#else
1109	#ifdef ROUGHNESSSTOREINMETALMAPGREEN
1110	metallicRoughness.g*=surfaceMetallicColorMap.g;
1111	#endif
1112	#endif
1113	#endif
1114	#ifdef MICROSURFACEMAP
1115	vec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;
1116	metallicRoughness.g*=microSurfaceTexel.r;
1117	#endif
1118	
1119	microSurface=1.0-metallicRoughness.g;
1120	
1121	vec3 baseColor=surfaceAlbedo.rgb;
1122	
1123	
1124	const vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);
1125	
1126	surfaceAlbedo.rgb=mix(baseColor.rgb*(1.0-DefaultSpecularReflectanceDielectric.r),vec3(0.,0.,0.),metallicRoughness.r);
1127	
1128	surfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallicRoughness.r);
1129	#ifdef OVERLOADEDVALUES
1130	surfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);
1131	#endif
1132	#else
1133	#ifdef MICROSURFACEMAP
1134	vec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;
1135	microSurface=microSurfaceTexel.r;
1136	#endif
1137	#endif
1138	#ifdef OVERLOADEDVALUES
1139	microSurface=mix(microSurface,vOverloadedMicroSurface.x,vOverloadedMicroSurface.y);
1140	#endif
1141	
1142	float NdotV=max(0.00000000001,dot(normalW,viewDirectionW));
1143	
1144	microSurface=clamp(microSurface,0.,1.)*0.98;
1145	
1146	float roughness=clamp(1.-microSurface,0.000001,1.0);
1147	
1148	vec3 lightDiffuseContribution=vec3(0.,0.,0.);
1149	#ifdef OVERLOADEDSHADOWVALUES
1150	vec3 shadowedOnlyLightDiffuseContribution=vec3(1.,1.,1.);
1151	#endif
1152	#ifdef SPECULARTERM
1153	vec3 lightSpecularContribution=vec3(0.,0.,0.);
1154	#endif
1155	float notShadowLevel=1.; 
1156	#ifdef LIGHTMAP
1157	vec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;
1158	#endif
1159	float NdotL=-1.;
1160	lightingInfo info;
1161	
1162	float reflectance=max(max(surfaceReflectivityColor.r,surfaceReflectivityColor.g),surfaceReflectivityColor.b);
1163	
1164	
1165	float reflectance90=clamp(reflectance*25.0,0.0,1.0);
1166	vec3 specularEnvironmentR0=surfaceReflectivityColor.rgb;
1167	vec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;
1168	#ifdef LIGHT0
1169	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED0) && defined(LIGHTMAPNOSPECULAR0)
1170	
1171	#else
1172	#ifdef SPOTLIGHT0
1173	info=computeSpotLighting(viewDirectionW,normalW,vLightData0,vLightDirection0,vLightDiffuse0.rgb,vLightSpecular0,vLightDiffuse0.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1174	#endif
1175	#ifdef HEMILIGHT0
1176	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData0,vLightDiffuse0.rgb,vLightSpecular0,vLightGround0,roughness,NdotV,specularEnvironmentR90,NdotL);
1177	#endif
1178	#if defined(POINTLIGHT0) || defined(DIRLIGHT0)
1179	info=computeLighting(viewDirectionW,normalW,vLightData0,vLightDiffuse0.rgb,vLightSpecular0,vLightDiffuse0.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1180	#endif
1181	#endif
1182	#ifdef SHADOW0
1183	#ifdef SHADOWESM0
1184	#if defined(POINTLIGHT0)
1185	notShadowLevel=computeShadowWithESMCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.x,shadowsInfo0.z);
1186	#else
1187	notShadowLevel=computeShadowWithESM(vPositionFromLight0,shadowSampler0,shadowsInfo0.x,shadowsInfo0.z);
1188	#endif
1189	#else
1190	#ifdef SHADOWPCF0
1191	#if defined(POINTLIGHT0)
1192	notShadowLevel=computeShadowWithPCFCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.y,shadowsInfo0.x);
1193	#else
1194	notShadowLevel=computeShadowWithPCF(vPositionFromLight0,shadowSampler0,shadowsInfo0.y,shadowsInfo0.x);
1195	#endif
1196	#else
1197	#if defined(POINTLIGHT0)
1198	notShadowLevel=computeShadowCube(vLightData0.xyz,shadowSampler0,shadowsInfo0.x);
1199	#else
1200	notShadowLevel=computeShadow(vPositionFromLight0,shadowSampler0,shadowsInfo0.x);
1201	#endif
1202	#endif
1203	#endif
1204	#else
1205	notShadowLevel=1.;
1206	#endif
1207	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED0)
1208	lightDiffuseContribution+=lightmapColor*notShadowLevel;
1209	#ifdef SPECULARTERM
1210	#ifndef LIGHTMAPNOSPECULAR0
1211	lightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;
1212	#endif
1213	#endif
1214	#else
1215	lightDiffuseContribution+=info.diffuse*notShadowLevel;
1216	#ifdef OVERLOADEDSHADOWVALUES
1217	if (NdotL<0.000000000011)
1218	{
1219	notShadowLevel=1.;
1220	}
1221	shadowedOnlyLightDiffuseContribution*=notShadowLevel;
1222	#endif
1223	#ifdef SPECULARTERM
1224	lightSpecularContribution+=info.specular*notShadowLevel;
1225	#endif
1226	#endif
1227	#endif
1228	#ifdef LIGHT1
1229	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED1) && defined(LIGHTMAPNOSPECULAR1)
1230	
1231	#else
1232	#ifdef SPOTLIGHT1
1233	info=computeSpotLighting(viewDirectionW,normalW,vLightData1,vLightDirection1,vLightDiffuse1.rgb,vLightSpecular1,vLightDiffuse1.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1234	#endif
1235	#ifdef HEMILIGHT1
1236	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData1,vLightDiffuse1.rgb,vLightSpecular1,vLightGround1,roughness,NdotV,specularEnvironmentR90,NdotL);
1237	#endif
1238	#if defined(POINTLIGHT1) || defined(DIRLIGHT1)
1239	info=computeLighting(viewDirectionW,normalW,vLightData1,vLightDiffuse1.rgb,vLightSpecular1,vLightDiffuse1.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1240	#endif
1241	#endif
1242	#ifdef SHADOW1
1243	#ifdef SHADOWESM1
1244	#if defined(POINTLIGHT1)
1245	notShadowLevel=computeShadowWithESMCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.x,shadowsInfo1.z);
1246	#else
1247	notShadowLevel=computeShadowWithESM(vPositionFromLight1,shadowSampler1,shadowsInfo1.x,shadowsInfo1.z);
1248	#endif
1249	#else
1250	#ifdef SHADOWPCF1
1251	#if defined(POINTLIGHT1)
1252	notShadowLevel=computeShadowWithPCFCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.y,shadowsInfo1.x);
1253	#else
1254	notShadowLevel=computeShadowWithPCF(vPositionFromLight1,shadowSampler1,shadowsInfo1.y,shadowsInfo1.x);
1255	#endif
1256	#else
1257	#if defined(POINTLIGHT1)
1258	notShadowLevel=computeShadowCube(vLightData1.xyz,shadowSampler1,shadowsInfo1.x);
1259	#else
1260	notShadowLevel=computeShadow(vPositionFromLight1,shadowSampler1,shadowsInfo1.x);
1261	#endif
1262	#endif
1263	#endif
1264	#else
1265	notShadowLevel=1.;
1266	#endif
1267	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED1)
1268	lightDiffuseContribution+=lightmapColor*notShadowLevel;
1269	#ifdef SPECULARTERM
1270	#ifndef LIGHTMAPNOSPECULAR1
1271	lightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;
1272	#endif
1273	#endif
1274	#else
1275	lightDiffuseContribution+=info.diffuse*notShadowLevel;
1276	#ifdef OVERLOADEDSHADOWVALUES
1277	if (NdotL<0.000000000011)
1278	{
1279	notShadowLevel=1.;
1280	}
1281	shadowedOnlyLightDiffuseContribution*=notShadowLevel;
1282	#endif
1283	#ifdef SPECULARTERM
1284	lightSpecularContribution+=info.specular*notShadowLevel;
1285	#endif
1286	#endif
1287	#endif
1288	#ifdef LIGHT2
1289	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED2) && defined(LIGHTMAPNOSPECULAR2)
1290	
1291	#else
1292	#ifdef SPOTLIGHT2
1293	info=computeSpotLighting(viewDirectionW,normalW,vLightData2,vLightDirection2,vLightDiffuse2.rgb,vLightSpecular2,vLightDiffuse2.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1294	#endif
1295	#ifdef HEMILIGHT2
1296	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData2,vLightDiffuse2.rgb,vLightSpecular2,vLightGround2,roughness,NdotV,specularEnvironmentR90,NdotL);
1297	#endif
1298	#if defined(POINTLIGHT2) || defined(DIRLIGHT2)
1299	info=computeLighting(viewDirectionW,normalW,vLightData2,vLightDiffuse2.rgb,vLightSpecular2,vLightDiffuse2.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1300	#endif
1301	#endif
1302	#ifdef SHADOW2
1303	#ifdef SHADOWESM2
1304	#if defined(POINTLIGHT2)
1305	notShadowLevel=computeShadowWithESMCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.x,shadowsInfo2.z);
1306	#else
1307	notShadowLevel=computeShadowWithESM(vPositionFromLight2,shadowSampler2,shadowsInfo2.x,shadowsInfo2.z);
1308	#endif
1309	#else
1310	#ifdef SHADOWPCF2
1311	#if defined(POINTLIGHT2)
1312	notShadowLevel=computeShadowWithPCFCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.y,shadowsInfo2.x);
1313	#else
1314	notShadowLevel=computeShadowWithPCF(vPositionFromLight2,shadowSampler2,shadowsInfo2.y,shadowsInfo2.x);
1315	#endif
1316	#else
1317	#if defined(POINTLIGHT2)
1318	notShadowLevel=computeShadowCube(vLightData2.xyz,shadowSampler2,shadowsInfo2.x);
1319	#else
1320	notShadowLevel=computeShadow(vPositionFromLight2,shadowSampler2,shadowsInfo2.x);
1321	#endif
1322	#endif
1323	#endif
1324	#else
1325	notShadowLevel=1.;
1326	#endif
1327	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED2)
1328	lightDiffuseContribution+=lightmapColor*notShadowLevel;
1329	#ifdef SPECULARTERM
1330	#ifndef LIGHTMAPNOSPECULAR2
1331	lightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;
1332	#endif
1333	#endif
1334	#else
1335	lightDiffuseContribution+=info.diffuse*notShadowLevel;
1336	#ifdef OVERLOADEDSHADOWVALUES
1337	if (NdotL<0.000000000011)
1338	{
1339	notShadowLevel=1.;
1340	}
1341	shadowedOnlyLightDiffuseContribution*=notShadowLevel;
1342	#endif
1343	#ifdef SPECULARTERM
1344	lightSpecularContribution+=info.specular*notShadowLevel;
1345	#endif
1346	#endif
1347	#endif
1348	#ifdef LIGHT3
1349	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED3) && defined(LIGHTMAPNOSPECULAR3)
1350	
1351	#else
1352	#ifdef SPOTLIGHT3
1353	info=computeSpotLighting(viewDirectionW,normalW,vLightData3,vLightDirection3,vLightDiffuse3.rgb,vLightSpecular3,vLightDiffuse3.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1354	#endif
1355	#ifdef HEMILIGHT3
1356	info=computeHemisphericLighting(viewDirectionW,normalW,vLightData3,vLightDiffuse3.rgb,vLightSpecular3,vLightGround3,roughness,NdotV,specularEnvironmentR90,NdotL);
1357	#endif
1358	#if defined(POINTLIGHT3) || defined(DIRLIGHT3)
1359	info=computeLighting(viewDirectionW,normalW,vLightData3,vLightDiffuse3.rgb,vLightSpecular3,vLightDiffuse3.a,roughness,NdotV,specularEnvironmentR90,NdotL);
1360	#endif
1361	#endif
1362	#ifdef SHADOW3
1363	#ifdef SHADOWESM3
1364	#if defined(POINTLIGHT3)
1365	notShadowLevel=computeShadowWithESMCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.x,shadowsInfo3.z);
1366	#else
1367	notShadowLevel=computeShadowWithESM(vPositionFromLight3,shadowSampler3,shadowsInfo3.x,shadowsInfo3.z);
1368	#endif
1369	#else
1370	#ifdef SHADOWPCF3
1371	#if defined(POINTLIGHT3)
1372	notShadowLevel=computeShadowWithPCFCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.y,shadowsInfo3.x);
1373	#else
1374	notShadowLevel=computeShadowWithPCF(vPositionFromLight3,shadowSampler3,shadowsInfo3.y,shadowsInfo3.x);
1375	#endif
1376	#else
1377	#if defined(POINTLIGHT3)
1378	notShadowLevel=computeShadowCube(vLightData3.xyz,shadowSampler3,shadowsInfo3.x);
1379	#else
1380	notShadowLevel=computeShadow(vPositionFromLight3,shadowSampler3,shadowsInfo3.x);
1381	#endif
1382	#endif
1383	#endif
1384	#else
1385	notShadowLevel=1.;
1386	#endif
1387	#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED3)
1388	lightDiffuseContribution+=lightmapColor*notShadowLevel;
1389	#ifdef SPECULARTERM
1390	#ifndef LIGHTMAPNOSPECULAR3
1391	lightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;
1392	#endif
1393	#endif
1394	#else
1395	lightDiffuseContribution+=info.diffuse*notShadowLevel;
1396	#ifdef OVERLOADEDSHADOWVALUES
1397	if (NdotL<0.000000000011)
1398	{
1399	notShadowLevel=1.;
1400	}
1401	shadowedOnlyLightDiffuseContribution*=notShadowLevel;
1402	#endif
1403	#ifdef SPECULARTERM
1404	lightSpecularContribution+=info.specular*notShadowLevel;
1405	#endif
1406	#endif
1407	#endif
1408	
1409	#ifdef SPECULARTERM
1410	lightSpecularContribution*=vLightingIntensity.w;
1411	#endif
1412	#ifdef OPACITY
1413	vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
1414	#ifdef OPACITYRGB
1415	opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);
1416	alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;
1417	#else
1418	alpha*=opacityMap.a*vOpacityInfos.y;
1419	#endif
1420	#endif
1421	#ifdef VERTEXALPHA
1422	alpha*=vColor.a;
1423	#endif
1424	#ifdef OPACITYFRESNEL
1425	float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);
1426	alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;
1427	#endif
1428	
1429	vec3 surfaceRefractionColor=vec3(0.,0.,0.);
1430	
1431	#ifdef LODBASEDMICROSFURACE
1432	float alphaG=convertRoughnessToAverageSlope(roughness);
1433	#endif
1434	#ifdef REFRACTION
1435	vec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);
1436	#ifdef LODBASEDMICROSFURACE
1437	#ifdef USEPMREMREFRACTION
1438	float lodRefraction=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.y,alphaG);
1439	#else
1440	float lodRefraction=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.y,alphaG);
1441	#endif
1442	#else
1443	float biasRefraction=(vMicrosurfaceTextureLods.y+2.)*(1.0-microSurface);
1444	#endif
1445	#ifdef REFRACTIONMAP_3D
1446	refractionVector.y=refractionVector.y*vRefractionInfos.w;
1447	if (dot(refractionVector,viewDirectionW)<1.0)
1448	{
1449	#ifdef LODBASEDMICROSFURACE
1450	#ifdef USEPMREMREFRACTION
1451	
1452	if ((vMicrosurfaceTextureLods.y-lodRefraction)>4.0)
1453	{
1454	
1455	float scaleRefraction=1.-exp2(lodRefraction)/exp2(vMicrosurfaceTextureLods.y); 
1456	float maxRefraction=max(max(abs(refractionVector.x),abs(refractionVector.y)),abs(refractionVector.z));
1457	if (abs(refractionVector.x) != maxRefraction) refractionVector.x*=scaleRefraction;
1458	if (abs(refractionVector.y) != maxRefraction) refractionVector.y*=scaleRefraction;
1459	if (abs(refractionVector.z) != maxRefraction) refractionVector.z*=scaleRefraction;
1460	}
1461	#endif
1462	surfaceRefractionColor=textureCubeLodEXT(refractionCubeSampler,refractionVector,lodRefraction).rgb*vRefractionInfos.x;
1463	#else
1464	surfaceRefractionColor=textureCube(refractionCubeSampler,refractionVector,biasRefraction).rgb*vRefractionInfos.x;
1465	#endif
1466	}
1467	#ifndef REFRACTIONMAPINLINEARSPACE
1468	surfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);
1469	#endif
1470	#else
1471	vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));
1472	vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;
1473	refractionCoords.y=1.0-refractionCoords.y;
1474	#ifdef LODBASEDMICROSFURACE
1475	surfaceRefractionColor=texture2DLodEXT(refraction2DSampler,refractionCoords,lodRefraction).rgb*vRefractionInfos.x;
1476	#else
1477	surfaceRefractionColor=texture2D(refraction2DSampler,refractionCoords,biasRefraction).rgb*vRefractionInfos.x;
1478	#endif 
1479	surfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);
1480	#endif
1481	#endif
1482	
1483	vec3 environmentRadiance=vReflectionColor.rgb;
1484	vec3 environmentIrradiance=vReflectionColor.rgb;
1485	#ifdef REFLECTION
1486	vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
1487	#ifdef LODBASEDMICROSFURACE
1488	#ifdef USEPMREMREFLECTION
1489	float lodReflection=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.x,alphaG);
1490	#else
1491	float lodReflection=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.x,alphaG);
1492	#endif
1493	#else
1494	float biasReflection=(vMicrosurfaceTextureLods.x+2.)*(1.0-microSurface);
1495	#endif
1496	#ifdef REFLECTIONMAP_3D
1497	#ifdef LODBASEDMICROSFURACE
1498	#ifdef USEPMREMREFLECTION
1499	
1500	if ((vMicrosurfaceTextureLods.y-lodReflection)>4.0)
1501	{
1502	
1503	float scaleReflection=1.-exp2(lodReflection)/exp2(vMicrosurfaceTextureLods.x); 
1504	float maxReflection=max(max(abs(vReflectionUVW.x),abs(vReflectionUVW.y)),abs(vReflectionUVW.z));
1505	if (abs(vReflectionUVW.x) != maxReflection) vReflectionUVW.x*=scaleReflection;
1506	if (abs(vReflectionUVW.y) != maxReflection) vReflectionUVW.y*=scaleReflection;
1507	if (abs(vReflectionUVW.z) != maxReflection) vReflectionUVW.z*=scaleReflection;
1508	}
1509	#endif
1510	environmentRadiance=textureCubeLodEXT(reflectionCubeSampler,vReflectionUVW,lodReflection).rgb*vReflectionInfos.x;
1511	#else
1512	environmentRadiance=textureCube(reflectionCubeSampler,vReflectionUVW,biasReflection).rgb*vReflectionInfos.x;
1513	#endif
1514	#ifdef USESPHERICALFROMREFLECTIONMAP
1515	#ifndef REFLECTIONMAP_SKYBOX
1516	vec3 normalEnvironmentSpace=(reflectionMatrix*vec4(normalW,1)).xyz;
1517	environmentIrradiance=EnvironmentIrradiance(normalEnvironmentSpace);
1518	#endif
1519	#else
1520	environmentRadiance=toLinearSpace(environmentRadiance.rgb);
1521	environmentIrradiance=textureCube(reflectionCubeSampler,normalW,20.).rgb*vReflectionInfos.x;
1522	environmentIrradiance=toLinearSpace(environmentIrradiance.rgb);
1523	environmentIrradiance*=0.2; 
1524	#endif
1525	#else
1526	vec2 coords=vReflectionUVW.xy;
1527	#ifdef REFLECTIONMAP_PROJECTION
1528	coords/=vReflectionUVW.z;
1529	#endif
1530	coords.y=1.0-coords.y;
1531	#ifdef LODBASEDMICROSFURACE
1532	environmentRadiance=texture2DLodEXT(reflection2DSampler,coords,lodReflection).rgb*vReflectionInfos.x;
1533	#else
1534	environmentRadiance=texture2D(reflection2DSampler,coords,biasReflection).rgb*vReflectionInfos.x;
1535	#endif
1536	environmentRadiance=toLinearSpace(environmentRadiance.rgb);
1537	environmentIrradiance=texture2D(reflection2DSampler,coords,20.).rgb*vReflectionInfos.x;
1538	environmentIrradiance=toLinearSpace(environmentIrradiance.rgb);
1539	#endif
1540	#endif
1541	#ifdef OVERLOADEDVALUES
1542	environmentIrradiance=mix(environmentIrradiance,vOverloadedReflection,vOverloadedMicroSurface.z);
1543	environmentRadiance=mix(environmentRadiance,vOverloadedReflection,vOverloadedMicroSurface.z);
1544	#endif
1545	environmentRadiance*=vLightingIntensity.z;
1546	environmentIrradiance*=vLightingIntensity.z;
1547	
1548	vec3 specularEnvironmentReflectance=FresnelSchlickEnvironmentGGX(clamp(NdotV,0.,1.),specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));
1549	
1550	vec3 refractance=vec3(0.0,0.0,0.0);
1551	#ifdef REFRACTION
1552	vec3 transmission=vec3(1.0,1.0,1.0);
1553	#ifdef LINKREFRACTIONTOTRANSPARENCY
1554	
1555	transmission*=(1.0-alpha);
1556	
1557	
1558	vec3 mixedAlbedo=surfaceAlbedoContribution.rgb*surfaceAlbedo.rgb;
1559	float maxChannel=max(max(mixedAlbedo.r,mixedAlbedo.g),mixedAlbedo.b);
1560	vec3 tint=clamp(maxChannel*mixedAlbedo,0.0,1.0);
1561	
1562	surfaceAlbedoContribution*=alpha;
1563	
1564	environmentIrradiance*=alpha;
1565	
1566	surfaceRefractionColor*=tint;
1567	
1568	alpha=1.0;
1569	#endif
1570	
1571	vec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);
1572	specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,alpha);
1573	
1574	transmission*=1.0-specularEnvironmentReflectance;
1575	
1576	refractance=surfaceRefractionColor*transmission;
1577	#endif
1578	
1579	surfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;
1580	refractance*=vLightingIntensity.z;
1581	environmentRadiance*=specularEnvironmentReflectance;
1582	
1583	vec3 surfaceEmissiveColor=vEmissiveColor;
1584	#ifdef EMISSIVE
1585	vec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;
1586	surfaceEmissiveColor=toLinearSpace(emissiveColorTex.rgb)*surfaceEmissiveColor*vEmissiveInfos.y;
1587	#endif
1588	#ifdef OVERLOADEDVALUES
1589	surfaceEmissiveColor=mix(surfaceEmissiveColor,vOverloadedEmissive,vOverloadedIntensity.w);
1590	#endif
1591	#ifdef EMISSIVEFRESNEL
1592	float emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);
1593	surfaceEmissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;
1594	#endif
1595	
1596	#ifdef EMISSIVEASILLUMINATION
1597	vec3 finalDiffuse=lightDiffuseContribution*surfaceAlbedoContribution;
1598	#ifdef OVERLOADEDSHADOWVALUES
1599	shadowedOnlyLightDiffuseContribution=shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution;
1600	#endif
1601	#else
1602	#ifdef LINKEMISSIVEWITHALBEDO
1603	vec3 finalDiffuse=(lightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution;
1604	#ifdef OVERLOADEDSHADOWVALUES
1605	shadowedOnlyLightDiffuseContribution=(shadowedOnlyLightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution;
1606	#endif
1607	#else
1608	vec3 finalDiffuse=lightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor;
1609	#ifdef OVERLOADEDSHADOWVALUES
1610	shadowedOnlyLightDiffuseContribution=shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor;
1611	#endif
1612	#endif
1613	#endif
1614	finalDiffuse.rgb+=vAmbientColor;
1615	finalDiffuse*=surfaceAlbedo.rgb;
1616	finalDiffuse=max(finalDiffuse,0.0);
1617	#ifdef OVERLOADEDSHADOWVALUES
1618	shadowedOnlyLightDiffuseContribution+=vAmbientColor;
1619	shadowedOnlyLightDiffuseContribution*=surfaceAlbedo.rgb;
1620	shadowedOnlyLightDiffuseContribution=max(shadowedOnlyLightDiffuseContribution,0.0);
1621	finalDiffuse=mix(finalDiffuse,shadowedOnlyLightDiffuseContribution,(1.0-vOverloadedShadowIntensity.y));
1622	#endif
1623	finalDiffuse=(finalDiffuse*vLightingIntensity.x+surfaceAlbedo.rgb*environmentIrradiance)*ambientOcclusionColor;
1624	#ifdef SPECULARTERM
1625	vec3 finalSpecular=lightSpecularContribution*surfaceReflectivityColor;
1626	#ifdef SPECULAROVERALPHA
1627	alpha=clamp(alpha+getLuminance(finalSpecular),0.,1.);
1628	#endif
1629	#else
1630	vec3 finalSpecular=vec3(0.0);
1631	#endif
1632	#ifdef RADIANCEOVERALPHA
1633	alpha=clamp(alpha+getLuminance(environmentRadiance),0.,1.);
1634	#endif
1635	
1636	
1637	vec4 finalColor=vec4(finalDiffuse+finalSpecular*vLightingIntensity.x+environmentRadiance+refractance,alpha);
1638	#ifdef EMISSIVEASILLUMINATION
1639	finalColor.rgb+=(surfaceEmissiveColor*vLightingIntensity.y);
1640	#endif
1641	#ifdef LIGHTMAP
1642	#ifndef LIGHTMAPEXCLUDED
1643	#ifdef USELIGHTMAPASSHADOWMAP
1644	finalColor.rgb*=lightmapColor;
1645	#else
1646	finalColor.rgb+=lightmapColor;
1647	#endif
1648	#endif
1649	#endif
1650	finalColor=max(finalColor,0.0);
1651	#ifdef CAMERATONEMAP
1652	finalColor.rgb=toneMaps(finalColor.rgb);
1653	#endif
1654	finalColor.rgb=toGammaSpace(finalColor.rgb);
1655	#ifdef LOGARITHMICDEPTH
1656	gl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;
1657	#endif
1658	#ifdef FOG
1659	float fog=CalcFogFactor();
1660	finalColor.rgb=fog*finalColor.rgb+(1.0-fog)*vFogColor;
1661	#endif
1662	#ifdef CAMERACONTRAST
1663	finalColor=contrasts(finalColor);
1664	#endif
1665	finalColor.rgb=clamp(finalColor.rgb,0.,1.);
1666	#ifdef CAMERACOLORGRADING
1667	finalColor=colorGrades(finalColor);
1668	#endif
1669	#ifdef CAMERACOLORCURVES
1670	finalColor.rgb=applyColorCurves(finalColor.rgb);
1671	#endif
1672	
1673	
1674	
1675	
1676	
1677	
1678	
1679	
1680	
1681	
1682	
1683	
1684	
1685	
1686	
1687	
1688	
1689	
1690	
1691	gl_FragColor=finalColor;
1692	}

 

Link to comment
Share on other sites

@NasimiAsl

Device: Galaxy Tab 3, OS: Android 4.4.2, 

Browser: Chrome 58.0.3029.83

Playground had just blue background, after device rotation corrupted images appeared, but no errors just warning.

https://www.babylonjs-playground.com/#F5IEQE#19

FPS: 35

Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#19:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#19:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_ENUM : GetIntegerv: <- error from previous GL command
/#F5IEQE#19:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#19:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#19:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#19' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
85/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
23/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
134/#F5IEQE#19:1 [.Offscreen-For-WebGL-0x66b38a90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled

https://www.babylonjs-playground.com/#F5IEQE#18
FPS: 28 - 35;

/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x6c984010]GL ERROR :GL_INVALID_ENUM : GetIntegerv: <- error from previous GL command
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GetShaderiv: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]RENDER WARNING: there is no texture bound to the unit 1
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
235/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x66bb3dd0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled

https://www.babylonjs-playground.com/#F5IEQE#20

FPS: 35

Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#20' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_OPERATION : glGenerateMipmap: Can not generate mips
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glTexImage2D: <- error from previous GL command
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#F5IEQE#20:1 [.Offscreen-For-WebGL-0x6cda0b20]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : GLES2DecoderImpl::ClearWorkaround: was unhandled
/#F5IEQE#20:1 WebGL: too many errors, no more errors will be reported to the console for this context.

 

Link to comment
Share on other sites

Device: Galaxy S2+, OS: Android 4.2.2

Chrome: 58.0.3029.83

Works as expected.

FPS: 17-35;

https://www.babylonjs-playground.com/#F5IEQE#18

/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/PNqf4Fw.jpg'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/HvVUQya.png'. This content should also be served over HTTPS.
/#F5IEQE#18:1 Mixed Content: The page at 'https://www.babylonjs-playground.com/#F5IEQE#18' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/XPs4d4L.jpg'. This content should also be served over HTTPS.
16/#F5IEQE#18:1 [.Offscreen-For-WebGL-0x4f1640a8]RENDER WARNING: there is no texture bound to the unit 1
workerClient.ts:27 Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
mode.js:7 Object {errorCode: "load", moduleId: "vs/language/typescript/src/worker", neededBy: Array(1), detail: Event}detail: Eventbubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: truepath: Array(5)returnValue: truesrcElement: scripttarget: scripttimeStamp: 29558.620000000003type: "error"__proto__: EventerrorCode: "load"moduleId: "vs/language/typescript/src/worker"neededBy: Array(1)__proto__: Object

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...