farZOffset instead of farZMultiplier (underwater data) #7754
-
Hello, we have a use case where we are rendering underwater data below sea level. As per the recommendations we have increased the farZMultiplier to 100 or even 1,000,000 but we still have issues with farZ clipping at high zoom levels as the camera approaches sea level. I assume this is due to the camera height above sea level calculations here: What I really want to do is add a fixed offset to farZ given I know that the data will be no more than 11km below sea level (maximum ocean depth) but I can't see a way to do this. There seems to be a mechanism for supplying a custom projection matrix to MapView but I've not been able to get this to work. Any ideas please? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I don't think there is a way to arbitrarily set farZ at the moment, thought I can see why it would be useful in your case. Right now I think the right way to apply const farZ = Math.min(furthestDistance, horizonDistance) * farZMultiplier; Note that where farZ maps to the real-world coordinate is dependent on the zoom level, so you may still have to adjust it as the zoom level change. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the assistance |
Beta Was this translation helpful? Give feedback.
I don't think there is a way to arbitrarily set farZ at the moment, thought I can see why it would be useful in your case. Right now
farZMultiplier
is still limited by another variable, so simply blowing it up does not do what you expect:https://github.com/uber-web/math.gl/blob/d618c26869a15f277af56df8416216cf07e5c747/modules/web-mercator/src/web-mercator-utils.ts#L334
I think the right way to apply
farZMultiplier
should beNote that where farZ maps to the real-world coordinate is dependent on the zoom level, so you may still have to adjust it as the zoom level change.