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

The overlapping geometry show mix color if two geometries intersect #5903

Closed
heavis opened this issue Oct 12, 2017 · 3 comments
Closed

The overlapping geometry show mix color if two geometries intersect #5903

heavis opened this issue Oct 12, 2017 · 3 comments

Comments

@heavis
Copy link

heavis commented Oct 12, 2017

Two intersected geometries show on map, set color to 'YELLOW' and 'BLUE'. The overlapping part showing color neither YELLOW nor BLUE. But I hope the overlapping part show the top YELLOW color. similar geometries can be shown normally by Openlayers.

@ggetz
Copy link
Contributor

ggetz commented Oct 12, 2017

Hi @heavis, thanks for the bug report. Could you maybe put together an example using Sandcastle to show when this occurs?

@hpinkos
Copy link
Contributor

hpinkos commented Oct 12, 2017

@heavis Cesium uses order independent translucency by default, so colors that are translucent will be blended. You can try disabling this to see if it gives you the effect you want. Here is an example:

var viewer = new Cesium.Viewer('cesiumContainer', {
    orderIndependentTranslucency: false
});
var entities = viewer.entities;

entities.add({
    polygon: {
		hierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
                -58.0, 10.0,
                -50.0, 27.0,
                -50.0, 32.0,
                -58.0, 30.0
            ])),
		material : Cesium.Color.fromRandom({alpha : 0.8}),
		height: 0
    }
});

entities.add({
    polygon: {
		hierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
                -59.0, 10.0,
                -51.0, 18.0,
                -51.0, 40.0,
                -59.0, 41.0
            ])),
		material : Cesium.Color.fromRandom({alpha : 0.8}),
		height: 0
    }
});

viewer.zoomTo(viewer.entities);

Cesium unfortunately does not have support for z-ordering so there isn't a way to specify which geometry renders on top of the other. We have an issue written up here to add that feature: #4108

In the future, please report things like this on our forum and someone will be able to help: https://groups.google.com/forum/?hl=en#!forum/cesium-dev
Thanks!

@hpinkos hpinkos closed this as completed Oct 12, 2017
@mramato
Copy link
Contributor

mramato commented Oct 12, 2017

@hpinkos is only half right. The Entity API does not support z-ordering, but GroundPrimitive does. Disabling IOT will have no affect here if the goal is to have one opaque geoemtry render completely on top of another opaque geometry.

This probably is much harder in 3D than 2D (where you can literally just draw on top of the lower one). If you are not using terrain, you can set a small height offset to achieve the desired effect in some cases as well (but this won't work with terrain).

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

No branches or pull requests

4 participants