chore(pointcloud): Add adaptive size mode#2666
Conversation
|
I see an issue with postUpdate, pointcloud size is wrong at initialisation (postUpdate is called before points loaded) : #2665 |
7afe5c3 to
49a686f
Compare
d124dc9 to
31b11dc
Compare
40b5fb7 to
90df547
Compare
75ba231 to
1fb2419
Compare
1fb2419 to
aae36f4
Compare
5a70f87 to
cf37835
Compare
|
@ketourneau nice addition thanks ! Tested ok on 3D Tiles datasets 🙂 I think we should modify the point clouds examples (including 3dtiles_loader.html) to use this display mode. WDYT @Desplandis ? |
After discussion with @ketourneau it is not applied to 3D Tiles layers because the implementation is based on the assumption that the data is organized in an octree. I'm not familiar enough with this algorithm to know if and how it could be adapted to 3D tiles but it should not block this PR. We should however add in the doc and maybe in a warning that it is not supported for 3D Tiles layers. |
609b339 to
22bbf6e
Compare
22bbf6e to
b7766c6
Compare
b7766c6 to
baef75b
Compare
|
Small remarks for the PointCloudDebug. The 'Min size' and 'Max size' are not use for the 'new 'ADAPTIVE' 'Size mode', are they ? In this case the should be hidden as for when we set the 'Size mode' on 'VALUE'. |
| const data = vnt.image.data; | ||
| data.set(this._visibilityTextureData.data); |
There was a problem hiding this comment.
| const data = vnt.image.data; | |
| data.set(this._visibilityTextureData.data); | |
| const data = vnt.image.data; | |
| data.fill(0); | |
| data.set(this._visibilityTextureData.data); |
I think there are still some stale entries from the previous updates, I recommend you to zero out all the buffer. It is weird however that we access those part of the buffer but it shall fix the issue for now.
There was a problem hiding this comment.
Indeed, good point.
| for (const pts of this.group.children) { | ||
| const node = pts.userData.node; | ||
| const depth = node.depth; | ||
| const nodeStartOffset = this._visibilityTextureData.nodeToIndex.get(node); |
There was a problem hiding this comment.
Beware that nodeStartOffset may be undefined! This is can happen because the rendered group this.group.children do not guarantee that all points are visible. They are in the rendered group (were visible once) but remain hidden until disposal (10s later).
There was a problem hiding this comment.
Ok I continue to next iteration if nodeStartOffset is undefined
| float nodeSizeAtLevel = octreeSize / pow(2.0, i + nodeDepth); | ||
|
|
||
| vec3 index3d = (pos - offset) / nodeSizeAtLevel; | ||
| index3d = floor(index3d + 0.5); |
There was a problem hiding this comment.
I think the more important issue of all. It seems that index3d may be outside the range
There was a problem hiding this comment.
Okay, I applied your suggestion.
| index3d = floor(index3d + 0.5); | ||
| int index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z)); | ||
|
|
||
| vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0)); |
There was a problem hiding this comment.
| vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0)); | |
| vec4 value = texture2D(visibleNodes, vec2((float(iOffset) + 0.5) / 2048.0, 0.5)); |
I suggest to sample at mid-pixel in case of a small floating-point error to not sample the neighbour texel.
There was a problem hiding this comment.
Okay, I applied your suggestion.
baef75b to
1938853
Compare
Yes, indeed, I had asked myself the same question. I hided the 'Min size' and 'Max size' |
cbd072a to
fde42d5
Compare
| @@ -299,7 +299,7 @@ export default { | |||
| styleUI.add(layer, 'opacity', 0, 1).name('Layer opacity').onChange(update); | |||
| styleUI.add(layer, 'pointSize', 0, 15).name('Point size').onChange(update); | |||
There was a problem hiding this comment.
This parameter initialy only have an impact on Size mode = VALUE (and not when Size mode = ATTENUATED) thus it should be put under 'Size mode' and be hidden when we are 'ATTENUATED' ?
Now i see that in the mode = ADAPTIVE, it's also has an impact even if i don't really understand to what exactly the value will refer to.
There was a problem hiding this comment.
In ADAPTIVE mode this parameter can be use to apply a scale factor. But normally, 1.0 factor value should be enough in most cases
There was a problem hiding this comment.
I would then still suggest to move this parameter after the 'Size mode' button and hide it when it has no impact. It is just purely ergonic and not algorythmic.
There was a problem hiding this comment.
It's fine by me. I don't validate the PR as I didn't review the rest of the code. I'll let @Desplandis do that.
# Conflicts: # packages/Main/src/Layer/PointCloudLayer.ts
… change # Conflicts: # packages/Main/src/Layer/PointCloudLayer.ts # Conflicts: # packages/Main/src/Layer/PointCloudLayer.ts
…clouds whose source CRS differs from the scene CRS)
…g-point error to not sample the neighbour texel
…ALUE or ADAPTIVE mode
e5fbf4c to
ab341b2
Compare
Description
We try to implement adaptive size mode.
Motivation and Context
Our customer needs it to draw on pointcloud.
Screenshots (if appropriate)
Enregistrement.de.l.ecran.2025-12-17.a.08.51.43.mov