itowns icon indicating copy to clipboard operation
itowns copied to clipboard

Potree2 PointCloud doesn't appear with PlanarView

Open ketourneau opened this issue 5 months ago • 12 comments

Since https://github.com/iTowns/itowns/pull/2498

Potree2 point clouds no longer appear with PlanarView.

Source code : https://github.com/bloc-in-bloc/itowns/blob/f/potree2-planarView-bug/examples/view_25d_map.html#L108

Before https://github.com/iTowns/itowns/pull/2498 Image

After https://github.com/iTowns/itowns/pull/2498 Image

ketourneau avatar Nov 17 '25 09:11 ketourneau

I indeed forgot to update the Potree2BrotliLoader... I open a PR #2635 to correct this oversight.

Image

A refactorization between the commun part of the 2 Potree2Loader, should be done, to avoid similar oversight later on...

ftoromanoff avatar Nov 18 '25 09:11 ftoromanoff

The PR #2635 fixing this had been merged into master. Can you confirme that the bug is fixed ? @ketourneau Thanks in advance !

ftoromanoff avatar Nov 20 '25 15:11 ftoromanoff

Thanks for the fix ! It's work now in the simple example but it still doesn't work in our use case (custom controls, custom renderer, custom camera) https://github.com/bloc-in-bloc/itowns/blob/f/custom-pointcloud-sample/examples/demo_hackathon_orvault_planarView.html

ketourneau avatar Nov 21 '25 06:11 ketourneau

On master branch (demo_hackathon_orvault_planarView.html) : Image

Before the changes on point cloud (demo_hackathon_orvault_planarView.html) : Image

ketourneau avatar Nov 21 '25 06:11 ketourneau

From what I started to check, it's a problem with the matrixWorld of the camera3D of the custom camera. The update loop calculate that the bbox of the node are not in the cameraSpace... https://github.com/iTowns/itowns/blob/628f03ec1fe0b7953996c4728eb8c62a2e73c15e/packages/Main/src/Renderer/Camera.js#L230

ftoromanoff avatar Nov 21 '25 13:11 ftoromanoff

How could it work before changes on pointcloud ?

ketourneau avatar Nov 21 '25 13:11 ketourneau

Before the changes the crs was not at all taking into account... meaning that whatever crs you was saying the data were considered as in the default crs, and everthing else was considered in the same crs. Now the crs is really considered from pointCloudData, and we need to be sure that your custom camera is well defined in the data crs.

ftoromanoff avatar Nov 21 '25 13:11 ftoromanoff

@ftoromanoff How I can help you to debug ?

ketourneau avatar Nov 26 '25 09:11 ketourneau

This example uses a custom Camera and a custom Renderer. It seems pretty complex for me and it's hard to understand was is the purpose of it.. I will advice to start again from a basic example and add little by little the different aspects of what you want to show in your example. With this approach you might find where exactly the bug appears... As the basic example seems to work fine, it might not directly be the reprojection that causes the bug...

ftoromanoff avatar Dec 02 '25 13:12 ftoromanoff

Ok, thanks for the reply. I'll try starting again from the basic example with just a custom camera for debuging (without custom renderer).

ketourneau avatar Dec 03 '25 08:12 ketourneau

I have updated our custom sample which reproduce the problem : https://github.com/bloc-in-bloc/itowns/commit/73ea8b37fea8786d1aa4f320d6c65b0c2f5aa923

After analysis with @ftoromanoff there seems to be a problem with the matrix world of clampOBB used to determine if element is visible in PointCloudLayer.

A little more explanation about our use case : We need to place the itowns Planar View to a specific position because we display georeferenced data outside itowns context. The ThreeJS scene center (0,0,0) must match the georeferenced BBOX center. So we must apply an "offset" (position and rotation) to the itowns planar view (by object3d parameter) to match our system.

iTownsViewRoot => offset position
└─ pivot => offset rotation, passed to PlanarView as object3D parameter
    └─ PointCloudGroup => Passed to Potree2Layer as object3D parameter

Does anyone have any idea how to take into account object3D parameter to correctly rendering point cloud since #2498 ? More specifically, I notice a breaking (for our use case) since this commit.

ketourneau avatar Dec 11 '25 11:12 ketourneau

@ketourneau Can you try #2656 ?

ftoromanoff avatar Dec 12 '25 16:12 ftoromanoff