-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Render as a surface" option to 2D point cloud renderers #55332
Add "Render as a surface" option to 2D point cloud renderers #55332
Conversation
When enabled, we will do Delaunay triangulation of the points in the current map view, and then render triangles instead of points. For each point we keep its color for interpolation in the triangle. Global map shading is also supported with the new option, when enabled, we also keep elevation of each point, and then rasterize triangles with interpolated elevations to the provided elevation map. When "Render as a surface" is enabled, drawing order is ignored, because points do not obscure other points anymore - all input points participate in the triangulation. There is also an option to filter large triangles (given by the maximum length of edge of a triangle), which is useful when one wants to see the actual holes in the data. Compared to the implementation for 3D rendering, the 2D rendering only provides filtering based on horizontal length of triangles. Filtering based on triangle size on the vertical axis seems irrelevant because the 2D view is always from the top.
|
||
int red0 = qRed( c0 ), green0 = qGreen( c0 ), blue0 = qBlue( c0 ); | ||
int red1 = qRed( c1 ), green1 = qGreen( c1 ), blue1 = qBlue( c1 ); | ||
int red2 = qRed( c2 ), green2 = qGreen( c2 ), blue2 = qBlue( c2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an opportunity here for an optimisation -- we could check if c0 == c1 == c2 (and not elevation map), and if so then just use the QPainter renderPolygon method to draw a filled solid color triangle.
It's a situation that WILL arise frequently, eg for classified point clouds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried this, but unfortunately it leaves ugly artifacts at the edges between barycentric-based and QPainter-based triangles - even when I use 1px solid pen in addition to the brush fill for QPainter, and I would prefer not to use thicker pens. After this initial work, I would like to do a bit of profiling, so if possible I would prefer to leave optimisation for later (moreover, for attribute by ramp or RGB, the QPainter solid triangle path would not get triggered often)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fair enough!
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
@wonder-sk |
@wonder-sk A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
When enabled, we will do Delaunay triangulation of the points in the current map view, and then render triangles instead of points. For each point we keep its color for interpolation in the triangle.
Global map shading is also supported with the new option, when enabled, we also keep elevation of each point, and then rasterize triangles with interpolated elevations to the provided elevation map.
When "Render as a surface" is enabled, drawing order is ignored, because points do not obscure other points anymore - all input points participate in the triangulation.
There is also an option to filter large triangles (given by the maximum length of edge of a triangle), which is useful when one wants to see the actual holes in the data. Compared to the implementation for 3D rendering, the 2D rendering only provides filtering based on horizontal length of triangles. Filtering based on triangle size on the vertical axis seems irrelevant because the 2D view is always from the top.
Funded by: National Resources Canada
GUI
There's a new group in 2D styling tab - similar to the one that already exists in the 3D styling tab:
Screenshots
As expected, triangulation covers holes between points when zoomed in, but subjectively also gives nicer rendering when zoomed out.
Trencin castle
Global map shading when render as a surface is enabled:
Helsinki train station (RGB)