[iTowns-user] Unwanted culling when rotating globe

Adrien Berthet Adrien.Berthet at ign.fr
Wed Aug 7 02:02:52 PDT 2019


Thanks !

So what you got wrong is that you are moving the globe, when you should be moving the camera.

Here's a quick thing you can do for example, using the controls lookAtCoordinate method:
let target = view.controls.getLookAtCoordinate();
setInterval(() => {
    target.x = (target.x + 180+ 0.5) % 360 - 180;
    globe.controls.lookAtCoordinate({ coord: target }, false);
    globe.notifyChange();
}, 100);
More information here http://www.itowns-project.org/itowns/docs/#api/Controls/GlobeControls and here http://www.itowns-project.org/itowns/docs/#api/Controls/CameraUtils

________________________________
De : Terek Campbell [terekc at gmail.com]
Envoyé : mercredi 7 août 2019 01:07
À : Adrien Berthet
Cc : itowns-user at lists.osgeo.org
Objet : Re: [iTowns-user] Unwanted culling when rotating globe

Here's a bit larger snippet with most of my iTowns related code:

  private initGlobeView(sceneDiv) {
    const position = new Coordinates("WGS84", 2.351323, 48.856712, 25e6);

    this.view = new GlobeView(sceneDiv, position, {
      scene3D: this.scene,
      renderer: this.renderer
    });

    const globeLayer = this.view.getLayerById("globe");
    const globe = globeLayer.object3d;

    this.view.addFrameRequester(MAIN_LOOP_EVENTS.UPDATE_START, () => {
      globe.rotation.z = this.globals.getSceneRotation();
    });

    Fetcher.json("../../../assets/layers/JSONLayers/Ortho.json").then(config => this.addColorLayerFromConfig(config));
    Fetcher.json("../../../assets/layers/JSONLayers/WORLD_DTM.json").then(config => this.addElevationLayerFromConfig(config));
    Fetcher.json("../../../assets/layers/JSONLayers/IGN_MNT_HIGHRES.json").then(config => this.addElevationLayerFromConfig(config));
  }

I'll note that overwriting the culling function like so
    globeLayer.culling = () => {};
does resolve my problem, but then I'm losing out on culling altogether. I'd like it to still do the culling, just have it properly cull despite the rotating earth.

I think the problem is that worldToScaledEllipsoid in iTowns GlobeLayer.js is not being updated and thus in GlobeLayer.js's preUpdate function the cameraPosition variable isn't being set correctly, but that's just speculation. I don't quite understand how all the parts are working together yet.


~Terek Campbell


On Tue, Aug 6, 2019 at 1:01 AM Adrien Berthet <Adrien.Berthet at ign.fr<mailto:Adrien.Berthet at ign.fr>> wrote:
Hello Terek,

Could you share a more independent example ? I'm not sure what is the `globe` variable here, that's why it may cause some odd culling.

Thanks

Adrien
________________________________
De : ITowns-user [itowns-user-bounces at lists.osgeo.org<mailto:itowns-user-bounces at lists.osgeo.org>] de la part de Terek Campbell [terekc at gmail.com<mailto:terekc at gmail.com>]
Envoyé : lundi 5 août 2019 23:35
À : itowns-user at lists.osgeo.org<mailto:itowns-user at lists.osgeo.org>
Objet : [iTowns-user] Unwanted culling when rotating globe

Hey all,

I’m attempting to rotate the globe over time via the following code:

    this.view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_CAMERA_UPDATE, () => {
      globe.rotation.z = this.globals.getTotalRotation();
      this.view.notifyChange();
    });

However, I’m seeing odd culling once it starts rotating as in the attached screenshot. How can I prevent this?

~Terek Campbell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/itowns-user/attachments/20190807/41a79ac6/attachment.html>


More information about the ITowns-user mailing list