jMonkeyEngine / jMonkeyEngine/jmonkeyengine
3.2 Core profile renders some PBR materials darker than Compatibility profile
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
I recently discovered this issue recently in JME 3.6.0-alpha1 and created a test case.
Here's how it renders with the 3.2 Core profile:

Here's how it renders with Compatibility profile:

Here's the test-case java:
/**
* Reproduces an issue where PBR materials render much darker with the Core 3.2
* profile than with the Compatibility profile.
*
* <p>
* This test also uses 4 textures (AO, Diffuse, GL Normal, and Rough), all at 2K
* resolution in PNG format, which can be downloaded from
* https://polyhaven.com/a/marble_01 and unpacked to the
* src/main/resources/marble_01/textures directory.
*
* <p>
* This test also uses a precomputed light probe which can be obtained from
* https://github.com/stephengold/jme-vehicles/blob/master/MavCommon/src/main/resources/Textures/skies/moon/probe-day.j3o
* and saved to the src/main/resources directory.
*/
public class TestIssue extends SimpleApplication {
public static void main(String[] args) {
boolean loadDefaults = true;
AppSettings appSettings = new AppSettings(loadDefaults);
appSettings.setGammaCorrection(true);
// appSettings.setRenderer(AppSettings.LWJGL_OPENGL2); // to test Compatibility profile
appSettings.setRenderer(AppSettings.LWJGL_OPENGL32); // to test Core 3.2 profile
TestIssue application = new TestIssue();
application.setSettings(appSettings);
application.start();
}
@Override
public void simpleInitApp() {
flyCam.setDragToRotate(true);
// Attach a 9x9 quad at the origin.
Mesh mesh = new CenterQuad(9f, 9f);
Geometry quad = new Geometry("quad", mesh);
rootNode.attachChild(quad);
// Apply a PBR material to the quad.
String materialAssetPath = "marble_01.j3m";
Material material = assetManager.loadMaterial(materialAssetPath);
quad.setMaterial(material);
// Add a LightProbe.
String probeAssetPath = "probe-day.j3o";
LightProbe probe = (LightProbe) assetManager.loadAsset(probeAssetPath);
rootNode.addLight(probe);
}
}
Here's the "marble_01.j3m" material for the test case:
Material marble_01: /Common/MatDefs/Light/PBRLighting.j3md {
MaterialParameters {
BaseColor: 1.4 1.4 1.4 1
BaseColorMap: Repeat marble_01/textures/marble_01_diff_2k.png
LightMap: Repeat marble_01/textures/marble_01_ao_2k.png
LightMapAsAOMap: true
Metallic: 0.01
NormalMap: Repeat marble_01/textures/marble_01_nor_gl_2k.png
NormalType: 1
RoughnessMap: Repeat marble_01/textures/marble_01_rough_2k.png
}
AdditionalRenderState {
FaceCull Off
}
}
My configuration: x86_64 Mint Linux 21.1 (Ubuntu 5.15.0-57-generic) single monitor
Jan 10, 2023 11:18:25 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-SNAPSHOT
* Branch: master
* Git Hash: b0bd1a5
* Build Date: 2023-01-10
Jan 10, 2023 11:18:26 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
* Graphics Adapter: null
* Driver Version: null
* Scaling Factor: 1
Jan 10, 2023 11:18:26 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: NVIDIA Corporation
* Renderer: GeForce GT 545/PCIe/SSE2
* OpenGL Version: 3.2.0 NVIDIA 390.157
* GLSL Version: 1.50 NVIDIA via Cg compiler
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TestIssue entry point, the marble_01.j3m material, and the /Common/MatDefs/Light/PBRLighting.j3md definition. Run the reproducer with LWJGL_OPENGL32 and LWJGL_OPENGL2, using the listed textures and light probe, then trace the PBR rendering paths to find why the Core profile differs. Done means the supplied PBR case no longer renders darker under Core 3.2.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100