<div dir="ltr">Sounds like a good solution to me, thanks!<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div> </div>
<div>~Terek Campbell</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 8:21 AM Adrien Berthet <<a href="mailto:Adrien.Berthet@ign.fr">Adrien.Berthet@ign.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Helvetica;color:rgb(0,0,0);font-size:10pt">
<div>I see the problem then ! You need to rewrite the culling function then. To do this, simply write
<font face="Courier New">globeLayer.culling = (node) => { ... });</font> in the appropriate place.<br>
</div>
<div><br>
</div>
<div>The current culling works with the camera position (<font face="Courier New">cameraPosition</font>), so you only need to find the correct vector to replace this. Also mind that the first bit of the function (<font face="Courier New">super.culling</font>)
may need to be removed/replaced as it is using <font face="Courier New">camera</font> as well.<br>
</div>
<div><br>
</div>
<div><a href="https://github.com/iTowns/itowns/blob/master/src/Core/Prefab/Globe/GlobeLayer.js#L110-L128" target="_blank">https://github.com/iTowns/itowns/blob/master/src/Core/Prefab/Globe/GlobeLayer.js#L110-L128</a></div>
<div><br>
</div>
<div>Hope it helps.<br>
</div>
<div><br>
</div>
<div style="font-family:"Times New Roman";color:rgb(0,0,0);font-size:16px">
<hr>
<div id="gmail-m_-8097101857672350656divRpF968137" style="direction:ltr"><font size="2" face="Tahoma" color="#000000"><b>De :</b> Terek Campbell [<a href="mailto:terekc@gmail.com" target="_blank">terekc@gmail.com</a>]<br>
<b>Envoyé :</b> mercredi 7 août 2019 16:03<br>
<b>À :</b> Adrien Berthet<br>
<b>Cc :</b> <a href="mailto:itowns-user@lists.osgeo.org" target="_blank">itowns-user@lists.osgeo.org</a><br>
<b>Objet :</b> Re: [iTowns-user] Unwanted culling when rotating globe<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Thanks for the responses!
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>I have a toggle between <a href="https://en.wikipedia.org/wiki/Earth-centered_inertial" rel="noopener noreferrer" target="_blank">
ECI</a> and <a href="https://en.wikipedia.org/wiki/ECEF" rel="noopener noreferrer" target="_blank">
ECEF</a> coordinate frames. When zoomed out and having ECI selected I'd like to see the globe rotating along with the satellites around it.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>I'm open to other solutions if you have them. Let me know if you have any thoughts!</div>
<div>
<div>
<div dir="ltr" class="gmail-m_-8097101857672350656gmail_signature">
<div> </div>
<div>~Terek Campbell</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 3:02 AM Adrien Berthet <<a href="mailto:Adrien.Berthet@ign.fr" rel="noopener noreferrer" target="_blank">Adrien.Berthet@ign.fr</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Helvetica;color:rgb(0,0,0);font-size:10pt">
<div>Thanks !</div>
<div><br>
</div>
<div>So what you got wrong is that you are moving the globe, when you should be<b> moving the camera</b>.</div>
<div><br>
</div>
<div>Here's a quick thing you can do for example, using the controls <font face="Courier New">
lookAtCoordinate</font> method:</div>
<blockquote>
<div><font face="Courier New">let target = view.controls.getLookAtCoordinate();<br>
setInterval(() => {<br>
target.x = (target.x + 180+ 0.5) % 360 - 180;<br>
globe.controls.lookAtCoordinate({ coord: target }, false);<br>
globe.notifyChange();<br>
}, 100);</font><br>
</div>
</blockquote>
<div>More information here <a href="http://www.itowns-project.org/itowns/docs/#api/Controls/GlobeControls" rel="noopener noreferrer" target="_blank">
http://www.itowns-project.org/itowns/docs/#api/Controls/GlobeControls</a> and here
<a href="http://www.itowns-project.org/itowns/docs/#api/Controls/CameraUtils" rel="noopener noreferrer" target="_blank">
http://www.itowns-project.org/itowns/docs/#api/Controls/CameraUtils</a> <br>
</div>
<div><br>
</div>
<div style="font-family:"Times New Roman";color:rgb(0,0,0);font-size:16px">
<hr>
<div id="gmail-m_-8097101857672350656gmail-m_808915833314532278divRpF192027" style="direction:ltr"><font size="2" face="Tahoma" color="#000000"><b>De :</b> Terek Campbell [<a href="mailto:terekc@gmail.com" rel="noopener noreferrer" target="_blank">terekc@gmail.com</a>]<br>
<b>Envoyé :</b> mercredi 7 août 2019 01:07<br>
<b>À :</b> Adrien Berthet<br>
<b>Cc :</b> <a href="mailto:itowns-user@lists.osgeo.org" rel="noopener noreferrer" target="_blank">
itowns-user@lists.osgeo.org</a><br>
<b>Objet :</b> Re: [iTowns-user] Unwanted culling when rotating globe<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>Here's a bit larger snippet with most of my iTowns related code:</div>
<div><br>
</div>
<i> private initGlobeView(sceneDiv) {<br>
const position = new Coordinates("WGS84", 2.351323, 48.856712, 25e6);<br>
<br>
this.view = new GlobeView(sceneDiv, position, {<br>
scene3D: this.scene,<br>
renderer: this.renderer<br>
});<br>
<br>
const globeLayer = this.view.getLayerById("globe");<br>
const globe = globeLayer.object3d;<br>
<br>
this.view.addFrameRequester(MAIN_LOOP_EVENTS.UPDATE_START, () => {<br>
globe.rotation.z = this.globals.getSceneRotation();<br>
});<br>
<br>
Fetcher.json("../../../assets/layers/JSONLayers/Ortho.json").then(config => this.addColorLayerFromConfig(config));<br>
Fetcher.json("../../../assets/layers/JSONLayers/WORLD_DTM.json").then(config => this.addElevationLayerFromConfig(config));<br>
Fetcher.json("../../../assets/layers/JSONLayers/IGN_MNT_HIGHRES.json").then(config => this.addElevationLayerFromConfig(config));<br>
}<br>
<br>
</i>
<div>
<div dir="ltr" class="gmail-m_-8097101857672350656gmail-m_808915833314532278gmail_signature">
<div>I'll note that overwriting the culling function like so</div>
<div><i> globeLayer.culling = () => {};</i><br>
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.</div>
<div><br>
</div>
<div>I think the problem is that <i>worldToScaledEllipsoid</i> in iTowns GlobeLayer.js is not being updated and thus in GlobeLayer.js's <i>preUpdate
</i>function<i> </i>the <i>cameraPosition</i> variable isn't being set correctly, but that's just speculation. I don't quite understand how all the parts are working together yet.</div>
<div><br>
</div>
<div> </div>
<div>~Terek Campbell</div>
</div>
</div>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Aug 6, 2019 at 1:01 AM Adrien Berthet <<a href="mailto:Adrien.Berthet@ign.fr" rel="noopener noreferrer" target="_blank">Adrien.Berthet@ign.fr</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Helvetica;color:rgb(0,0,0);font-size:10pt">
<div>Hello Terek,</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>Adrien<br>
</div>
<div style="font-family:"Times New Roman";color:rgb(0,0,0);font-size:16px">
<hr>
<div id="gmail-m_-8097101857672350656gmail-m_808915833314532278gmail-m_3882398577283642884divRpF912141" style="direction:ltr">
<font size="2" face="Tahoma" color="#000000"><b>De :</b> ITowns-user [<a href="mailto:itowns-user-bounces@lists.osgeo.org" rel="noopener noreferrer" target="_blank">itowns-user-bounces@lists.osgeo.org</a>] de la part de Terek Campbell [<a href="mailto:terekc@gmail.com" rel="noopener noreferrer" target="_blank">terekc@gmail.com</a>]<br>
<b>Envoyé :</b> lundi 5 août 2019 23:35<br>
<b>À :</b> <a href="mailto:itowns-user@lists.osgeo.org" rel="noopener noreferrer" target="_blank">
itowns-user@lists.osgeo.org</a><br>
<b>Objet :</b> [iTowns-user] Unwanted culling when rotating globe<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hey all, <br>
<br>
I’m attempting to rotate the globe over time via the following code:<br>
<br>
this.view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_CAMERA_UPDATE, () => {<br>
globe.rotation.z = this.globals.getTotalRotation();<br>
this.view.notifyChange();<br>
});<br>
<br>
However, I’m seeing odd culling once it starts rotating as in the attached screenshot. How can I prevent this?<br clear="all">
<div>
<div dir="ltr" class="gmail-m_-8097101857672350656gmail-m_808915833314532278gmail-m_3882398577283642884gmail_signature">
<div> </div>
<div>~Terek Campbell</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote></div>