Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't apply tonemapping for unlit material #8128

Merged
merged 3 commits into from
Sep 3, 2019
Merged

Don't apply tonemapping for unlit material #8128

merged 3 commits into from
Sep 3, 2019

Conversation

OmarShehata
Copy link
Contributor

@OmarShehata OmarShehata commented Sep 3, 2019

This PR skips the LINEARtoSRGB if the material is unlit. This seemed like a simpler approach than changing the LINEARtoSRGB function to be a no-op for unlit materials. @lilleyse let me know if you agree with this approach.

This also fixes the 2nd failing unit test (from #8127) by just updating the color.

You can test that this correctly renders an unlit material with:

var viewer = new Cesium.Viewer('cesiumContainer', {
    infoBox : false,
    selectionIndicator : false,
    shadows : true,
    shouldAnimate : true
});

//viewer.scene.highDynamicRange = true;

function createModel(url, height) {
    viewer.entities.removeAll();

    var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
    var heading = Cesium.Math.toRadians(135);
    var pitch = 0;
    var roll = 0;
    var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
    var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

    var entity = viewer.entities.add({
        name : url,
        position : position,
        orientation : orientation,
        model : {
            uri : url,
            minimumPixelSize : 128,
            maximumScale : 20000
        }
    });
    viewer.trackedEntity = entity;
}

createModel('../../../Specs/Data/Models/PBR/BoxUnlit/BoxUnlit.gltf', 5000.0);

I used the browser's color picker to verify it is indeed the green base color.

@cesium-concierge
Copy link

Thanks for the pull request @OmarShehata!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@mramato
Copy link
Contributor

mramato commented Sep 3, 2019

@lilleyse please review/merge ASAP so we can get the release out.

@lilleyse
Copy link
Contributor

lilleyse commented Sep 3, 2019

The linear to SRGB conversion still needs to be applied. Only the tonemapping portion should be skipped if unlit.

This branch (with hdr off by default)
Selection_272

1.60 with HDR off
Selection_271

@lilleyse
Copy link
Contributor

lilleyse commented Sep 3, 2019

I'm working on a fix...

@lilleyse
Copy link
Contributor

lilleyse commented Sep 3, 2019

Hm just realized that this tileset is not using the unlit extension. I'll have to open a separate issue for that.

@lilleyse
Copy link
Contributor

lilleyse commented Sep 3, 2019

My changes are up. I'll open a separate PR for AGI HQ updates.

@OmarShehata OmarShehata merged commit f999167 into master Sep 3, 2019
@OmarShehata OmarShehata deleted the unlit branch September 3, 2019 18:16
@lilleyse lilleyse mentioned this pull request Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants