Error: No function "textureCubeLod" when running TestPBRLighting on Intel HD4000 [Solved]

Hi,

When I start the PBR tests with assertions enabled on the PBRisComing branch I get the following error:

Uncaught exception thrown in Thread[jME3 Main,5,main]
RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/PBRLighting.frag, defines, type=Fragment, language=GLSL100]
0:228(63): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:228(68): error: type mismatch
0:236(64): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:236(69): error: type mismatch

I have an Intel HD4000 and Ubuntu Gnome 14.04. My graphic caps are:

INFORMATION: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, TextureMultisample, OpenGL20, OpenGL21, OpenGL30, GLSL100, GLSL110, GLSL120, GLSL130, VertexTextureFetch, TextureArray, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, NonPowerOfTwoTextures, MeshInstancing, VertexBufferArray, Multisample, PackedDepthStencilBuffer, Srgb, FrameBufferBlit, TextureCompressionS3TC, TextureFilterAnisotropic, TextureCompressionETC1, TextureCompressionETC2, DepthTexture, IntegerIndexBuffer, SeamlessCubemap]

This is the full stacktrace for running TestPBRLighting:

/usr/lib/jvm/java-8-oracle/bin/java -ea [...] jme3test.light.pbr.TestPBRLighting
Jul 06, 2016 4:07:31 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.1-5740
 * Branch: master
 * Git Hash: 664ea53
 * Build Date: 2016-07-06
Jul 06, 2016 4:07:31 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFORMATION: LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Jul 06, 2016 4:07:31 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFORMATION: OpenGL Renderer Information
 * Vendor: Intel Open Source Technology Center
 * Renderer: Mesa DRI Intel(R) Ivybridge Desktop 
 * OpenGL Version: 3.0 Mesa 10.1.3
 * GLSL Version: 1.30
 * Profile: Compatibility
Jul 06, 2016 4:07:32 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Jul 06, 2016 4:07:32 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNUNG: Pausing audio device not supported.
Jul 06, 2016 4:07:32 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio effect extension version: 1.0
Jul 06, 2016 4:07:32 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio max auxiliary sends: 4
Jul 06, 2016 4:07:32 PM com.jme3.material.Material checkSetParam
WARNUNG: Material parameter being set: Texture with type Texture2D doesn't match definition types TextureCubeMap
Jul 06, 2016 4:07:32 PM com.jme3.material.Material setTextureParam
WARNUNG: The texture Textures/Sky/Path.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().
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreShadow':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PostShadow15':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PostShadow':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreNormalPass':
Define 'DIFFUSEMAP_ALPHA' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreNormalPassDerivative':
Define 'DIFFUSEMAP_ALPHA' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'MATERIAL_COLORS' mapped to non-existent material parameter 'UseMaterialColors', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'V_TANGENT' mapped to non-existent material parameter 'VTangent', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'MINNAERT' mapped to non-existent material parameter 'Minnaert', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'WARDISO' mapped to non-existent material parameter 'WardIso', ignoring.
Jul 06, 2016 4:07:32 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'DIFFUSEMAP' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 4:07:34 PM com.jme3.renderer.opengl.GLRenderer updateShaderSourceData
WARNUNG: Bad compile of:
1    #version 110
2    #define FRAGMENT_SHADER 1
3    #define BASECOLORMAP 1
4    #define NORMALMAP 1
5    #define METALLICMAP 1
6    #define ROUGHNESSMAP 1
7    #define EMISSIVEMAP 1
8    #define SINGLE_PASS_LIGHTING 1
9    #define NB_LIGHTS 3
10    // -- begin import Common/ShaderLib/Parallax.glsllib --
11    #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)    
12        vec2 steepParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){
13            vec2 vParallaxDirection = normalize(  vViewDir.xy );
14    
15            // The length of this vector determines the furthest amount of displacement: (Ati's comment)
16            float fLength         = length( vViewDir );
17            float fParallaxLength = sqrt( fLength * fLength - vViewDir.z * vViewDir.z ) / vViewDir.z; 
18    
19            // Compute the actual reverse parallax displacement vector: (Ati's comment)
20            vec2 vParallaxOffsetTS = vParallaxDirection * fParallaxLength;
21    
22            // Need to scale the amount of displacement to account for different height ranges
23            // in height maps. This is controlled by an artist-editable parameter: (Ati's comment)              
24            parallaxScale *=0.3;
25            vParallaxOffsetTS *= parallaxScale;
26    
27           vec3 eyeDir = normalize(vViewDir).xyz;   
28    
29            float nMinSamples = 6.0;
30            float nMaxSamples = 1000.0 * parallaxScale;   
31            float nNumSamples = mix( nMinSamples, nMaxSamples, 1.0 - eyeDir.z );   //In reference shader: int nNumSamples = (int)(lerp( nMinSamples, nMaxSamples, dot( eyeDirWS, N ) ));
32            float fStepSize = 1.0 / nNumSamples;   
33            float fCurrHeight = 0.0;
34            float fPrevHeight = 1.0;
35            float fNextHeight = 0.0;
36            float nStepIndex = 0.0;
37            vec2 vTexOffsetPerStep = fStepSize * vParallaxOffsetTS;
38            vec2 vTexCurrentOffset = texCoord;
39            float  fCurrentBound     = 1.0;
40            float  fParallaxAmount   = 0.0;   
41    
42            while ( nStepIndex < nNumSamples && fCurrHeight <= fCurrentBound ) {
43                vTexCurrentOffset -= vTexOffsetPerStep;
44                fPrevHeight = fCurrHeight;
45                
46               
47               #ifdef NORMALMAP_PARALLAX
48                   //parallax map is stored in the alpha channel of the normal map         
49                   fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).a; 
50               #else
51                   //parallax map is a texture
52                   fCurrHeight = texture2D( parallaxMap, vTexCurrentOffset).r;                
53               #endif
54               
55                fCurrentBound -= fStepSize;
56                nStepIndex+=1.0;
57            } 
58            vec2 pt1 = vec2( fCurrentBound, fCurrHeight );
59            vec2 pt2 = vec2( fCurrentBound + fStepSize, fPrevHeight );
60    
61            float fDelta2 = pt2.x - pt2.y;
62            float fDelta1 = pt1.x - pt1.y;
63    
64            float fDenominator = fDelta2 - fDelta1;
65    
66            fParallaxAmount = (pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;
67    
68            vec2 vParallaxOffset = vParallaxOffsetTS * (1.0 - fParallaxAmount );
69           return texCoord - vParallaxOffset;  
70        }
71    
72        vec2 classicParallaxOffset(sampler2D parallaxMap, vec3 vViewDir,vec2 texCoord,float parallaxScale){ 
73           float h;
74           #ifdef NORMALMAP_PARALLAX
75                   //parallax map is stored in the alpha channel of the normal map         
76                   h = texture2D(parallaxMap, texCoord).a;               
77           #else
78                   //parallax map is a texture
79                   h = texture2D(parallaxMap, texCoord).r;
80           #endif
81           float heightScale = parallaxScale;
82           float heightBias = heightScale* -0.6;
83           vec3 normView = normalize(vViewDir);       
84           h = (h * heightScale + heightBias) * normView.z;
85           return texCoord + (h * normView.xy);
86        }
87    #endif
88    // -- end import Common/ShaderLib/Parallax.glsllib --
89    // -- begin import Common/ShaderLib/PBR.glsllib --
90    
91    #ifndef PI
92        #define PI 3.14159265358979323846264
93    #endif
94    
95    //Specular fresnel computation
96    vec3 F_Shlick(float vh,    vec3 F0){
97        float fresnelFact = pow(2.0, (-5.55473*vh - 6.98316) * vh);
98        return mix(F0, vec3(1.0, 1.0, 1.0), fresnelFact);
99    }
100    
101    void PBR_ComputeDirectLightSpecWF(vec3 normal, vec3 lightDir, vec3 viewDir,
102                                vec3 lightColor, vec3 specColor, float roughness, float ndotv,
103                                out vec3 outDiffuse, out vec3 outSpecular){
104        // Compute halfway vector.
105        vec3 halfVec = normalize(lightDir + viewDir);
106    
107        // Compute ndotl, ndoth,  vdoth terms which are needed later.
108        float ndotl = max( dot(normal,   lightDir), 0.0);
109        float ndoth = max( dot(normal,   halfVec),  0.0);       
110        float hdotv = max( dot(viewDir,  halfVec),  0.0);
111    
112        // Compute diffuse using energy-conserving Lambert.
113        // Alternatively, use Oren-Nayar for really rough 
114        // materials or if you have lots of processing power ...
115        outDiffuse = vec3(ndotl) * lightColor;
116    
117        //cook-torrence, microfacet BRDF : http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
118       
119        float alpha = roughness * roughness;
120    
121        //D, GGX normaal Distribution function     
122        float alpha2 = alpha * alpha;
123        float sum  = ((ndoth * ndoth) * (alpha2 - 1.0) + 1.0);
124        float denom = PI * sum * sum;
125        float D = alpha2 / denom;  
126    
127        // Compute Fresnel function via Schlick's approximation.
128        vec3 fresnel =  F_Shlick(hdotv,  specColor);
129        
130        //G Shchlick GGX Gometry shadowing term,  k = alpha/2
131        float k = alpha * 0.5;
132    
133        // UE4 way to optimise shlick GGX Gometry shadowing term
134        //http://graphicrants.blogspot.co.uk/2013/08/specular-brdf-reference.html
135        float G_V = ndotv + sqrt( (ndotv - ndotv * k) * ndotv + k );
136        float G_L = ndotl + sqrt( (ndotl - ndotl * k) * ndotl + k );    
137        // the max here is to avoid division by 0 that may cause some small glitches.
138        float G = 1.0/max( G_V * G_L ,0.01); 
139    
140        float specular = D * G * ndotl;  
141     
142        outSpecular = fresnel * vec3(specular) * lightColor;
143    }
144    
145    void PBR_ComputeDirectLight(vec3 normal, vec3 lightDir, vec3 viewDir,
146                                vec3 lightColor, float fZero, float roughness, float ndotv,
147                                out vec3 outDiffuse, out vec3 outSpecular){
148        // Compute halfway vector.
149        vec3 halfVec = normalize(lightDir + viewDir);
150    
151        // Compute ndotl, ndoth,  vdoth terms which are needed later.
152        float ndotl = max( dot(normal,   lightDir), 0.0);
153        float ndoth = max( dot(normal,   halfVec),  0.0);       
154        float hdotv = max( dot(viewDir,  halfVec),  0.0);
155    
156        // Compute diffuse using energy-conserving Lambert.
157        // Alternatively, use Oren-Nayar for really rough 
158        // materials or if you have lots of processing power ...
159        outDiffuse = vec3(ndotl) * lightColor;
160    
161        //cook-torrence, microfacet BRDF : http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
162       
163        float alpha = roughness * roughness;
164    
165        //D, GGX normaal Distribution function     
166        float alpha2 = alpha * alpha;
167        float sum  = ((ndoth * ndoth) * (alpha2 - 1.0) + 1.0);
168        float denom = PI * sum * sum;
169        float D = alpha2 / denom;  
170    
171        // Compute Fresnel function via Schlick's approximation.
172        float fresnel = fZero + ( 1.0 - fZero ) * pow( 2.0, (-5.55473 * hdotv - 6.98316) * hdotv);
173        
174        //G Shchlick GGX Gometry shadowing term,  k = alpha/2
175        float k = alpha * 0.5;
176    
177     /*   
178        //classic Schlick ggx
179        float G_V = ndotv / (ndotv * (1.0 - k) + k);
180        float G_L = ndotl / (ndotl * (1.0 - k) + k);
181        float G = ( G_V * G_L );
182        
183        float specular =(D* fresnel * G) /(4 * ndotv);
184       */
185     
186        // UE4 way to optimise shlick GGX Gometry shadowing term
187        //http://graphicrants.blogspot.co.uk/2013/08/specular-brdf-reference.html
188        float G_V = ndotv + sqrt( (ndotv - ndotv * k) * ndotv + k );
189        float G_L = ndotl + sqrt( (ndotl - ndotl * k) * ndotl + k );    
190        // the max here is to avoid division by 0 that may cause some small glitches.
191        float G = 1.0/max( G_V * G_L ,0.01); 
192    
193        float specular = D * fresnel * G * ndotl;  
194     
195        outSpecular = vec3(specular) * lightColor;
196    }
197    
198    //https://knarkowicz.wordpress.com/2014/12/27/analytical-dfg-term-for-ibl/
199    vec3 EnvDFGPolynomial( vec3 specularColor, float roughness, float ndotv ){
200        float x = 1.0 - roughness;
201        float y = ndotv;
202     
203        float b1 = -0.1688;
204        float b2 = 1.895;
205        float b3 = 0.9903;
206        float b4 = -4.853;
207        float b5 = 8.404;
208        float b6 = -5.069;
209        float bias = clamp( min( b1 * x + b2 * x * x, b3 + b4 * y + b5 * y * y + b6 * y * y * y ), 0.0, 1.0 );
210     
211        float d0 = 0.6045;
212        float d1 = 1.699;
213        float d2 = -0.5228;
214        float d3 = -3.603;
215        float d4 = 1.404;
216        float d5 = 0.1939;
217        float d6 = 2.661;
218        float delta = clamp(( d0 + d1 * x + d2 * y + d3 * x * x + d4 * x * y + d5 * y * y + d6 * x * x * x ), 0.0, 1.0);
219        float scale = delta - bias;
220     
221        bias *= clamp( 2.5 / (roughness) * specularColor.y, 0.0, 1.0 );
222        return specularColor * scale + bias;
223    }
224    
225    vec3 ApproximateSpecularIBL(samplerCube envMap,sampler2D integrateBRDF, vec3 SpecularColor , float Roughness, float ndotv, vec3 refVec){
226        //TODO magic values should be replaced by defines.
227        float Lod = log2(Roughness) * 1.1 + 6.0 - 2.0;
228        vec3 PrefilteredColor =  textureCubeLod(envMap, refVec.xyz,Lod).rgb;
229        vec2 EnvBRDF = texture2D(integrateBRDF,vec2(Roughness, ndotv)).rg;
230        return PrefilteredColor * ( SpecularColor * EnvBRDF.x+ EnvBRDF.y );    
231    }
232    
233    vec3 ApproximateSpecularIBLPolynomial(samplerCube envMap, vec3 SpecularColor , float Roughness, float ndotv, vec3 refVec){
234        //TODO magic values should be replaced by defines.
235        float Lod = log2(Roughness) * 1.5 + 6.0 - 1.0;
236        vec3 PrefilteredColor =  textureCubeLod(envMap, refVec.xyz, Lod).rgb;    
237        return PrefilteredColor * EnvDFGPolynomial(SpecularColor, Roughness, ndotv);
238    }
239    
240    
241    
242    
243    
244    // -- end import Common/ShaderLib/PBR.glsllib --
245    // -- begin import Common/ShaderLib/Lighting.glsllib --
246    /*Common function for light calculations*/
247    
248    
249    /*
250    * Computes light direction 
251    * lightType should be 0.0,1.0,2.0, repectively for Directional, point and spot lights.
252    * Outputs the light direction and the light half vector. 
253    */
254    void lightComputeDir(in vec3 worldPos, in float lightType, in vec4 position, out vec4 lightDir, out vec3 lightVec){
255        float posLight = step(0.5, lightType);    
256        vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight);
257        lightVec = tempVec;          
258        float dist = length(tempVec);
259    #ifdef SRGB
260        lightDir.w = (1.0 - position.w * dist) / (1.0 + position.w * dist * dist);
261        lightDir.w = clamp(lightDir.w, 1.0 - posLight, 1.0);
262    #else
263        lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0);
264    #endif
265        lightDir.xyz = tempVec / vec3(dist);
266    }
267    
268    /*
269    * Computes the spot falloff for a spotlight
270    */
271    float computeSpotFalloff(in vec4 lightDirection, in vec3 lightVector){
272        vec3 L=normalize(lightVector);
273        vec3 spotdir = normalize(lightDirection.xyz);
274        float curAngleCos = dot(-L, spotdir);    
275        float innerAngleCos = floor(lightDirection.w) * 0.001;
276        float outerAngleCos = fract(lightDirection.w);
277        float innerMinusOuter = innerAngleCos - outerAngleCos;
278        float falloff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, step(lightDirection.w, 0.001), 1.0);
279    
280    #ifdef SRGB
281        // Use quadratic falloff (notice the ^4)
282        return pow(clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0), 4.0);
283    #else
284        // Use linear falloff
285        return falloff;
286    #endif
287    }
288    
289    // -- end import Common/ShaderLib/Lighting.glsllib --
290    
291    varying vec2 texCoord;
292    #ifdef SEPARATE_TEXCOORD
293      varying vec2 texCoord2;
294    #endif
295    
296    varying vec4 Color;
297    
298    uniform vec4 g_LightData[NB_LIGHTS];
299    
300    uniform vec3 g_CameraPosition;
301    
302    uniform float m_Roughness;
303    uniform float m_Metallic;
304    
305    varying vec3 wPosition;    
306    
307    
308    //#ifdef INDIRECT_LIGHTING
309    //  uniform sampler2D m_IntegrateBRDF;
310      uniform samplerCube g_PrefEnvMap;
311      uniform samplerCube g_IrradianceMap;
312      uniform vec4 g_LightProbeData;
313    //#endif
314    
315    #ifdef BASECOLORMAP
316      uniform sampler2D m_BaseColorMap;
317    #endif
318    #ifdef METALLICMAP
319      uniform sampler2D m_MetallicMap;
320    #endif
321    #ifdef ROUGHNESSMAP
322      uniform sampler2D m_RoughnessMap;
323    #endif
324    
325    #ifdef EMISSIVE
326        uniform vec4 m_Emissive;
327    #endif
328    #ifdef EMISSIVEMAP
329        uniform sampler2D m_EmissiveMap;
330    #endif
331    #if defined(EMISSIVE) || defined(EMISSIVEMAP)
332        uniform float m_EmissivePower;
333        uniform float m_EmissiveIntensity;
334    #endif 
335    
336    #ifdef SPECGLOSSPIPELINE
337      uniform sampler2D m_SpecularMap;
338      uniform sampler2D m_GlossMap;
339    #endif
340    
341    #ifdef PARALLAXMAP
342      uniform sampler2D m_ParallaxMap;  
343    #endif
344    #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP)))
345        uniform float m_ParallaxHeight;
346    #endif
347    
348    #ifdef LIGHTMAP
349      uniform sampler2D m_LightMap;
350    #endif
351      
352    #if defined(NORMALMAP) || defined(PARALLAXMAP)
353      uniform sampler2D m_NormalMap;   
354      varying vec4 wTangent;
355    #endif
356    varying vec3 wNormal;
357    
358    #ifdef DISCARD_ALPHA
359    uniform float m_AlphaDiscardThreshold;
360    #endif
361    
362    void main(){
363        vec2 newTexCoord;
364        vec3 viewDir = normalize(g_CameraPosition - wPosition);
365    
366        #if defined(NORMALMAP) || defined(PARALLAXMAP)
367            mat3 tbnMat = mat3(wTangent.xyz, wTangent.w * cross( (wNormal), (wTangent.xyz)), wNormal.xyz);
368        #endif
369    
370        #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP)))
371           vec3 vViewDir =  viewDir * tbnMat;  
372           #ifdef STEEP_PARALLAX
373               #ifdef NORMALMAP_PARALLAX
374                   //parallax map is stored in the alpha channel of the normal map         
375                   newTexCoord = steepParallaxOffset(m_NormalMap, vViewDir, texCoord, m_ParallaxHeight);
376               #else
377                   //parallax map is a texture
378                   newTexCoord = steepParallaxOffset(m_ParallaxMap, vViewDir, texCoord, m_ParallaxHeight);         
379               #endif
380           #else
381               #ifdef NORMALMAP_PARALLAX
382                   //parallax map is stored in the alpha channel of the normal map         
383                   newTexCoord = classicParallaxOffset(m_NormalMap, vViewDir, texCoord, m_ParallaxHeight);
384               #else
385                   //parallax map is a texture
386                   newTexCoord = classicParallaxOffset(m_ParallaxMap, vViewDir, texCoord, m_ParallaxHeight);
387               #endif
388           #endif
389        #else
390           newTexCoord = texCoord;    
391        #endif
392        
393        #ifdef BASECOLORMAP
394            vec4 albedo = texture2D(m_BaseColorMap, newTexCoord);
395        #else
396            vec4 albedo = Color;
397        #endif
398        #ifdef ROUGHNESSMAP
399            float Roughness = texture2D(m_RoughnessMap, newTexCoord).r * max(m_Roughness, 1e-8);
400        #else
401            float Roughness =  max(m_Roughness, 1e-8);
402        #endif
403        #ifdef METALLICMAP   
404            float Metallic = texture2D(m_MetallicMap, newTexCoord).r;
405        #else
406            float Metallic =  max(m_Metallic, 0.0);
407        #endif
408     
409        float alpha = Color.a * albedo.a;
410    
411        #ifdef DISCARD_ALPHA
412            if(alpha < m_AlphaDiscardThreshold){
413                discard;
414            }
415        #endif
416     
417        // ***********************
418        // Read from textures
419        // ***********************
420        #if defined(NORMALMAP)
421          vec4 normalHeight = texture2D(m_NormalMap, newTexCoord);
422          //Note the -2.0 and -1.0. We invert the green channel of the normal map, 
423          //as it's complient with normal maps generated with blender.
424          //see http://hub.jmonkeyengine.org/forum/topic/parallax-mapping-fundamental-bug/#post-256898
425          //for more explanation.
426          vec3 normal = normalize((normalHeight.xyz * vec3(2.0,-2.0,2.0) - vec3(1.0,-1.0,1.0)));
427          normal = normalize(tbnMat * normal);
428          //normal = normalize(normal * inverse(tbnMat));
429        #else
430          vec3 normal = normalize(wNormal);            
431        #endif
432    
433       
434        #ifdef LIGHTMAP
435           vec3 lightMapColor;
436           #ifdef SEPARATE_TEXCOORD
437              lightMapColor = texture2D(m_LightMap, texCoord2).rgb;
438           #else
439              lightMapColor = texture2D(m_LightMap, texCoord).rgb;
440           #endif
441           specularColor.rgb *= lightMapColor;
442           albedo.rgb  *= lightMapColor;
443        #endif
444    
445        float specular = 0.5;
446        #ifdef SPECGLOSSPIPELINE
447              vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
448              vec4 diffuseColor = albedo;
449              Roughness = 1.0 - texture2D(m_GlossMap, newTexCoord).r;          
450        #else      
451            float nonMetalSpec = 0.08 * specular;
452            vec4 specularColor = (nonMetalSpec - nonMetalSpec * Metallic) + albedo * Metallic;
453            vec4 diffuseColor = albedo - albedo * Metallic;
454        #endif
455    
456        gl_FragColor.rgb = vec3(0.0);
457        float ndotv = max( dot( normal, viewDir ),0.0);
458        for( int i = 0;i < NB_LIGHTS; i+=3){
459            vec4 lightColor = g_LightData[i];
460            vec4 lightData1 = g_LightData[i+1];                
461            vec4 lightDir;
462            vec3 lightVec;            
463            lightComputeDir(wPosition, lightColor.w, lightData1, lightDir, lightVec);
464    
465            float fallOff = 1.0;
466            #if __VERSION__ >= 110
467                // allow use of control flow
468            if(lightColor.w > 1.0){
469            #endif
470                fallOff =  computeSpotFalloff(g_LightData[i+2], lightVec);
471            #if __VERSION__ >= 110
472            }
473            #endif
474            //point light attenuation
475            fallOff *= lightDir.w;
476    
477            lightDir.xyz = normalize(lightDir.xyz);            
478            vec3 directDiffuse;
479            vec3 directSpecular;
480            
481            PBR_ComputeDirectLight(normal, lightDir.xyz, viewDir,
482                                lightColor.rgb,specular, Roughness, ndotv,
483                                directDiffuse,  directSpecular);
484    
485            vec3 directLighting = diffuseColor.rgb *directDiffuse + directSpecular * specularColor.rgb;
486            
487            gl_FragColor.rgb += directLighting * fallOff;
488        }
489    
490        vec3 rv = reflect(-viewDir.xyz, normal.xyz);
491        //prallax fix for spherical bounds from https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
492        // g_LightProbeData.w is 1/probe radius, g_LightProbeData.xyz is the position of the lightProbe.
493        rv = g_LightProbeData.w * (wPosition - g_LightProbeData.xyz) +rv;
494    
495         //horizon fade from http://marmosetco.tumblr.com/post/81245981087
496        float horiz = dot(rv, wNormal.xyz);
497        float horizFadePower= 1.0 - Roughness;
498        horiz = clamp( 1.0 + horizFadePower * horiz, 0.0, 1.0 );
499        horiz *= horiz;
500    
501        vec3 indirectDiffuse = vec3(0.0);
502        vec3 indirectSpecular = vec3(0.0);    
503        indirectDiffuse = textureCube(g_IrradianceMap, normal.xyz).rgb * diffuseColor.rgb;
504    
505        indirectSpecular = ApproximateSpecularIBLPolynomial(g_PrefEnvMap, specularColor.rgb, Roughness, ndotv, rv.xyz);
506        indirectSpecular *= vec3(horiz);
507    
508        vec3 indirectLighting =  indirectDiffuse + indirectSpecular;
509    
510        gl_FragColor.rgb = gl_FragColor.rgb + indirectLighting * step( 0.0, g_LightProbeData.w);        
511     
512        #if defined(EMISSIVE) || defined (EMISSIVEMAP)
513            #ifdef EMISSIVEMAP
514                vec4 emissive = texture2D(m_EmissiveMap, newTexCoord);
515            #else
516                vec4 emissive = m_Emissive;
517            #endif
518            gl_FragColor += emissive * pow(emissive.a, m_EmissivePower) * m_EmissiveIntensity;
519        #endif
520               
521        gl_FragColor.a = alpha;
522        
523       
524    }

Jul 06, 2016 4:07:34 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/PBRLighting.frag, defines, type=Fragment, language=GLSL100]
0:228(63): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:228(68): error: type mismatch
0:236(64): error: no matching function for call to `textureCubeLod(samplerCube, vec3, float)'; candidates are:
0:236(69): error: type mismatch

    at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1200)
    at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1227)
    at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1291)
    at com.jme3.material.logic.SinglePassAndImageBasedLightingLogic.render(SinglePassAndImageBasedLightingLogic.java:225)
    at com.jme3.material.Technique.render(Technique.java:167)
    at com.jme3.material.Material.render(Material.java:970)
    at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:616)
    at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
    at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:305)
    at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:879)
    at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:781)
    at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1106)
    at com.jme3.renderer.RenderManager.render(RenderManager.java:1154)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
    at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
    at java.lang.Thread.run(Thread.java:745)

Am I finally forced to buy a good graficcard or is it just a minor problem in the shader? If I have to buy a new card what must I pay attention to to run PBR? Do you need any further information to debug the problem or can I help somehow?

Greetings

Did you change GLSL version in the j3md? NVM the reply is in the first log you posted.

That’s weird, textureCube and textureCubeLod are deprecated, but only since GLSL 1.5, and the shader is using GLSL 1.0 so it should work.
If you want, you can try to add this

#define textureCubeLod textureLod

at the start of the fragment shader, and see if in this way it works.

Thanks for the reply, but unfortunately it doesn’t change anything. And you are right. I didn’t changed the GLSL version.

Same identical error? It’s weird… it should change at least…did you paste it before everything? Before also the #imports ?

Oh sorry my fault. I added it behind the import statement.

But this function isn’t available too:

com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/PBRLighting.frag, defines, type=Fragment, language=GLSL100]
0:230(59): error: no matching function for call to `textureLod(samplerCube, vec3, float)'; candidates are:
0:230(64): error: type mismatch
0:238(60): error: no matching function for call to `textureLod(samplerCube, vec3, float)'; candidates are:
0:238(65): error: type mismatch

Ok, now try to do the same, but also change the GLSL version in the j3md with GLSL130

I played a bit with the version in the “Technique {…}” block. If I set it to 120 nothing changes and 140 isn’t supported by my hardware. But if I set it to 130 I can run TestPBREnv without problems. When I run TestPBRLighting the scene is rendered for some milliseconds until I get this Error:

Uncaught exception thrown in Thread[jME3 Main,5,main]
IllegalStateException: Framebuffer object format is unsupported by the video hardware.

/usr/lib/jvm/java-8-oracle/bin/java -ea [...] jme3test.light.pbr.TestPBRLighting
Jul 06, 2016 6:15:50 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.1-5740
 * Branch: master
 * Git Hash: 664ea53
 * Build Date: 2016-07-06
Jul 06, 2016 6:15:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFORMATION: LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Jul 06, 2016 6:15:50 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFORMATION: OpenGL Renderer Information
 * Vendor: Intel Open Source Technology Center
 * Renderer: Mesa DRI Intel(R) Ivybridge Desktop 
 * OpenGL Version: 3.0 Mesa 10.1.3
 * GLSL Version: 1.30
 * Profile: Compatibility
Jul 06, 2016 6:15:50 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Jul 06, 2016 6:15:50 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNUNG: Pausing audio device not supported.
Jul 06, 2016 6:15:50 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio effect extension version: 1.0
Jul 06, 2016 6:15:50 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio max auxiliary sends: 4
Jul 06, 2016 6:15:51 PM com.jme3.material.Material checkSetParam
WARNUNG: Material parameter being set: Texture with type Texture2D doesn't match definition types TextureCubeMap
Jul 06, 2016 6:15:51 PM com.jme3.material.Material setTextureParam
WARNUNG: The texture Textures/Sky/Path.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().
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreShadow':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PostShadow15':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PostShadow':
Define 'COLOR_MAP' mapped to non-existent material parameter 'ColorMap', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreNormalPass':
Define 'DIFFUSEMAP_ALPHA' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'PreNormalPassDerivative':
Define 'DIFFUSEMAP_ALPHA' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'MATERIAL_COLORS' mapped to non-existent material parameter 'UseMaterialColors', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'V_TANGENT' mapped to non-existent material parameter 'VTangent', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'MINNAERT' mapped to non-existent material parameter 'Minnaert', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'WARDISO' mapped to non-existent material parameter 'WardIso', ignoring.
Jul 06, 2016 6:15:51 PM com.jme3.material.plugins.J3MLoader readDefine
WARNUNG: In technique 'GBuf':
Define 'DIFFUSEMAP' mapped to non-existent material parameter 'DiffuseMap', ignoring.
Jul 06, 2016 6:15:53 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.IllegalStateException: Framebuffer object format is unsupported by the video hardware.
    at com.jme3.renderer.opengl.GLRenderer.checkFrameBufferError(GLRenderer.java:1414)
    at com.jme3.renderer.opengl.GLRenderer.updateFrameBuffer(GLRenderer.java:1590)
    at com.jme3.renderer.opengl.GLRenderer.setFrameBuffer(GLRenderer.java:1736)
    at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1081)
    at com.jme3.environment.EnvironmentCamera.render(EnvironmentCamera.java:184)
    at com.jme3.app.state.AppStateManager.render(AppStateManager.java:300)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:250)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
    at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
    at java.lang.Thread.run(Thread.java:745)

It doesn’t matter whether I add @RiccardoBlb’s line to the fragment shader or not.
Same things happen with the RefEnv test.

This is the code that “screenshot” the scene for calculating the envmaps required by the PBR.
What drivers are you using? Do you have any chance to replace them with official ones?

Otherwise you’ll need to find a way to calculate these maps somehow else, or on another machine.

I have the default i915 driver. But I’ll update soon with the Intel Grafics Installer when I find some time. Again thanks for your help!

I was able to solve the problem without upgrading my drivers. These posts contain the solution: