iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.07k stars 290 forks source link

fix(PointCloud): use preSSE for C3DTilesLayer #2325

Closed AnthonyGlt closed 2 days ago

AnthonyGlt commented 2 months ago

Description

Use camera preSSE to compute the point size of a C3DTilesLayer in the ATTENUATED mode

Motivation and Context

I've noticed a difference between the calculus of the size of the points between Potree & 3Dtiles. In Potree we use the preSSE for the size computation. In this previous comment https://github.com/iTowns/itowns/pull/2171#discussion_r1311800499, I had highlighted this difference. Since then, @ftoromanoff change the default scale value in the pointMaterial. Right now, the attenuated mode doesn't seem that effective.

airnez commented 1 week ago

There are indeed some differences between 3DTiles and potree point size computation. Here are two videos to compare attenuated size mode behavior. (3DTiles VS Potree)

https://github.com/iTowns/itowns/assets/74316660/4aa5785e-4a77-4f94-b9a3-61b786538070

https://github.com/iTowns/itowns/assets/74316660/fada8738-c8aa-42f4-af53-25ed88e2c18b

Potree implementation seems more correct than 3DTiles one, as max attenuated value is almost not taken into account for 3DTiles. Definitely related to the preSSE scaling :

https://github.com/iTowns/itowns/blob/ee56ec70626213390fa200573552ddb5a54a3b94/src/Renderer/Shader/PointsVS.glsl#L161-L164

A small scaling factor could keep point size under minAttenuated value. This would explain why 3DTiles point size is sticking to minAttenuatedSize.

Desplandis commented 1 week ago

Seems that the default clamping values (as well as default size) are not that good, maybe try replacing it with (default values in LiDAR HD demo):

AnthonyGlt commented 3 days ago

Seems that the default clamping values (as well as default size) are not that good, maybe try replacing it with (default values in LiDAR HD demo):

* `size`: 1

* `minSize`: 1

* `maxSize`: 7

I've changed the default values