-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
perPositionHeight reversed material #7185
Comments
Perhaps the normals are wrong? @hpinkos any ideas? |
Not sure what's going wrong. It shows up correctly using the primitive API and backwards using the entity API. I'll have to take a closer look to see where the difference is. It also shows up the correct way if you move the polygon to the western hemisphere. This is the code I was testing with. var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var positions = Cesium.Cartesian3.fromDegreesArrayHeights([
110,30,0,
110,40,0,
120,40,0,
120,30,0]);
var primitive = scene.primitives.add(new Cesium.Primitive({
geometryInstances : [new Cesium.GeometryInstance({
geometry : Cesium.PolygonGeometry.fromPositions({
positions : positions,
vertexFormat : Cesium.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,
perPositionHeight : true
})
})],
appearance : new Cesium.MaterialAppearance({
material : Cesium.Material.fromType('Image', {
image: '../images/Cesium_Logo_Color.jpg'
}),
closed : false,
translucent : false
})
}));
var entity = viewer.entities.add({
polygon: {
hierarchy: positions,
material: '../images/Cesium_Logo_Color.jpg',
perPositionHeight: true,
show: false
}
});
var showPrimitive = true;
Sandcastle.addToolbarButton('toggle', function() {
showPrimitive = !showPrimitive;
primitive.show = showPrimitive;
entity.polygon.show = !showPrimitive;
}); |
Even happens when the geometry is dynamic: hierarchy: Change the entity positions in your example to
So something specific to creating the geometry instance maybe? |
Figured it out, the entity version is using Here's an updated example showing the primitive issue as well: var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var positions = new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights([
110,30,0,
110,40,0,
120,40,0,
120,30,0]));
var primitive = scene.primitives.add(new Cesium.Primitive({
geometryInstances : [new Cesium.GeometryInstance({
geometry : new Cesium.CoplanarPolygonGeometry({
polygonHierarchy : positions,
vertexFormat : Cesium.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,
perPositionHeight : true
})
})],
appearance : new Cesium.MaterialAppearance({
material : Cesium.Material.fromType('Image', {
image: '../images/Cesium_Logo_Color.jpg'
}),
closed : false,
translucent : false
})
}));
var entity = viewer.entities.add({
polygon: {
hierarchy: positions,
material: '../images/Cesium_Logo_Color.jpg',
perPositionHeight: true,
show: true
}
});
var showPrimitive = true;
Sandcastle.addToolbarButton('toggle', function() {
showPrimitive = !showPrimitive;
primitive.show = showPrimitive;
entity.polygon.show = !showPrimitive;
viewer.zoomTo(entity);
}); |
Oh right. I'm not sure I would necessarily call this a bug because the orientation of |
Shouldn't the winding order of the vertices determine which direction the polygon is facing? That way the user in this case has control over it as opposed to having to deal with that Cesium guesses. |
Should treat like any other polygon and use winding order to define "front". Maybe I want to display something in the sky viewed from near the surface of the planet. |
Winding order is likely why the polygon in the eastern hemisphere was backwards but if you negated the longitude values to put it in the western hemisphere it was forwards. Cesium uses counter-clockwise rotation for polygon positions and the input positions from that sample are clockwise. However, our I suppose I could put this behind a flag if someone using the |
Upon taking a closer look at the code, |
Congratulations on closing the issue! I found these Cesium forum links in the comments above: https://groups.google.com/d/msg/cesium-dev/CSQeUtcSj_4/_ridnkKxCAAJ If this issue affects any of these threads, please post a comment like the following:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
In this Sandcastle, you can see the video is reversed. If you set
perPositionHeight
to false, it's correct.I'm not sure why. Came up on the forum.
The text was updated successfully, but these errors were encountered: