iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.1k stars 298 forks source link

Sky turns black when low altitude and high tilt #652

Closed fnicollet closed 6 years ago

fnicollet commented 6 years ago

Hello,

Trying iTowns, with only the ortho. As I tilt the map, the sky suddently renders black instead of being blue: image

Reproduced in Chrome with the following code:

var positionOnGlobe = { longitude: 2.471311, latitude: 49.258868, altitude: 25 };
// iTowns namespace defined here
var viewerDiv = document.getElementById('viewerDiv');
var globeView = new itowns.GlobeView(viewerDiv, positionOnGlobe);
globeView.addLayer(ORTHO);
globeView.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function(){
    console.log("itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED");
globeView.controls.setTilt(80, true);
});

As you zoom out, the sky turns back to blue

Fabien

zarov commented 6 years ago

@peppsac this is the fault of t being a NaN. Do you know why, as you seem the most recent contributor to this piece of code ? https://github.com/iTowns/itowns/blob/master/src/Core/Prefab/GlobeView.js#L267

peppsac commented 6 years ago

No idea. But this formula comes from 00b17d26dbe3842c656a2fcb4486e6268f8ca41d (it was moved from c3DEngine.js to GlobeView.js).

gchoqueux commented 6 years ago

I'll fix it, simplify and explain the code