Skip to content

3.2 Core profile renders some PBR materials darker than Compatibility profile #1903

@stephengold

Description

@stephengold

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:
Core

Here's how it renders with Compatibility profile:
Compatibility

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions