Calculating the far distance plan based on pitch and yaw for a map renderer

Started by
0 comments, last by maxammann 7 months, 3 weeks ago

I'm working on a vector map renderer. I want to calculate the far plane for a protective transformation, based on the yaw, pitch, roll and height of the camera above the map. Yaw (looking to the left and right), pitch (the direction you also have on Google Maps e.g.) and roll (rotation around Y axis in this case) are limited to 30°.

I recorded a video here of the movements users are able to do:

As you can see there is some clipping, which demonstrates that the calculation of the far distance field is not correct yet. Though, please note that I do have a working version if you only use pitch and roll. So this question is about: How do I calculate the far distance plane if I not only want pitch and roll?

I prepared a geogebra drawing to explain the current calculations. It is not that simple because there are not that many right-angles: https://www.geogebra.org/m/cvhtwhng​

In that diagram:

  • h is the height of the camera.
  • Roll is not really relevant as it does not influence the far distance plane.
  • Yaw and pitch are equal to “pitch” in the diagram. Note that this is only a 2d cut of the real situation which is 3d. So the geogebra diagram is a simplification.

Finally, I have some code to share.

I have tried a few method to calculate the far distance plane based on the current pitch and yaw. Unfortunately, I have not gained confidence whether the correct is calculated. I am certain that the geogebra calculations are correct as they work well for the “only pitch” case. Though, the combination of both seems more involved.

Note: I'll update this post tomorrow to include some more details. Let me know if something is unclear!

This topic is closed to new replies.

Advertisement