This PR fixes a bug that causes the map to only be rendered at the lowest resolution in Rviz when using the TopDownOrtho ViewController.
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
Detailed summary
Wavemap's Rviz plugin uses LoD rendering to improve Rviz's framerate and responsiveness when drawing large maps. The LoD level for each block in the map is chosen based on its distance to the camera.
However, in TopDownOrtho mode, the scene is rendered without perspective (orthographic projection), and Rviz sets the z-coordinate of the camera to a dummy value (500m). This, in turn, caused our plugin to think all blocks are very far away and always pick the coarsest LoD level.
The fix in this PR detects when the projection mode is orthographic, and if so, always uses the highest LoD level.
In the long term, we could reintroduce rendering optimizations for TopDownOrtho mode (e.g. frustum and occlusion culling). This will be done in a future development cycle for the Rviz plugin.
Fixes #51
Testing
The fix was successfully tested on:
[x] Integrated graphics (laptop)
[x] GPU machine (desktop)
Checklist:
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] Any required changes in dependencies have been committed and pushed
Description
This PR fixes a bug that causes the map to only be rendered at the lowest resolution in Rviz when using the TopDownOrtho ViewController.
Type of change
Detailed summary
Wavemap's Rviz plugin uses LoD rendering to improve Rviz's framerate and responsiveness when drawing large maps. The LoD level for each block in the map is chosen based on its distance to the camera.
However, in TopDownOrtho mode, the scene is rendered without perspective (orthographic projection), and Rviz sets the z-coordinate of the camera to a dummy value (500m). This, in turn, caused our plugin to think all blocks are very far away and always pick the coarsest LoD level.
The fix in this PR detects when the projection mode is orthographic, and if so, always uses the highest LoD level.
In the long term, we could reintroduce rendering optimizations for TopDownOrtho mode (e.g. frustum and occlusion culling). This will be done in a future development cycle for the Rviz plugin.
Fixes #51
Testing
The fix was successfully tested on:
Checklist: