-
Notifications
You must be signed in to change notification settings - Fork 303
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
Pointcloud improvement #732
Conversation
279a857
to
181d1ee
Compare
181d1ee
to
e4592df
Compare
Edited description + added image |
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.
Looks good and simplifies things, thanks !
I added a few comments to improve it even further :)
(I have not tested it though)
src/Process/PointCloudProcessing.js
Outdated
@@ -155,7 +78,7 @@ function markForDeletion(elt) { | |||
|
|||
if (!elt.notVisibleSince) { | |||
elt.notVisibleSince = Date.now(); | |||
elt.shouldBeLoaded = -1; | |||
elt.sse = -1; |
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.
Maybe you could add a comment here stating what -1 means
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.
Done
src/Process/PointCloudProcessing.js
Outdated
@@ -169,6 +92,11 @@ export default { | |||
return []; | |||
} | |||
|
|||
context.camera.preSSE = |
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.
You could link here to an existing technical paper to explain the derivation
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.
Done
src/Process/PointCloudProcessing.js
Outdated
} else if (!elt.promise) { | ||
const distance = Math.max(0.001, bbox.distanceToPoint(context.camera.camera3D.position)); | ||
const priority = computeScreenSpaceError(context, layer, elt, distance) / distance; | ||
elt.promise = context.scheduler.execute({ |
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.
Why do you divide by distance ?
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.
To load closest node first.
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.
If I understand correctly, minimizing SSE is what you want eventually (as things settle), but you prefer to bias the ordering of the fetches towards closer nodes, even if those have a smaller SSE. Is that correct ? I think a comment should be placed here for future reference (eg, we might want to enable the customization of this strategy)
src/Process/PointCloudProcessing.js
Outdated
const count = Math.max(1.0, Math.floor(pts.geometry.drawRange.count * reduction)); | ||
pts.geometry.setDrawRange(0, count); | ||
// 2 different point count limit implementation, depending on the pointcloud source | ||
if (layer.metadata.customBinFormat) { |
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 would rather have the processing be agnostic of formats, nut depend rather on format properties or strategies. Could not you have reordered bin files as in cin files, or the other way around?
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.
What about renaming customBinFormat to something like prefixSubsampling ?
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 added a layer.supportsProgressiveDisplay
property. (Note that the rest of the file relies on the potreeconverter format, there's more work to do to be able to use this processing code on any pointcloud source)
this commit : refactor(pointcloud): rework point budget implementation |
Yes. |
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.
LGTM
src/Process/PointCloudProcessing.js
Outdated
} else if (!elt.promise) { | ||
const distance = Math.max(0.001, bbox.distanceToPoint(context.camera.camera3D.position)); | ||
const priority = computeScreenSpaceError(context, layer, elt, distance) / distance; | ||
elt.promise = context.scheduler.execute({ |
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.
If I understand correctly, minimizing SSE is what you want eventually (as things settle), but you prefer to bias the ordering of the fetches towards closer nodes, even if those have a smaller SSE. Is that correct ? I think a comment should be placed here for future reference (eg, we might want to enable the customization of this strategy)
src/Process/PointCloudProcessing.js
Outdated
return { shouldBeLoaded, surfaceOnScreen: 0 }; | ||
function computeScreenSpaceError(context, layer, elt, distance) { | ||
if (distance <= 0) { | ||
return layer.sseThreshold; |
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.
is it equivalent to returning Infinity ? (which would be parameterless and thus more explicit)
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.
Thanks for the review. I addressed both comments.
Ok thanks, it's good to be completely compliant with Potree data |
Since .bin and .cin have different repartitions of the points inside a node, they must use different algorithms. For .cin we want to draw a %-age of each node because points are evenly distributed. For .bin, we sort the nodes by 'importance', and stop drawing nodes when we have enoug points.
Project average point spacing on screen and compare to sse threshold. It's a simplification of the approach proposed in #674. This allows to drop a dependency (convexhull) and brings the SSE compuation for pointcloud closer to what is done for other geometries.
9af92a7
to
24c618b
Compare
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.
LGTM
Thanks for the review @mbredif - and welcome to the @iTowns/reviewers team ! |
actually he just has write access. The convention is : a review from someone from itowns-reviewers group. Nevermind, I'll make some comments on this if needed and we'll do a followup, ok for you? |
Oops my bad. I'm reverting this PR then, until your approval. |
2 commits improving pointcloud support for itowns.
The first one fixes the point budget handling for .bin format.
The second reworks SSE: it's similar to #674 but simpler and only for pointclouds.
Full commits message:
Edit:
The SSE value computed here is the estimation of the maximum distance between 2 points in a given node.
PotreeConverter guarantees that the distance between each pair of points is >=
metadata.spacing / node.level
in all nodes. This is easy to visualize if you display successive children (using the 'sticky' debug tool):The SSE is the estimation of this distance projected on the screen.