[iTowns-user] Unwanted culling when rotating globe

Terek Campbell terekc at gmail.com
Wed Aug 7 07:03:29 PDT 2019


Thanks for the responses!

In my case I think I need the actual globe to rotate as I have a number of
satellites orbiting the globe and in order to keep their correct location
over time, the globe must rotate as well.

I have a toggle between ECI
<https://en.wikipedia.org/wiki/Earth-centered_inertial> and ECEF
<https://en.wikipedia.org/wiki/ECEF> coordinate frames. When zoomed out and
having ECI selected I'd like to see the globe rotating along with the
satellites around it.

Upon zooming the camera in past a certain threshold, the scene will switch
to the ECEF frame so that you're able to actually see what you're zooming
into rather than having the earth fly past beneath you.

I'm open to other solutions if you have them. Let me know if you have any
thoughts!

~Terek Campbell


On Wed, Aug 7, 2019 at 3:02 AM Adrien Berthet <Adrien.Berthet at ign.fr> wrote:

> 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>
> 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] de la part de
>> Terek Campbell [terekc at gmail.com]
>> *Envoyé :* lundi 5 août 2019 23:35
>> *À :* 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/b85713a2/attachment-0001.html>


More information about the ITowns-user mailing list