question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RendererException in PBRTerrain.frag

See original GitHub issue

5th generation Mac Mini (Apple Silicon) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode) JME v3.5 branch

The “HelloMav” application crashes with the message is “ERROR: ‘’ 0:1306: : syntax error: preprocessor command must not be preceded by any other statement in that line”. Googling that message led me to https://stackoverflow.com/questions/9574919/webgl-differs-from-opengl-preprocessor-on-same-graphics-stack

My conclusion: “PBRTerrain.frag” uses the ## operator in 20+ places, but that operator isn’t supported in some versions of GLSL.

GitHub won’t allow me to post the full console output. Here’s a redacted version:

Mar 18, 2022 3:11:41 PM com.jme3.renderer.opengl.GLRenderer updateShaderSourceData
WARNING: Bad compile of:
1       #version 110
2       #define SRGB 1
3       #define FRAGMENT_SHADER 1
4       #define TRI_PLANAR_MAPPING 1
5       #define ALBEDOMAP_0 1
6       #define ALBEDOMAP_1 1
7       #define ALBEDOMAP_2 1
8       #define ALBEDOMAP_3 1
9       #define ALBEDOMAP_4 1
10      #define ALBEDOMAP_5 1
11      #define ALBEDOMAP_6 1
12      #define ALPHAMAP 1
13      #define ALPHAMAP_1 1
14      #define ALBEDOMAP_0_SCALE 0.1
15      #define ALBEDOMAP_1_SCALE 0.05
16      #define ALBEDOMAP_2_SCALE 0.1
17      #define ALBEDOMAP_3_SCALE 0.1
18      #define ALBEDOMAP_4_SCALE 0.3
19      #define ALBEDOMAP_5_SCALE 0.1
20      #define ALBEDOMAP_6_SCALE 0.5
21      #define DEBUG_VALUES_MODE 0
22      #define SINGLE_PASS_LIGHTING 1
23      #define NB_LIGHTS 3
24      #define NB_PROBES 1
25      #define USE_AMBIENT_LIGHT 1
26      #extension GL_ARB_shader_texture_lod : enable
27      // -- begin import Common/ShaderLib/GLSLCompat.glsllib --
28      #if defined GL_ES

1301        #ifdef ALBEDOMAP_0   
1302                        //NOTE! the old (phong) terrain shaders do not have an "_0" for the first diffuse map, it is just "DiffuseMap"
1303            #ifdef NORMALMAP_0
1304                BLEND_NORMAL(_0,  alphaBlend.r)
1305            #else
1306                BLEND(_0,  alphaBlend.r)
1307            #endif
1308            
1309        #endif
1310        #ifdef ALBEDOMAP_1
1311            #ifdef NORMALMAP_1
1312                BLEND_NORMAL(_1,  alphaBlend.g)
1313            #else
1314                BLEND(_1,  alphaBlend.g)
1315            #endif

1934            
1935        #endif
1936        
1937        gl_FragColor.a = albedo.a;
1938    
1939    }

Mar 18, 2022 3:11:41 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Terrain/PBRTerrain.frag, defines, type=Fragment, language=GLSL100]
ERROR: 0:1306: '' : syntax error: preprocessor command must not be preceded by any other statement in that line
ERROR: 0:1306: 'premature EOF' : syntax error syntax error

        at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1539)
        at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1566)
        at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1631)
        at com.jme3.material.logic.SinglePassAndImageBasedLightingLogic.render(SinglePassAndImageBasedLightingLogic.java:276)
        at com.jme3.material.Technique.render(Technique.java:167)
        at com.jme3.material.Material.render(Material.java:1052)
        at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:651)
        at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:273)
        at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:312)
        at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:928)
        at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:823)
        at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1184)
        at com.jme3.renderer.RenderManager.render(RenderManager.java:1248)
        at com.jme3.app.SimpleApplication.update(SimpleApplication.java:278)
        at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:580)
        at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:669)
        at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:493)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:490)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:442)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:126)
        at com.jayfella.jme.vehicle.simpledemo.HelloMav.main(HelloMav.java:104)

[JME ERROR] Uncaught exception thrown in Thread[jME3 Main,5,main]
RendererException: compile error in: ShaderSource[name=Common/MatDefs/Terrain/PBRTerrain.frag, defines, type=Fragment, language=GLSL100]
ERROR: 0:1306: '' : syntax error: preprocessor command must not be preceded by any other statement in that line
ERROR: 0:1306: 'premature EOF' : syntax error syntax error

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
stephengoldcommented, Apr 3, 2022

I agree that if there’s ever a JMonkeyEngine 3.6 release, then PR #1758 and the fix for this issue should be included.

As long as the fix for this issue is integrated into “master” branch before the 3.6 code freeze, I don’t foresee any difficulty.

Currently there’s no 3.6 release scheduled, so I don’t know when code freeze will occur. My best guess would be summer of 2022.

1reaction
riccardoblcommented, Apr 3, 2022

Asking @stephengold since he is managing jme3.x releases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · jMonkeyEngine/jmonkeyengine - GitHub
RendererException in PBRTerrain.frag bug ...
Read more >
Terrain normalmap - graphics - jMonkeyEngine Hub
RendererException: compile error in: ShaderSource[name=MatDefs/PBRTerrain/terrainPBRShader.frag, defines, type=Fragment, language=GLSL150]
Read more >
Stephen Gold issues - Git Memory
RendererException in PBRTerrain.frag ... 5th generation Mac Mini (Apple Silicon) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode) JME v3.5 ...
Read more >
How to adjust the label when cutting and interpolate image In the ...
RendererException in PBRTerrain.frag, 7, 2022-03-18, 2022-08-07. RendererException in TerrainLighting.frag, 15, 2022-03-08, 2022-08-07.
Read more >
[ArgoCD] server.config.url is not optional and must ... - IssueHint
Issue Title Created Date Comment Count Updated Date Pay for documentation website hosting! 0 2022‑04‑19 2022‑09‑17 Not maintained anymore? 1 2018‑01‑11 2022‑09‑17 NixOS Reproducibility Community Dashboard...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found