Skip to content

Fix coarse DEM elevation rework#66441

Open
benoitdm-oslandia wants to merge 12 commits into
qgis:masterfrom
benoitdm-oslandia:fix/coarse_elevation_rework_reduced
Open

Fix coarse DEM elevation rework#66441
benoitdm-oslandia wants to merge 12 commits into
qgis:masterfrom
benoitdm-oslandia:fix/coarse_elevation_rework_reduced

Conversation

@benoitdm-oslandia

Copy link
Copy Markdown
Collaborator

This PR improves the precision of the QgsDemTerrainGenerator::heightAt function. This function is used to compute the elevation of vector data (Z coordinate) when, for example, the user choose an altitude clamping based on the terrain elevation.

We also add a class QgsDemHeightMapCache to store height map data according to the ChunkNodeId (depth/x/y) of the received dem tile. This class listens for the QgsDemHeightMapGenerator to receive new dem tiles (height map data).

When a vector layer calls the heightAt function, we look (in the cache) for the best height map data, if not present we fallback to the old (coarse) algorithm.

As vector data can be already loaded when height map data are received, the vector data elevations may not be accurate and need to be updated.

To do so, when we received an height map with high precision, we emit a signal caught by Qgs3DMapScene. The slot function in Qgs3DMapScene:

  • looks for scene entities from vector layers whom style uses a terrain altitude clamping
  • searchs for chunk nodes intersecting the extent of the height map tile
  • asks to refresh these chunk nodes

This PR supersedes #62676. It fixes the issues mentioned in this previous PR.

Sponsored by:

cc @nenad-vujicic

@benoitdm-oslandia benoitdm-oslandia self-assigned this Jun 11, 2026
@benoitdm-oslandia benoitdm-oslandia added the 3D Relates to QGIS' 3D engine or rendering label Jun 11, 2026
@github-actions github-actions Bot added this to the 4.2.0 milestone Jun 11, 2026
@nyalldawson nyalldawson added the Frozen Feature freeze - Do not merge! label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tests failed for Qt 6 (ALL_BUT_PROVIDERS - fedora)

One or more tests failed using the build from commit cb40e93

ambient_occlusion_1 (testAmbientOcclusion)

ambient_occlusion_1

Test failed at testAmbientOcclusion at tests/src/3d/testqgs3drendering.cpp:2131

Rendered image did not match tests/testdata/control_images/3d/expected_ambient_occlusion_1/expected_ambient_occlusion_1.png (found 54041 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.

@github-actions

Copy link
Copy Markdown
Contributor

Tests failed for Qt 6 (ALL_BUT_PROVIDERS - ubuntu)

One or more tests failed using the build from commit cb40e93

ambient_occlusion_1 (testAmbientOcclusion)

ambient_occlusion_1

Test failed at testAmbientOcclusion at tests/src/3d/testqgs3drendering.cpp:2131

Rendered image did not match tests/testdata/control_images/3d/expected_ambient_occlusion_1/expected_ambient_occlusion_1.png (found 54040 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3D Relates to QGIS' 3D engine or rendering Frozen Feature freeze - Do not merge!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants