Add Depth Fade Point visualisation style for PointCloud rendering#1648
Add Depth Fade Point visualisation style for PointCloud rendering#1648ksuszka wants to merge 2 commits intoros2:rollingfrom
Conversation
fdd2cdb to
427788a
Compare
|
@ahcorde I think I fixed it by adding missing condition in the PointCloud::getRenderOperationType() function. Now it behaves the same as in Flat Square mode on ROS Rolling inside WSL2 on Windows 11 with RTX 3090. What is interesting - I developed this on ROS Humble inside a docker container running on Ubuntu 24 host with RTX 3060 with a huge static point cloud and I didn't observe any issues. However when I tested it on ROS Rolling inside WSL2 on Windows 11 with point_cloud_transport_tutorial the issue appeared immediately - it is enough to move mouse over rendered point cloud during playback and cloud disappears. Looking on the missing condition in the PointCloud::getRenderOperationType() function I wonder why it worked in the first place. What is worth mentioning - with this fix it behaves the same as Flat Square mode but it doesn't mean it behaves correctly. When I set alpha on the point cloud to 0.1 and I hover with my mouse over the point cloud it switches between transparent/opaque mode, but it does so for every other mode and only for dynamic point clouds. It doesn't happen for a static point cloud. UPDATE: I've modified my answer after finding that the difference in behavior is not releated to WSL/Ubuntu but to testing it with dynamic/static point clouds. |
61f8369 to
fbe830f
Compare
|
@ahcorde I wonder if naming chosen here is the best. I think we can easily modify this code to use the same technique to render points as circles not squares and probably some folks would prefer that. So we can add two modes instead of one. So maybe something like "Square Points" and "Round Points" or "Fading Square Points" and "Fading Round Points" would be better? (I keep using "fading" in the name to signal possible dropping of points in the distance, but maybe it is superfluous) What do you think? |

Description
This PR adds new point cloud visualization style "Depth Fade Points" which uses custom vertex shader to simulate depth without creating additional vertices. The effect is similar to what "Flat Squares" style does, however VRAM consumption is 4 times smaller.
For 10,000,000 point cloud "Flat Squares" takes 0.9GB of VRAM on my card and "Depth Fade Points" takes 0.2GB of VRAM.
This new vertex shader employs three techniques to simulate depth fading:
First, it calculates the size of the rendered point shape required to simulate depth based on set world size and distance to the camera.
If the calculated size is smaller than 1px (which cannot be render) then it keeps the point size at 1px and tries to reduce point alpha value to simulate depth.
If the calculated alpha value is too small (which would cause rendering artifacts) than it uses stochastic point removal to achieve required perceived depth.
Did you use Generative AI?
The hash function in the vertex shader was generated using ChatGPT.