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

Can we reduce polyline smears on steep slopes? #6691

Open
likangning93 opened this issue Jun 14, 2018 · 1 comment
Open

Can we reduce polyline smears on steep slopes? #6691

likangning93 opened this issue Jun 14, 2018 · 1 comment

Comments

@likangning93
Copy link
Contributor

Polylines on terrain smear on steep slopes, since it's similar to a shadow volume:

smear

var viewer = new Cesium.Viewer('cesiumContainer');

var positions = Cesium.Cartesian3.fromDegreesArray([
    -122.17580380403314, 46.19984918190237,
    -122.17671567204553, 46.196577275143326,
    -122.17190167749244, 46.19583668275485
]);

viewer.entities.add({
    polyline : {
        positions : positions,
        width : 32,
        material : new Cesium.PolylineGlowMaterialProperty({
            glowPower : 0.2,
            color : Cesium.Color.BLUE
        }),
        clampToGround : true
    }
});

viewer.camera.lookAt(positions[0], new Cesium.Cartesian3(0.0, 0.0, 5000.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

(Note that this won't work until #6689 is merged)

We compute local terrain slopes for materials on ground primitives using the globe depth texture (this is something like screen-space partial derivatives), so I wonder if we could use these to help reduce smear.

Currently the algorithm for determining if a fragment is part of the polyline checks the distance between the fragment's position (derived from globe depth texture) and a plane, but if we had a local terrain slope we could do a ray-plane check instead of point-plane distance.

In addition to effectiveness we'd also want to evaluate the performance hit for this. Since it's much less noticeable for narrower lines, maybe it can be a toggleable option if it's too slow.

See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/ShadowVolumeAppearanceFS.glsl#L28

@likangning93
Copy link
Contributor Author

likangning93 commented Jun 29, 2018

Hm. On a second reading, turns out "Deferred Vector Map Visualization" does this already. Yay! Not such unknown waters after all.

[EDIT] actually, it's a newer version of the paper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants