Remove lines geom shader - #67356
Remove lines geom shader#67356ViperMiniQ wants to merge 4 commits into
Conversation
- build line segments using pointA and pointB attributes - pass additional pointC to line_joins shader for calculating the joins - render joins as a separate instances (second pass)
- handle duplicates in cpp, rather than in shaders - introduce enum to distinguish between segments and joins - clip away the segments at joins, two segments should not overlap at joins and joins are also clipped to fill the space between the segments, but not to overlap them - rename shader
- fix joins not showing from certain angles
Tests failed for Qt 6 (ALL_BUT_PROVIDERS - fedora)One or more tests failed using the build from commit b4566b5 4978_line_rendering_1 (testEpsg4978LineRendering)4978_line_rendering_1Test failed at testEpsg4978LineRendering at tests/src/3d/testqgs3drendering.cpp:1973 Rendered image did not match tests/testdata/control_images/3d/expected_4978_line_rendering_1/expected_4978_line_rendering_1.png (found 182 pixels different) polygon_edges_height (testPolygonsEdges)polygon_edges_heightTest failed at testPolygonsEdges at tests/src/3d/testqgs3drendering.cpp:609 Rendered image did not match tests/testdata/control_images/3d/expected_polygon_edges_height/expected_polygon_edges_height.png (found 2623 pixels different) line_rendering_1 (testLineRendering)line_rendering_1Test failed at testLineRendering at tests/src/3d/testqgs3drendering.cpp:657
line_rendering_1 (testLineRenderingClipping)line_rendering_1Test failed at testLineRenderingClipping at tests/src/3d/testqgs3drendering.cpp:714
line_rendering_1 (testLineRenderingCurved)line_rendering_1Test failed at testLineRenderingCurved at tests/src/3d/testqgs3drendering.cpp:800
rubberband_3d_hidden_last_marker (testRubberBandHiddenLastMarker)rubberband_3d_hidden_last_markerTest failed at testRubberBandHiddenLastMarker at tests/src/3d/testqgsrubberband3drendering.cpp:249 Rendered image did not match tests/testdata/control_images/3d/expected_rubberband_3d_hidden_last_marker/default/expected_rubberband_3d_hidden_last_marker.png (found 85 pixels different) The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
Tests failed for Qt 6 (ALL_BUT_PROVIDERS - ubuntu)One or more tests failed using the build from commit b4566b5 4978_line_rendering_1 (testEpsg4978LineRendering)4978_line_rendering_1Test failed at testEpsg4978LineRendering at tests/src/3d/testqgs3drendering.cpp:1973 Rendered image did not match tests/testdata/control_images/3d/expected_4978_line_rendering_1/expected_4978_line_rendering_1.png (found 182 pixels different) polygon_edges_height (testPolygonsEdges)polygon_edges_heightTest failed at testPolygonsEdges at tests/src/3d/testqgs3drendering.cpp:609 Rendered image did not match tests/testdata/control_images/3d/expected_polygon_edges_height/expected_polygon_edges_height.png (found 2624 pixels different) line_rendering_1 (testLineRendering)line_rendering_1Test failed at testLineRendering at tests/src/3d/testqgs3drendering.cpp:657
line_rendering_1 (testLineRenderingClipping)line_rendering_1Test failed at testLineRenderingClipping at tests/src/3d/testqgs3drendering.cpp:714
line_rendering_1 (testLineRenderingCurved)line_rendering_1Test failed at testLineRenderingCurved at tests/src/3d/testqgs3drendering.cpp:800
rubberband_3d_hidden_last_marker (testRubberBandHiddenLastMarker)rubberband_3d_hidden_last_markerTest failed at testRubberBandHiddenLastMarker at tests/src/3d/testqgsrubberband3drendering.cpp:249 Rendered image did not match tests/testdata/control_images/3d/expected_rubberband_3d_hidden_last_marker/default/expected_rubberband_3d_hidden_last_marker.png (found 85 pixels different) The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🍎 MacOS Qt6 buildsDownload MacOS Qt6 builds of this PR for testing. |
- if we filter in 2d only, we miss points that are behind/on top of one another - fix assert
This PR removes the geometry shader for lines (part 3 of qgis/QGIS-Enhancement-Proposals#381).
Lines are now instanced.
Two render passes are done. One is for the segments themselves, the other is for segment joins.
For multisegment lines, the part where the lines touch is “cut”.
The cut empty space is then filled with the join.
Screencast_20260909_090205.webm
The above screencast shows the semi-transparent lines. We do not officially support them in QGIS, this is just to showcase how there is no overlap between join-lines and line-line. The overlap visible at one point between the lines when looking back is because of the order of the lines, that is something to consider if opacity would be supported (again, not planed for here).
Supported join types are miter and bevel.
MITER_LIMIT has been set to never create MITER joins.
That was made because the old code also never created miters, always bevels.
If that were to change at any point, test cases will have to be updated (also one of the reasons I did not do it here).
Implementation taken from:
(first part instancing of the lines)
https://wwwtyro.net/2019/11/18/instanced-lines.html
(second part, joins)
https://wwwtyro.net/2021/10/01/instanced-lines-part-2.html
AI tool usage