unable to find compatible overloaded function
Running 0.8.9 on Ubuntu 16.04, I get the following dump after converting a blend file and then attempting to open the j3o file.
stolpcs@Ubuntu1:~/jm-working-folder/BlockStack3D/android/src/main/assets/Models$ /opt/jME3-SpaceShift-Editor/jME3-SpaceShift-Editor
Jan 04, 2017 7:58:51 PM com.jme3.system.NativeLibraryLoader setExtractionFolderToUserCache
WARNING: Working directory is not writable. Natives will be extracted to:
/home/stolpcs/.cache/jme3/natives_41296e1b
INFO 19:58:52:340 Editor: OS: Ubuntu 16.04.1 LTS (xenial)
INFO 19:58:52:660 ExecutorManager: initialized.
INFO 19:58:52:684 ClassPathScanner: scanning libs/jME/jme3-core-3.2.0.jar
INFO 19:58:52:811 ClassPathScanner: scanning libs/jME/jme3-effects-3.2.0.jar
INFO 19:58:52:819 ClassPathScanner: scanning /opt/jME3-SpaceShift-Editor/app/libs/jME/jme3-core-3.2.0.jar
INFO 19:58:52:849 ClassPathScanner: scanning /opt/jME3-SpaceShift-Editor/app/libs/jME/jme3-effects-3.2.0.jar
INFO 19:58:52:854 ClassPathScanner: scanned for 1546 classes and 450 resources.
log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.PoolingHttpClientConnectionManager).
log4j:WARN Please initialize the log4j system properly.
Jan 04, 2017 7:58:54 PM com.jme3.material.Material checkSetParam
WARNING: Material parameter being set: Texture with type Texture2D doesn't match definition types TextureCubeMap
Jan 04, 2017 7:58:54 PM com.jme3.material.Material setTextureParam
WARNING: The texture graphics/textures/sky/studio.hdr has linear color space, but the material parameter Texture specifies no color space requirement, this may lead to unexpected behavior.
Check if the image was not set to another material parameter with a linear color space, or that you did not set the ColorSpace to Linear using texture.getImage.setColorSpace().
Jan 04, 2017 7:59:07 PM com.jme3.renderer.opengl.GLRenderer updateShaderSourceData
WARNING: Bad compile of:
1 #version 150 core
2 #define FRAGMENT_SHADER 1
3 #define MATERIAL_COLORS 1
4 #define DIFFUSEMAP 1
5 #define SINGLE_PASS_LIGHTING 1
6 #define NB_LIGHTS 15
7 #if VERSION >= 150
8 #extension GL_NV_shadow_samplers_cube : enable
9 #endif
10
11 // -- begin import Common/ShaderLib/GLSLCompat.glsllib --
12 #if defined GL_ES
13 # define hfloat highp float
14 # define hvec2 highp vec2
15 # define hvec3 highp vec3
16 # define hvec4 highp vec4
17 # define lfloat lowp float
18 # define lvec2 lowp vec2
19 # define lvec3 lowp vec3
20 # define lvec4 lowp vec4
21 #else
22 # define hfloat float
23 # define hvec2 vec2
24 # define hvec3 vec3
25 # define hvec4 vec4
26 # define lfloat float
27 # define lvec2 vec2
28 # define lvec3 vec3
29 # define lvec4 vec4
30 #endif
31
32 #if VERSION >= 130
33 out vec4 outFragColor;
34 # define texture1D texture
35 # define texture2D texture
36 # define texture3D texture
37 # define texture2DLod textureLod
38 # define textureCubeLod textureLod
39 # if defined VERTEX_SHADER
40 # define varying out
41 # define attribute in
42 # elif defined FRAGMENT_SHADER
43 # define varying in
44 # define gl_FragColor outFragColor
45 # endif
46 #endif
47 // -- end import Common/ShaderLib/GLSLCompat.glsllib --
48 // -- begin import Common/ShaderLib/Parallax.glsllib --
49 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
50 vec2 steepParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){
51 vec2 vParallaxDirection = normalize( vViewDir.xy );
52
53 // The length of this vector determines the furthest amount of displacement: (Ati's comment)
54 float fLength = length( vViewDir );
55 float fParallaxLength = sqrt( fLength * fLength - vViewDir.z * vViewDir.z ) / vViewDir.z;
56
57 // Compute the actual reverse parallax displacement vector: (Ati's comment)
58 vec2 vParallaxOffsetTS = vParallaxDirection * fParallaxLength;
59
60 // Need to scale the amount of displacement to account for different height ranges
61 // in height maps. This is controlled by an artist-editable parameter: (Ati's comment)
62 parallaxScale =0.3;
63 vParallaxOffsetTS = parallaxScale;
64
65 vec3 eyeDir = normalize(vViewDir).xyz;
66
67 float nMinSamples = 6.0;
68 float nMaxSamples = 1000.0 * parallaxScale;
69 float nNumSamples = mix( nMinSamples, nMaxSamples, 1.0 - eyeDir.z ); //In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) ));
70 float fStepSize = 1.0 / nNumSamples;
71 float fCurrHeight = 0.0;
72 float fPrevHeight = 1.0;
73 float fNextHeight = 0.0;
74 float nStepIndex = 0.0;
75 vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS;
76 vec2 vTexCurrentOffset = texCoord;
77 float fCurrentBound = 1.0;
78 float fParallaxAmount = 0.0;
79
80 while ( nStepIndex < nNumSamples && fCurrHeight <= fCurrentBound ) {
81 vTexCurrentOffset -= vTexOffsetPerStep;
82 fPrevHeight = fCurrHeight;
83
84
85 #ifdef NORMALMAP_PARALLAX
86 //parallax map is stored in the alpha channel of the normal map
87 fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).a;
88 #else
89 //parallax map is a texture
90 fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).r;
91 #endif
92
93 fCurrentBound -= fStepSize;
94 nStepIndex+=1.0;
95 }
96 vec2 pt1 = vec2( fCurrentBound, fCurrHeight );
97 vec2 pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight );
98
99 float fDelta2 = pt2.x - pt2.y;
100 float fDelta1 = pt1.x - pt1.y;
101
102 float fDenominator = fDelta2 - fDelta1;
103
104 fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;
105
106 vec2 vParallaxOffset = vParallaxOffsetTS * (1.0 - fParallaxAmount );
107 return texCoord - vParallaxOffset;
108 }
109
110 vec2 classicParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){
111 float h;
112 #ifdef NORMALMAP_PARALLAX
113 //parallax map is stored in the alpha channel of the normal map
114 h = texture2D(parallaxMap, texCoord).a;
115 #else
116 //parallax map is a texture
117 h = texture2D(parallaxMap, texCoord).r;
118 #endif
119 float heightScale = parallaxScale;
120 float heightBias = heightScale -0.6;
121 vec3 normView = normalize(vViewDir);
122 h = (h * heightScale + heightBias) * normView.z;
123 return texCoord + (h * normView.xy);
124 }
125 #endif
126 // -- end import Common/ShaderLib/Parallax.glsllib --
127 // -- begin import Common/ShaderLib/Optics.glsllib --
128 #if defined(SPHERE_MAP) || defined(EQUIRECT_MAP)
129 #define ENVMAP sampler2D
130 #define TEXENV texture2D
131 #else
132 #define ENVMAP samplerCube
133 #define TEXENV textureCube
134 #endif
135
136 // converts a normalized direction vector
137 // into a texture coordinate for fetching
138 // texel from a sphere map
139 vec2 Optics_SphereCoord(in vec3 dir){
140 float dzplus1 = dir.z + 1.0;
141
142 // compute 1/2p
143 // NOTE: this simplification only works if dir is normalized.
144 float inv_two_p = 1.414 * sqrt(dzplus1);
145 //float inv_two_p = sqrt(dir.x * dir.x + dir.y * dir.y + dzplus1 * dzplus1);
146 inv_two_p = 2.0;
147 inv_two_p = 1.0 / inv_two_p;
148
149 // compute texcoord
150 return (dir.xy * vec2(inv_two_p)) + vec2(0.5);
151 }
152
153 #ifndef PI
154 #define PI 3.14159265358979323846264
155 #endif
156 //should be vec2(1.0 / (PI * 2.0), 1.0 / PI) but it's precomputed.
157 const vec2 Optics_Glsllib_Rads = vec2(0.159154943091895, 0.318309886183790);
158 vec2 Optics_LonLatCoords(in ENVMAP envMap, in vec3 dir){
159 float lon = atan(dir.z, dir.x)+ PI;
160 float lat = acos(dir.y);
161 return vec2(lon, lat) * Optics_Glsllib_Rads;
162 }
163
164 vec4 Optics_GetEnvColor(in ENVMAP envMap, in vec3 dir){
165 #ifdef SPHERE_MAP
166 return texture2D(envMap, Optics_SphereCoord(dir));
167 #else
168 #ifdef EQUIRECT_MAP
169 return texture2D(envMap, Optics_LonLatCoords(envMap,dir));
170 #else
171 return textureCube(envMap, dir);
172 #endif
173 #endif
174 }
175 // -- end import Common/ShaderLib/Optics.glsllib --
176
177 #ifndef VERTEX_LIGHTING
178 // -- begin import Common/ShaderLib/BlinnPhongLighting.glsllib --
179 /Blinn Phong ligting/
180
181 /
182 * Computes diffuse factor (Lambert)
183 /
184 float lightComputeDiffuse(in vec3 norm, in vec3 lightdir){
185 return max(0.0, dot(norm, lightdir));
186 }
187
188 /
189 * Computes specular factor (blinn phong)
190 /
191 float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
192 vec3 H = normalize(viewdir + lightdir);
193 float HdotN = max(0.0, dot(H, norm));
194 return pow(HdotN, shiny);
195 }
196
197 /
198 Computes standard phong specular lighting
199 /
200 float lightComputeSpecularPhong(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
201 vec3 R = reflect(-lightdir, norm);
202 return pow(max(dot(R, viewdir), 0.0), shiny);
203 }
204
205
206 /
207 * Computes diffuse and specular factors and pack them in a vec2 (x=diffuse, y=specular)
208 /
209 vec2 computeLighting(in vec3 norm, in vec3 viewDir, in vec3 lightDir, in float attenuation, in float shininess){
210 float diffuseFactor = lightComputeDiffuse(norm, lightDir);
211 float specularFactor = lightComputeSpecular(norm, viewDir, lightDir, shininess);
212 if (shininess <= 1.0) {
213 specularFactor = 0.0; // should be one instruction on most cards ..
214 }
215 specularFactor = diffuseFactor;
216 return vec2(diffuseFactor, specularFactor) * vec2(attenuation);
217 }
218 // -- end import Common/ShaderLib/BlinnPhongLighting.glsllib --
219 // -- begin import Common/ShaderLib/Lighting.glsllib --
220 /Common function for light calculations/
221
222
223 /
224 * Computes light direction
225 * lightType should be 0.0,1.0,2.0, repectively for Directional, point and spot lights.
226 * Outputs the light direction and the light half vector.
227 /
228 void lightComputeDir(in vec3 worldPos, in float lightType, in vec4 position, out vec4 lightDir, out vec3 lightVec){
229 float posLight = step(0.5, lightType);
230 vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight);
231 lightVec = tempVec;
232 float dist = length(tempVec);
233 #ifdef SRGB
234 lightDir.w = (1.0 - position.w * dist) / (1.0 + position.w * dist * dist);
235 lightDir.w = clamp(lightDir.w, 1.0 - posLight, 1.0);
236 #else
237 lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0);
238 #endif
239 lightDir.xyz = tempVec / vec3(dist);
240 }
241
242 /
243 * Computes the spot falloff for a spotlight
244 /
245 float computeSpotFalloff(in vec4 lightDirection, in vec3 lightVector){
246 vec3 L=normalize(lightVector);
247 vec3 spotdir = normalize(lightDirection.xyz);
248 float curAngleCos = dot(-L, spotdir);
249 float innerAngleCos = floor(lightDirection.w) * 0.001;
250 float outerAngleCos = fract(lightDirection.w);
251 float innerMinusOuter = innerAngleCos - outerAngleCos;
252 float falloff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, step(lightDirection.w, 0.001), 1.0);
253
254 #ifdef SRGB
255 // Use quadratic falloff (notice the ^4)
256 return pow(clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0), 4.0);
257 #else
258 // Use linear falloff
259 return falloff;
260 #endif
261 }
262
263 // -- end import Common/ShaderLib/Lighting.glsllib --
264 #endif
265
266 varying vec2 texCoord;
267 #ifdef SEPARATE_TEXCOORD
268 varying vec2 texCoord2;
269 #endif
270
271 varying vec3 AmbientSum;
272 varying vec4 DiffuseSum;
273 varying vec3 SpecularSum;
274
275 #ifndef VERTEX_LIGHTING
276 uniform mat4 g_ViewMatrix;
277 uniform vec4 g_LightData[NB_LIGHTS];
278 varying vec3 vPos;
279 #endif
280
281 #ifdef DIFFUSEMAP
282 uniform sampler2D m_DiffuseMap;
283 #endif
284
285 #ifdef SPECULARMAP
286 uniform sampler2D m_SpecularMap;
287 #endif
288
289 #ifdef PARALLAXMAP
290 uniform sampler2D m_ParallaxMap;
291 #endif
292 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
293 uniform float m_ParallaxHeight;
294 #endif
295
296 #ifdef LIGHTMAP
297 uniform sampler2D m_LightMap;
298 #endif
299
300 #ifdef NORMALMAP
301 uniform sampler2D m_NormalMap;
302 varying vec4 vTangent;
303 #endif
304 varying vec3 vNormal;
305
306 #ifdef ALPHAMAP
307 uniform sampler2D m_AlphaMap;
308 #endif
309
310 #ifdef COLORRAMP
311 uniform sampler2D m_ColorRamp;
312 #endif
313
314 uniform float m_AlphaDiscardThreshold;
315
316 #ifndef VERTEX_LIGHTING
317 uniform float m_Shininess;
318
319 #ifdef USE_REFLECTION
320 uniform float m_ReflectionPower;
321 uniform float m_ReflectionIntensity;
322 varying vec4 refVec;
323
324 uniform ENVMAP m_EnvMap;
325 #endif
326 #endif
327
328 void main(){
329 #if !defined(VERTEX_LIGHTING)
330 #if defined(NORMALMAP)
331 mat3 tbnMat = mat3(vTangent.xyz, vTangent.w * cross( (vNormal), (vTangent.xyz)), vNormal.xyz);
332
333 if (!gl_FrontFacing)
334 {
335 tbnMat[2] = -tbnMat[2];
336 }
337
338 vec3 viewDir = normalize(-vPos.xyz * tbnMat);
339 #else
340 vec3 viewDir = normalize(-vPos.xyz);
341 #endif
342 #endif
343
344 vec2 newTexCoord;
345
346 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
347
348 #ifdef STEEP_PARALLAX
349 #ifdef NORMALMAP_PARALLAX
350 //parallax map is stored in the alpha channel of the normal map
351 newTexCoord = steepParallaxOffset(m_NormalMap, viewDir, texCoord, m_ParallaxHeight);
352 #else
353 //parallax map is a texture
354 newTexCoord = steepParallaxOffset(m_ParallaxMap, viewDir, texCoord, m_ParallaxHeight);
355 #endif
356 #else
357 #ifdef NORMALMAP_PARALLAX
358 //parallax map is stored in the alpha channel of the normal map
359 newTexCoord = classicParallaxOffset(m_NormalMap, viewDir, texCoord, m_ParallaxHeight);
360 #else
361 //parallax map is a texture
362 newTexCoord = classicParallaxOffset(m_ParallaxMap, viewDir, texCoord, m_ParallaxHeight);
363 #endif
364 #endif
365 #else
366 newTexCoord = texCoord;
367 #endif
368
369 #ifdef DIFFUSEMAP
370 vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord);
371 #else
372 vec4 diffuseColor = vec4(1.0);
373 #endif
374
375 float alpha = DiffuseSum.a * diffuseColor.a;
376
377 #ifdef ALPHAMAP
378 alpha = alpha * texture2D(m_AlphaMap, newTexCoord).r;
379 #endif
380
381 #ifdef DISCARD_ALPHA
382 if(alpha < m_AlphaDiscardThreshold){
383 discard;
384 }
385 #endif
386
387 // ***
388 // Read from textures
389 // ***
390 #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING)
391 vec4 normalHeight = texture2D(m_NormalMap, newTexCoord);
392 //Note the -2.0 and -1.0. We invert the green channel of the normal map,
393 //as it's complient with normal maps generated with blender.
394 //see http://hub.jmonkeyengine.org/forum/topic/parallax-mapping-fundamental-bug/#post-256898
395 //for more explanation.
396 vec3 normal = normalize((normalHeight.xyz * vec3(2.0,-2.0,2.0) - vec3(1.0,-1.0,1.0)));
397 #elif !defined(VERTEX_LIGHTING)
398 vec3 normal = normalize(vNormal);
399
400 if (!gl_FrontFacing)
401 {
402 normal = -normal;
403 }
404 #endif
405
406 #ifdef SPECULARMAP
407 vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
408 #else
409 vec4 specularColor = vec4(1.0);
410 #endif
411
412 #ifdef LIGHTMAP
413 vec3 lightMapColor;
414 #ifdef SEPARATE_TEXCOORD
415 lightMapColor = texture2D(m_LightMap, texCoord2).rgb;
416 #else
417 lightMapColor = texture2D(m_LightMap, texCoord).rgb;
418 #endif
419 specularColor.rgb = lightMapColor;
420 diffuseColor.rgb = lightMapColor;
421 #endif
422
423 #ifdef VERTEX_LIGHTING
424 gl_FragColor.rgb = AmbientSum.rgb * diffuseColor.rgb
425 + DiffuseSum.rgb * diffuseColor.rgb
426 + SpecularSum.rgb * specularColor.rgb;
427 #else
428
429 int i = 0;
430 gl_FragColor.rgb = AmbientSum * diffuseColor.rgb;
431
432 #ifdef USE_REFLECTION
433 vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);
434 #endif
435
436 for( int i = 0;i < NB_LIGHTS; i+=3){
437 vec4 lightColor = g_LightData[i];
438 vec4 lightData1 = g_LightData[i+1];
439 vec4 lightDir;
440 vec3 lightVec;
441 lightComputeDir(vPos, lightColor.w, lightData1, lightDir,lightVec);
442
443 float spotFallOff = 1.0;
444 #if VERSION >= 110
445 // allow use of control flow
446 if(lightColor.w > 1.0){
447 #endif
448 spotFallOff = computeSpotFalloff(g_LightData[i+2], lightVec);
449 #if VERSION >= 110
450 }
451 #endif
452
453 #ifdef NORMALMAP
454 //Normal map -> lighting is computed in tangent space
455 lightDir.xyz = normalize(lightDir.xyz * tbnMat);
456 #else
457 //no Normal map -> lighting is computed in view space
458 lightDir.xyz = normalize(lightDir.xyz);
459 #endif
460
461 vec2 light = computeLighting(normal, viewDir, lightDir.xyz, lightDir.w * spotFallOff , m_Shininess);
462
463 // Workaround, since it is not possible to modify varying variables
464 vec4 SpecularSum2 = vec4(SpecularSum, 1.0);
465 #ifdef USE_REFLECTION
466 // Interpolate light specularity toward reflection color
467 // Multiply result by specular map
468 specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor;
469
470 SpecularSum2 = vec4(1.0);
471 light.y = 1.0;
472 #endif
473
474 vec3 DiffuseSum2 = DiffuseSum.rgb;
475 #ifdef COLORRAMP
476 DiffuseSum2.rgb = texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
477 SpecularSum2.rgb = texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
478 light.xy = vec2(1.0);
479 #endif
480
481 gl_FragColor.rgb += DiffuseSum2.rgb * lightColor.rgb * diffuseColor.rgb * vec3(light.x) +
482 SpecularSum2.rgb * lightColor.rgb * specularColor.rgb * vec3(light.y);
483 }
484
485 #endif
486 gl_FragColor.a = alpha;
487 }
- WARNING 19:59:07:525 Editor: RendererException : compile error in: ShaderSource[name=Common/MatDefs/Light/SPLighting.frag, defines, type=Fragment, language=GLSL150]
- 0(171) : error C1115: unable to find compatible overloaded function "textureCube(samplerCube, vec3)"
- stack trace: com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1244) com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1271) com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1335) com.jme3.material.logic.SinglePassLightingLogic.render(SinglePassLightingLogic.java:215) com.jme3.material.Technique.render(Technique.java:166) com.jme3.material.Material.render(Material.java:970) com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:616) com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266) com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:305) com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:879) com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:781) com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1106) com.jme3.renderer.RenderManager.render(RenderManager.java:1154) com.jme3.app.SimpleApplication.update(SimpleApplication.java:253) com.jme3x.jfx.injfx.JmeToJFXApplication.update(JmeToJFXApplication.java:21) com.ss.editor.Editor.update(Unknown Source) com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:524) com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:607) com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:445) com.jme3x.jfx.injfx.JmeOffscreenSurfaceContext.create(JmeOffscreenSurfaceContext.java:169) com.jme3.app.LegacyApplication.start(LegacyApplication.java:463) com.jme3.app.LegacyApplication.start(LegacyApplication.java:424) com.jme3.app.SimpleApplication.start(SimpleApplication.java:125) com.ss.editor.Editor.start(Unknown Source) java.lang.Thread.run(Thread.java:745)
AL lib: (EE) alc_cleanup: 1 device not closed
Comments (10)
-
repo owner -
reporter It is the GeForce GTX 260/PCIe/SSE2.
-
reporter The converted .j3o file works correctly v0.7.8. Do you have any suggestions?
-
repo owner Do you have the same exception if you just create and open a material based on Common/MatDefs/Light/Lighting.j3md?
-
repo owner Can you recheck this problem in this version? https://yadi.sk/d/Ed00ceOU37dHnU
-
reporter I create the material based on Lighting.j3md and it crash also. Here's the output. I'm downloading the test version now.
Jan 07, 2017 8:10:08 PM com.jme3.material.Material checkSetParam WARNING: Material parameter being set: Texture with type Texture2D doesn't match definition types TextureCubeMap Jan 07, 2017 8:10:08 PM com.jme3.material.Material setTextureParam WARNING: The texture graphics/textures/sky/studio.hdr has linear color space, but the material parameter Texture specifies no color space requirement, this may lead to unexpected behavior. Check if the image was not set to another material parameter with a linear color space, or that you did not set the ColorSpace to Linear using texture.getImage.setColorSpace(). Jan 07, 2017 8:10:08 PM com.jme3.renderer.opengl.GLRenderer updateShaderSourceData WARNING: Bad compile of: 1 #version 150 core 2 #define FRAGMENT_SHADER 1 3 #define SINGLE_PASS_LIGHTING 1 4 #define NB_LIGHTS 15 5 #if VERSION >= 150 6 #extension GL_NV_shadow_samplers_cube : enable 7 #endif 8
9 // -- begin import Common/ShaderLib/GLSLCompat.glsllib -- 10 #if defined GL_ES 11 # define hfloat highp float 12 # define hvec2 highp vec2 13 # define hvec3 highp vec3 14 # define hvec4 highp vec4 15 # define lfloat lowp float 16 # define lvec2 lowp vec2 17 # define lvec3 lowp vec3 18 # define lvec4 lowp vec4 19 #else 20 # define hfloat float 21 # define hvec2 vec2 22 # define hvec3 vec3 23 # define hvec4 vec4 24 # define lfloat float 25 # define lvec2 vec2 26 # define lvec3 vec3 27 # define lvec4 vec4 28 #endif 29
30 #if VERSION >= 130 31 out vec4 outFragColor; 32 # define texture1D texture 33 # define texture2D texture 34 # define texture3D texture 35 # define texture2DLod textureLod 36 # define textureCubeLod textureLod 37 # if defined VERTEX_SHADER 38 # define varying out 39 # define attribute in 40 # elif defined FRAGMENT_SHADER 41 # define varying in 42 # define gl_FragColor outFragColor 43 # endif 44 #endif 45 // -- end import Common/ShaderLib/GLSLCompat.glsllib -- 46 // -- begin import Common/ShaderLib/Parallax.glsllib -- 47 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
48 vec2 steepParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){ 49 vec2 vParallaxDirection = normalize( vViewDir.xy ); 50
51 // The length of this vector determines the furthest amount of displacement: (Ati's comment) 52 float fLength = length( vViewDir ); 53 float fParallaxLength = sqrt( fLength * fLength - vViewDir.z * vViewDir.z ) / vViewDir.z; 54
55 // Compute the actual reverse parallax displacement vector: (Ati's comment) 56 vec2 vParallaxOffsetTS = vParallaxDirection * fParallaxLength; 57
58 // Need to scale the amount of displacement to account for different height ranges 59 // in height maps. This is controlled by an artist-editable parameter: (Ati's comment)
60 parallaxScale =0.3; 61 vParallaxOffsetTS = parallaxScale; 62
63 vec3 eyeDir = normalize(vViewDir).xyz;
64
65 float nMinSamples = 6.0; 66 float nMaxSamples = 1000.0 * parallaxScale;
67 float nNumSamples = mix( nMinSamples, nMaxSamples, 1.0 - eyeDir.z ); //In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) )); 68 float fStepSize = 1.0 / nNumSamples;
69 float fCurrHeight = 0.0; 70 float fPrevHeight = 1.0; 71 float fNextHeight = 0.0; 72 float nStepIndex = 0.0; 73 vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS; 74 vec2 vTexCurrentOffset = texCoord; 75 float fCurrentBound = 1.0; 76 float fParallaxAmount = 0.0;
77
78 while ( nStepIndex < nNumSamples && fCurrHeight <= fCurrentBound ) { 79 vTexCurrentOffset -= vTexOffsetPerStep; 80 fPrevHeight = fCurrHeight; 81
82
83 #ifdef NORMALMAP_PARALLAX 84 //parallax map is stored in the alpha channel of the normal map
85 fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).a; 86 #else 87 //parallax map is a texture 88 fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).r;
89 #endif 90
91 fCurrentBound -= fStepSize; 92 nStepIndex+=1.0; 93 } 94 vec2 pt1 = vec2( fCurrentBound, fCurrHeight ); 95 vec2 pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight ); 96
97 float fDelta2 = pt2.x - pt2.y; 98 float fDelta1 = pt1.x - pt1.y; 99
100 float fDenominator = fDelta2 - fDelta1; 101 102 fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator; 103 104 vec2 vParallaxOffset = vParallaxOffsetTS * (1.0 - fParallaxAmount ); 105 return texCoord - vParallaxOffset;
106 } 107 108 vec2 classicParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){ 109 float h; 110 #ifdef NORMALMAP_PARALLAX 111 //parallax map is stored in the alpha channel of the normal map
112 h = texture2D(parallaxMap, texCoord).a;
113 #else 114 //parallax map is a texture 115 h = texture2D(parallaxMap, texCoord).r; 116 #endif 117 float heightScale = parallaxScale; 118 float heightBias = heightScale -0.6; 119 vec3 normView = normalize(vViewDir);
120 h = (h * heightScale + heightBias) * normView.z; 121 return texCoord + (h * normView.xy); 122 } 123 #endif 124 // -- end import Common/ShaderLib/Parallax.glsllib -- 125 // -- begin import Common/ShaderLib/Optics.glsllib -- 126 #if defined(SPHERE_MAP) || defined(EQUIRECT_MAP) 127 #define ENVMAP sampler2D 128 #define TEXENV texture2D 129 #else 130 #define ENVMAP samplerCube 131 #define TEXENV textureCube 132 #endif 133 134 // converts a normalized direction vector 135 // into a texture coordinate for fetching 136 // texel from a sphere map 137 vec2 Optics_SphereCoord(in vec3 dir){ 138 float dzplus1 = dir.z + 1.0; 139 140 // compute 1/2p 141 // NOTE: this simplification only works if dir is normalized. 142 float inv_two_p = 1.414 * sqrt(dzplus1); 143 //float inv_two_p = sqrt(dir.x * dir.x + dir.y * dir.y + dzplus1 * dzplus1); 144 inv_two_p = 2.0; 145 inv_two_p = 1.0 / inv_two_p; 146 147 // compute texcoord 148 return (dir.xy * vec2(inv_two_p)) + vec2(0.5); 149 } 150 151 #ifndef PI 152 #define PI 3.14159265358979323846264 153 #endif 154 //should be vec2(1.0 / (PI * 2.0), 1.0 / PI) but it's precomputed. 155 const vec2 Optics_Glsllib_Rads = vec2(0.159154943091895, 0.318309886183790); 156 vec2 Optics_LonLatCoords(in ENVMAP envMap, in vec3 dir){ 157 float lon = atan(dir.z, dir.x)+ PI; 158 float lat = acos(dir.y); 159 return vec2(lon, lat) * Optics_Glsllib_Rads; 160 } 161 162 vec4 Optics_GetEnvColor(in ENVMAP envMap, in vec3 dir){ 163 #ifdef SPHERE_MAP 164 return texture2D(envMap, Optics_SphereCoord(dir)); 165 #else 166 #ifdef EQUIRECT_MAP 167 return texture2D(envMap, Optics_LonLatCoords(envMap,dir));
168 #else 169 return textureCube(envMap, dir); 170 #endif 171 #endif 172 } 173 // -- end import Common/ShaderLib/Optics.glsllib -- 174 175 #ifndef VERTEX_LIGHTING 176 // -- begin import Common/ShaderLib/BlinnPhongLighting.glsllib -- 177 /Blinn Phong ligting/ 178 179 / 180 * Computes diffuse factor (Lambert) 181 / 182 float lightComputeDiffuse(in vec3 norm, in vec3 lightdir){ 183 return max(0.0, dot(norm, lightdir)); 184 } 185 186 / 187 * Computes specular factor (blinn phong) 188 / 189 float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){ 190 vec3 H = normalize(viewdir + lightdir); 191 float HdotN = max(0.0, dot(H, norm)); 192 return pow(HdotN, shiny); 193 } 194 195 / 196 Computes standard phong specular lighting 197 / 198 float lightComputeSpecularPhong(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){ 199 vec3 R = reflect(-lightdir, norm); 200 return pow(max(dot(R, viewdir), 0.0), shiny); 201 } 202 203 204 / 205 * Computes diffuse and specular factors and pack them in a vec2 (x=diffuse, y=specular) 206 / 207 vec2 computeLighting(in vec3 norm, in vec3 viewDir, in vec3 lightDir, in float attenuation, in float shininess){ 208 float diffuseFactor = lightComputeDiffuse(norm, lightDir); 209 float specularFactor = lightComputeSpecular(norm, viewDir, lightDir, shininess);
210 if (shininess <= 1.0) { 211 specularFactor = 0.0; // should be one instruction on most cards .. 212 } 213 specularFactor = diffuseFactor; 214 return vec2(diffuseFactor, specularFactor) * vec2(attenuation); 215 } 216 // -- end import Common/ShaderLib/BlinnPhongLighting.glsllib -- 217 // -- begin import Common/ShaderLib/Lighting.glsllib -- 218 /Common function for light calculations/ 219 220 221 / 222 * Computes light direction 223 * lightType should be 0.0,1.0,2.0, repectively for Directional, point and spot lights. 224 * Outputs the light direction and the light half vector. 225 / 226 void lightComputeDir(in vec3 worldPos, in float lightType, in vec4 position, out vec4 lightDir, out vec3 lightVec){ 227 float posLight = step(0.5, lightType);
228 vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight); 229 lightVec = tempVec;
230 float dist = length(tempVec); 231 #ifdef SRGB 232 lightDir.w = (1.0 - position.w * dist) / (1.0 + position.w * dist * dist); 233 lightDir.w = clamp(lightDir.w, 1.0 - posLight, 1.0); 234 #else 235 lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0); 236 #endif 237 lightDir.xyz = tempVec / vec3(dist); 238 } 239 240 / 241 * Computes the spot falloff for a spotlight 242 / 243 float computeSpotFalloff(in vec4 lightDirection, in vec3 lightVector){ 244 vec3 L=normalize(lightVector); 245 vec3 spotdir = normalize(lightDirection.xyz); 246 float curAngleCos = dot(-L, spotdir);
247 float innerAngleCos = floor(lightDirection.w) * 0.001; 248 float outerAngleCos = fract(lightDirection.w); 249 float innerMinusOuter = innerAngleCos - outerAngleCos; 250 float falloff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, step(lightDirection.w, 0.001), 1.0); 251 252 #ifdef SRGB 253 // Use quadratic falloff (notice the ^4) 254 return pow(clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0), 4.0); 255 #else 256 // Use linear falloff 257 return falloff; 258 #endif 259 } 260 261 // -- end import Common/ShaderLib/Lighting.glsllib -- 262 #endif 263 264 varying vec2 texCoord; 265 #ifdef SEPARATE_TEXCOORD 266 varying vec2 texCoord2; 267 #endif 268 269 varying vec3 AmbientSum; 270 varying vec4 DiffuseSum; 271 varying vec3 SpecularSum; 272 273 #ifndef VERTEX_LIGHTING 274 uniform mat4 g_ViewMatrix; 275 uniform vec4 g_LightData[NB_LIGHTS]; 276 varying vec3 vPos; 277 #endif 278 279 #ifdef DIFFUSEMAP 280 uniform sampler2D m_DiffuseMap; 281 #endif 282 283 #ifdef SPECULARMAP 284 uniform sampler2D m_SpecularMap; 285 #endif 286 287 #ifdef PARALLAXMAP 288 uniform sampler2D m_ParallaxMap;
289 #endif 290 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING) 291 uniform float m_ParallaxHeight; 292 #endif 293 294 #ifdef LIGHTMAP 295 uniform sampler2D m_LightMap; 296 #endif 297
298 #ifdef NORMALMAP 299 uniform sampler2D m_NormalMap;
300 varying vec4 vTangent; 301 #endif 302 varying vec3 vNormal; 303 304 #ifdef ALPHAMAP 305 uniform sampler2D m_AlphaMap; 306 #endif 307 308 #ifdef COLORRAMP 309 uniform sampler2D m_ColorRamp; 310 #endif 311 312 uniform float m_AlphaDiscardThreshold; 313 314 #ifndef VERTEX_LIGHTING 315 uniform float m_Shininess; 316 317 #ifdef USE_REFLECTION 318 uniform float m_ReflectionPower; 319 uniform float m_ReflectionIntensity; 320 varying vec4 refVec; 321 322 uniform ENVMAP m_EnvMap; 323 #endif 324 #endif 325 326 void main(){ 327 #if !defined(VERTEX_LIGHTING) 328 #if defined(NORMALMAP) 329 mat3 tbnMat = mat3(vTangent.xyz, vTangent.w * cross( (vNormal), (vTangent.xyz)), vNormal.xyz); 330 331 if (!gl_FrontFacing) 332 { 333 tbnMat[2] = -tbnMat[2]; 334 } 335 336 vec3 viewDir = normalize(-vPos.xyz * tbnMat); 337 #else 338 vec3 viewDir = normalize(-vPos.xyz); 339 #endif 340 #endif 341 342 vec2 newTexCoord; 343
344 #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING) 345
346 #ifdef STEEP_PARALLAX 347 #ifdef NORMALMAP_PARALLAX 348 //parallax map is stored in the alpha channel of the normal map
349 newTexCoord = steepParallaxOffset(m_NormalMap, viewDir, texCoord, m_ParallaxHeight); 350 #else 351 //parallax map is a texture 352 newTexCoord = steepParallaxOffset(m_ParallaxMap, viewDir, texCoord, m_ParallaxHeight);
353 #endif 354 #else 355 #ifdef NORMALMAP_PARALLAX 356 //parallax map is stored in the alpha channel of the normal map
357 newTexCoord = classicParallaxOffset(m_NormalMap, viewDir, texCoord, m_ParallaxHeight); 358 #else 359 //parallax map is a texture 360 newTexCoord = classicParallaxOffset(m_ParallaxMap, viewDir, texCoord, m_ParallaxHeight); 361 #endif 362 #endif 363 #else 364 newTexCoord = texCoord;
365 #endif 366
367 #ifdef DIFFUSEMAP 368 vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord); 369 #else 370 vec4 diffuseColor = vec4(1.0); 371 #endif 372 373 float alpha = DiffuseSum.a * diffuseColor.a; 374 375 #ifdef ALPHAMAP 376 alpha = alpha * texture2D(m_AlphaMap, newTexCoord).r; 377 #endif 378 379 #ifdef DISCARD_ALPHA 380 if(alpha < m_AlphaDiscardThreshold){ 381 discard; 382 } 383 #endif 384
385 // *** 386 // Read from textures 387 // *** 388 #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING) 389 vec4 normalHeight = texture2D(m_NormalMap, newTexCoord); 390 //Note the -2.0 and -1.0. We invert the green channel of the normal map, 391 //as it's complient with normal maps generated with blender. 392 //see http://hub.jmonkeyengine.org/forum/topic/parallax-mapping-fundamental-bug/#post-256898 393 //for more explanation. 394 vec3 normal = normalize((normalHeight.xyz * vec3(2.0,-2.0,2.0) - vec3(1.0,-1.0,1.0))); 395 #elif !defined(VERTEX_LIGHTING) 396 vec3 normal = normalize(vNormal); 397 398 if (!gl_FrontFacing) 399 { 400 normal = -normal; 401 }
402 #endif 403 404 #ifdef SPECULARMAP 405 vec4 specularColor = texture2D(m_SpecularMap, newTexCoord); 406 #else 407 vec4 specularColor = vec4(1.0); 408 #endif 409 410 #ifdef LIGHTMAP 411 vec3 lightMapColor; 412 #ifdef SEPARATE_TEXCOORD 413 lightMapColor = texture2D(m_LightMap, texCoord2).rgb; 414 #else 415 lightMapColor = texture2D(m_LightMap, texCoord).rgb; 416 #endif 417 specularColor.rgb = lightMapColor; 418 diffuseColor.rgb = lightMapColor; 419 #endif 420 421 #ifdef VERTEX_LIGHTING 422 gl_FragColor.rgb = AmbientSum.rgb * diffuseColor.rgb 423 + DiffuseSum.rgb * diffuseColor.rgb 424 + SpecularSum.rgb * specularColor.rgb;
425 #else
426
427 int i = 0; 428 gl_FragColor.rgb = AmbientSum * diffuseColor.rgb; 429 430 #ifdef USE_REFLECTION 431 vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz); 432 #endif 433 434 for( int i = 0;i < NB_LIGHTS; i+=3){ 435 vec4 lightColor = g_LightData[i]; 436 vec4 lightData1 = g_LightData[i+1];
437 vec4 lightDir; 438 vec3 lightVec;
439 lightComputeDir(vPos, lightColor.w, lightData1, lightDir,lightVec); 440 441 float spotFallOff = 1.0; 442 #if VERSION >= 110 443 // allow use of control flow 444 if(lightColor.w > 1.0){ 445 #endif 446 spotFallOff = computeSpotFalloff(g_LightData[i+2], lightVec); 447 #if VERSION >= 110 448 } 449 #endif 450
451 #ifdef NORMALMAP
452 //Normal map -> lighting is computed in tangent space 453 lightDir.xyz = normalize(lightDir.xyz * tbnMat);
454 #else 455 //no Normal map -> lighting is computed in view space 456 lightDir.xyz = normalize(lightDir.xyz);
457 #endif 458 459 vec2 light = computeLighting(normal, viewDir, lightDir.xyz, lightDir.w * spotFallOff , m_Shininess); 460 461 // Workaround, since it is not possible to modify varying variables 462 vec4 SpecularSum2 = vec4(SpecularSum, 1.0); 463 #ifdef USE_REFLECTION
464 // Interpolate light specularity toward reflection color 465 // Multiply result by specular map 466 specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor; 467 468 SpecularSum2 = vec4(1.0); 469 light.y = 1.0; 470 #endif 471 472 vec3 DiffuseSum2 = DiffuseSum.rgb; 473 #ifdef COLORRAMP 474 DiffuseSum2.rgb = texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb; 475 SpecularSum2.rgb = texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb; 476 light.xy = vec2(1.0); 477 #endif 478 479 gl_FragColor.rgb += DiffuseSum2.rgb * lightColor.rgb * diffuseColor.rgb * vec3(light.x) + 480 SpecularSum2.rgb * lightColor.rgb * specularColor.rgb * vec3(light.y); 481 } 482
483 #endif 484 gl_FragColor.a = alpha; 485 }- WARNING 20:10:08:914 Editor: RendererException : compile error in: ShaderSource[name=Common/MatDefs/Light/SPLighting.frag, defines, type=Fragment, language=GLSL150]
- 0(169) : error C1115: unable to find compatible overloaded function "textureCube(samplerCube, vec3)"
- stack trace: com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1244) com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1271) com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1335) com.jme3.material.logic.SinglePassLightingLogic.render(SinglePassLightingLogic.java:215) com.jme3.material.Technique.render(Technique.java:166) com.jme3.material.Material.render(Material.java:970) com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:616) com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266) com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:305) com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:879) com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:781) com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1106) com.jme3.renderer.RenderManager.render(RenderManager.java:1154) com.jme3.app.SimpleApplication.update(SimpleApplication.java:253) com.jme3x.jfx.injfx.JmeToJFXApplication.update(JmeToJFXApplication.java:21) com.ss.editor.Editor.update(Editor.java:367) com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:524) com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:607) com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:445) com.jme3x.jfx.injfx.JmeOffscreenSurfaceContext.create(JmeOffscreenSurfaceContext.java:169) com.jme3.app.LegacyApplication.start(LegacyApplication.java:463) com.jme3.app.LegacyApplication.start(LegacyApplication.java:424) com.jme3.app.SimpleApplication.start(SimpleApplication.java:125) com.ss.editor.Editor.start(Editor.java:223) java.lang.Thread.run(Thread.java:745)
AL lib: (EE) alc_cleanup: 1 device not closed
Process finished with exit code 1
-
reporter The test version worked correctly. I was able to open the converted j3o and create the material.
-
repo owner Great! so, your problem fixed in the version 0.9.0
-
repo owner - changed status to resolved
-
repo owner - changed component to jMonkeyPlatform
- changed version to 0.9.0
- changed milestone to M2
- Log in to comment
what graphics card do you use?