Open dakotalraymond opened 6 years ago
@dakotalraymond can you please paste some sample code to reproduce this? Thanks!
@dakotalraymond can you please paste some sample code to reproduce this? Thanks!
Sure thing
Here's a visually interesting example
var redEllipse = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(0.0, 0.0),
name : 'Red ellipse on surface',
ellipse : {
semiMajorAxis : 40000000.0,
semiMinorAxis : 4000000.0,
material : Cesium.Color.RED.withAlpha(0.5)
}
});
viewer.zoomTo(viewer.entities);
Thanks @dakotalraymond, @GatorScott
There are a few different problems here
splitLongitude
is causing artifacts across the north polesemiMajorAxis
is too wide, the end points are incorrectThanks for the height tip @dakotalraymond
For 3D mode I tried to see how much globe I could cover with an ellipse before undesirable effects started to occur.
This is what I got to:
var viewer = new Cesium.Viewer('cesiumContainer');
var redEllipse = viewer.entities.add({ position: Cesium.Cartesian3.fromDegrees(3.0, 50.0), name : 'Red ellipse on surface', ellipse : { semiMinorAxis : 9100000.0, semiMajorAxis : 9100000.0, material : Cesium.Color.RED.withAlpha(0.5), height:1, granularity:((Math.PI / 180.0)/32)
} });
viewer.zoomTo(viewer.entities);
Near 10000000.0 meters it breaks down completely even with the height trick, I assume because it's crossed the halfway point of the ellipsoid.
If you set the material to 0 alpha though the outline will still draw as expected, it's the fill that fails.
I believe the error is in CircleGeometry.createShadowVolume
and EllipseGeometry.createShadowVolume
Those take a granularity option documented as
* @param {Number} [options.granularity=0.02] The angular distance between points on the circle in radians.
but the other geometry types specify granularity as
* @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
The getMinHeight
and getMaxHeight
are expecting the latter, but CircleGeometry.createShadowVolume
and EllipseGeometry.createShadowVolume
don't do anything to convert.
Also reported in https://github.com/CesiumGS/cesium/issues/11438
Shadow volume rendering artifacts also reported for Rectangles in https://github.com/CesiumGS/cesium/issues/11537.
When drawing very large ellipses, there are visual errors, particularly in 2d mode. Some areas are missing and others get drawn twice. You can see this by visiting the Circles and Ellipses sandcastle and setting a semiMinorAxis and semiMajorAxis to 5000000 or greater. It seems to make it worse if they are very far north. (see screenshots). You can fix the 3d by adding a little height to it, but it doesn't help the 2d projection.
Here is code to reproduce the error:
var viewer = new Cesium.Viewer('cesiumContainer');
var redEllipse = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-103.0, 80.0),
name : 'Red ellipse on surface',
ellipse : {
semiMinorAxis : 6000000.0,
semiMajorAxis : 6000000.0,
material : Cesium.Color.RED.withAlpha(0.5)
}
});