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

Image material flicker on Ellipsoid transform #9601

Open
dtcwee opened this issue Jun 8, 2021 · 2 comments
Open

Image material flicker on Ellipsoid transform #9601

dtcwee opened this issue Jun 8, 2021 · 2 comments

Comments

@dtcwee
Copy link

dtcwee commented Jun 8, 2021

Transforming an ellipsoid with an image material texture causes that texture to not display or, at slower transform rates, flicker.
scrnli_08_06_2021_14-34-44
Note:

  1. This issue does not affect boxes, and presumably does not affect simple geometries.
  2. The red sphere is animated by setInterval. Flicker is visible at each transform.
  3. The yellow ellipsoid actually has the same image material as the red ellipsoid. It is animated by a callback similar the blue box's. Its image material does not display at all.

I'm guessing that applying texture to ellipsoid is slow enough to be noticeable, or easily overridden by the next transform.

Sandcastle example based on Spheres and Ellipsoids:

var viewer = new Cesium.Viewer('cesiumContainer', {
      shouldAnimate: true,
    });
var bluePosition = Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0);
var redPosition = Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0);
var yellowPosition = Cesium.Cartesian3.fromDegrees(-100.0, 40.0, 300000.0);

function computeOrientation(position) {
      var timestamp = Cesium.JulianDate.toDate(viewer.clock.currentTime).getTime();
      var heading = Cesium.Math.toRadians(timestamp/100);
      var pitch = Cesium.Math.toRadians(0);
      var roll = 0;
      var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
      var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); 
      return orientation;
}

var blueBox = viewer.entities.add({
  name: "Blue box",
  position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
  orientation: new Cesium.CallbackProperty(function() {return computeOrientation(bluePosition);}, false),
  box: {
    dimensions: new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
    material: new Cesium.ImageMaterialProperty({
          image: "../images/Cesium_Logo_Color.jpg",
          color: Cesium.Color.BLUE,
          transparent: false,
    }),
  },
});



var redSphere = viewer.entities.add({
  name: "Red sphere with black outline",
  position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
  orientation: computeOrientation(redPosition),
  ellipsoid: {
    radii: new Cesium.Cartesian3(300000.0, 300000.0, 300000.0),
    material: new Cesium.ImageMaterialProperty({
          image: "../images/Cesium_Logo_Color.jpg",
          color: Cesium.Color.RED.withAlpha(0.75),
          transparent: false,
    }),
    outline: true,
    outlineColor: Cesium.Color.BLACK,
  },
});

    function setOrientation() {
     redSphere.orientation = computeOrientation(redPosition);     
    }
    setInterval(setOrientation, 500);

var outlineOnly = viewer.entities.add({
  name: "Yellow ellipsoid outline",
  position: yellowPosition,
  orientation: new Cesium.CallbackProperty(function() {return computeOrientation(yellowPosition);}, false),
  ellipsoid: {
    radii: new Cesium.Cartesian3(200000.0, 200000.0, 300000.0),
    material: new Cesium.ImageMaterialProperty({
          image: "../images/Cesium_Logo_Color.jpg",
          color: Cesium.Color.YELLOW.withAlpha(0.5),
          transparent: false,
    }),
    outline: true,
    outlineColor: Cesium.Color.BLACK,
    slicePartitions: 24,
    stackPartitions: 36,
  },
});

viewer.zoomTo(viewer.entities);

Browser: Firefox 89, Chrome 91

Operating System: Win 10 64 bit

@ebogo1
Copy link
Contributor

ebogo1 commented Jun 8, 2021

Thanks @dtcwee, this definitely looks like a bug. I can replicate the behavior on macOS as well.

For convenience, here's the above code in a Sandcastle.

@ggetz
Copy link
Contributor

ggetz commented Mar 2, 2023

Also reported in #11123.

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

3 participants