ethz-asl / wavemap

Fast, efficient and accurate multi-resolution, multi-sensor 3D occupancy mapping
https://ethz-asl.github.io/wavemap/
BSD 3-Clause "New" or "Revised" License
434 stars 38 forks source link

Fix LoD level selection when using Rviz's TopDownOrtho ViewController #52

Closed victorreijgwart closed 9 months ago

victorreijgwart commented 9 months ago

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:

victorreijgwart commented 9 months ago

@LionelOtt, thanks for reviewing :)

victorreijgwart commented 9 months ago

/prepare-release patch