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

Billboard depth testing performance improvements #6781

Merged
merged 6 commits into from
Jul 10, 2018
Merged

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Jul 6, 2018

Fixes #6699

Moves the billboard depth test logic to the vertex shader when texture reads from the vertex shader are supported. Otherwise it falls back to doing the depth test in the fragment shader.

@cesium-concierge
Copy link

Thanks for the pull request @hpinkos!

  • ✔️ 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.

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@hpinkos
Copy link
Contributor Author

hpinkos commented Jul 6, 2018

@bagnell can you review?

@hpinkos
Copy link
Contributor Author

hpinkos commented Jul 6, 2018

Here's the sample code from my last PR:

var viewer = new Cesium.Viewer('cesiumContainer', {
    terrainProvider: Cesium.createWorldTerrain()
});
viewer.scene.globe.depthTestAgainstTerrain = true;

var e = viewer.entities.add({
    position : Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
    billboard : {
        image : '../images/Cesium_Logo_overlay.png',
        heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM
    }
});

viewer.trackedEntity = e;
var viewer = new Cesium.Viewer('cesiumContainer', {
    terrainProvider: Cesium.createWorldTerrain()
});
viewer.scene.globe.depthTestAgainstTerrain = true;

var e = viewer.entities.add({
    position : Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
     label : {
        text : 'Clamped to ground',
        heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
        horizontalOrigin : Cesium.HorizontalOrigin.CENTER,
        verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
        fillColor : Cesium.Color.BLACK,
        showBackground : true,
        backgroundColor : new Cesium.Color(1, 1, 1, 0.7),
        backgroundPadding : new Cesium.Cartesian2(8, 4)
    }
});

viewer.trackedEntity = e;

@bagnell
Copy link
Contributor

bagnell commented Jul 6, 2018

When the origin is the top right, it seems like it is only depth testing that point. You can see that the top left is not behind any terrain.
billboard_depth_test_top_right

@hpinkos
Copy link
Contributor Author

hpinkos commented Jul 10, 2018

Thanks @bagnell, I think this is ready now

@bagnell
Copy link
Contributor

bagnell commented Jul 10, 2018

@hpinkos Just had some formatting changes in ce49ae9. Everything else looks good. Thanks!

@bagnell bagnell merged commit 69b3e9d into master Jul 10, 2018
@bagnell bagnell deleted the billboard-depth-vs branch July 10, 2018 19:50
@hpinkos hpinkos restored the billboard-depth-vs branch July 23, 2018 19:28
@hpinkos hpinkos deleted the billboard-depth-vs branch July 23, 2018 19:47
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.

3 participants