Hi all,
I’m doing some work trying to visualize some bathymetric data (elevations much lower than 0) and I’m running into some issues. I only had a few issues to get around
-
Disable horizon culling which doesn’t work when the eye point is below 0. This was easy, and I just overrode EllipsoidalOccluder.prototype.isScaledSpacePointVisible to return true based on a recommendation I found in the forum.
-
I had to disable Fog. The new Fog culling isn’t happy with the bathymetric tiles for some reason and they will randomly cull when I get the eyepoint close to the ground. That is a problem that is worth fixing at some point, but I can work around it now by just disabling fog.
The issue I’m running into now is the dreaded “RangeError: Invalid array length” catch all error with this stack trace:
RangeError: Invalid array length
RangeError: Invalid array length
at updateFrustums (http://localhost:8081/Source/Scene/Scene.js:1187:36)
at createPotentiallyVisibleSet (http://localhost:8081/Source/Scene/Scene.js:1412:13)
at executeCommandsInViewport (http://localhost:8081/Source/Scene/Scene.js:2105:9)
at updateAndExecuteCommands (http://localhost:8081/Source/Scene/Scene.js:1972:17)
at render (http://localhost:8081/Source/Scene/Scene.js:2396:9)
at Scene.render (http://localhost:8081/Source/Scene/Scene.js:2434:13)
at CesiumWidget.render (http://localhost:8081/Source/Widgets/CesiumWidget/CesiumWidget.js:686:25)
at render (http://localhost:8081/Source/Widgets/CesiumWidget/CesiumWidget.js:72:32)
It’s inconsistent as to when it happens, but it’s usually when the eye point is close to the terrain and I’m moving around. I managed to catch the issue a bit earlier than usual by adding a check at the beginning of updateFrustums like this:
function updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, nearToFarDistance2D) {
if (isNaN(numFrustums) || isNaN(near) || isNaN(far) || isNaN(farToNearRatio)) {
console.log(“updateFrustums broken=” + numFrustums + " near=" + near + " far=" + far + " farToNearRatio=" + farToNearRatio);
}
// Original code.
}
By putting a breakpoint on the console log I could inspect the state a bit for some hints as to what is wrong. What I found was that the viewer’s camera position, positionCartographic, up, right, and forward vectors were all NaN. That kind of leads me to believe that there might be an issue in the ScreenSpaceCameraController, it’s just a guess though.
Is there anything obvious that I should be doing or any known issues with rendering bathymetric data that could cause this?
Thanks!
Jason