pnext / three-loader

Point cloud loader for ThreeJS, based on the core parts of Potree
Other
201 stars 88 forks source link

Add support for Potree 2.0 format #79

Closed fahadm closed 3 months ago

fahadm commented 3 years ago

As Potree 2.0 has been announced,it came with a new format, as of right now three-loader doesn't support this format.

TODO List

midnight-dev commented 3 years ago

Just a heads up... The loader name might change in the near future to be less confusing with respect to versioning. That is, it may be dropping the 1_8 moniker. If you can't find it, look for OctreeLoader.js instead.

potree commented 3 years ago

Already happened in the "compression" branch, where the loader for the 2.0 format, compressed and uncompressed, can be found here: https://github.com/potree/potree/tree/compression/src/modules/loader/2.0

fahadm commented 3 years ago

Hey @potree Do you guys have a spec with all possible fields in the json attributes? (adding types explicitly every time the compiler complaints is turning out to be quite annoying).

m-schuetz commented 3 years ago

No spec, the createMetadata function might help, though: https://github.com/potree/PotreeConverter/blob/da93ec26411b82ffbf799daf5ac56608ef988bf8/Converter/src/indexer.cpp#L245

The "encoding" attribute can be "BROTLI" for brotli compressed data, or anything else for default uncompressed data.

If brotli compression is enabled, this function will encode the attribute data for each node accordingly: https://github.com/potree/PotreeConverter/blob/da93ec26411b82ffbf799daf5ac56608ef988bf8/Converter/src/indexer.cpp#L1153

What happens is that attributes will be realigned into a structure of arrays format, see toStructOfArray and position and rgb colors will be encoded in morton code. Position will be 16 byte morton code, rgb 8 byte morton code. The extra bytes don't really matter because compression efficiently gets rid of zero bytes. https://github.com/potree/potree/blob/compression/src/modules/loader/2.0/DecoderWorker_brotli.js then shows you how brotli compressed data can be decompressed.

dddpt commented 3 years ago

Looking forward to Potree 2.0 format support, will probably switch to three-loader for our react app once this is up :+1:

Higuy8000 commented 3 years ago

Also looking forward to 2.0 support!

fahadm commented 3 years ago

For anyone wondering, I haven't given up on this (although I got busy with other stuff this year but do have a partly working branch), expect something in the coming weeks.

arjan-kuiper commented 2 years ago

@fahadm is support for 2.0 expected to be available anytime soon?

fahadm commented 2 years ago

Yes, unfortunately, I got very busy right after that message and wasn't able to get anything done, but now I plan on spending a significant amount of time working on it for the next few days to get this across the finish line :).

Frander commented 2 years ago

Hello, any news about this?

shiukaheng commented 2 years ago

Created a fork to use for the time being, not creating a pull request yet since I've also introduced some other changes that might cause compatibility issues.

fahadm commented 2 years ago

Nice Work!

I would love to see a PR (when ever it is done, I was never able to finish this as I always had other more high priority work to do), and maybe you can also become a co-contributor for this project.

shiukaheng commented 2 years ago

@fahadm Thanks! Sure, but to be honest the library is quite complex and it took me more than a week to only partially understand the code and get it working. The original Potree code was even harder to read. Would be great if we could talk about how its structured / each part interacts with each other, and perhaps as one of the future contributions add proper TSDocs for the library!

fahadm commented 2 years ago

@shiukaheng Sure, we can talk sometime (not exactly sure how I can contact you though), I think in general I have a pretty good idea of how everything interacts with one another. And yes I also think tsdocs are important :sweat_smile:

shiukaheng commented 2 years ago

Dm'ed on twitter

geoff-harper commented 2 years ago

Tangentially related, I see that @shiukaheng's fork has three updated to 0.138.x, any word on doing the same in this version? I have several other three libs that have kept the three version current so I've had to keep those locked into old versions as well. Bringing three up to current here would be huge for me personally

tbyholm commented 2 years ago

@fahadm Thanks! Sure, but to be honest the library is quite complex and it took me more than a week to only partially understand the code and get it working. The original Potree code was even harder to read. Would be great if we could talk about how its structured / each part interacts with each other, and perhaps as one of the future contributions add proper TSDocs for the library!

Hello,

I've been trying this quite a lot and it seems to work well, but for some reason I get no output on chrome/android. I noticed you have changed the shaders a little bit, maybe it has something to do with this?

-Thomas

arjan-kuiper commented 2 years ago

@tbyholm You should use this fork. It has support for Potree 2.0 and also has fixed shaders to work on Android and various other browsers. The fork is based on this repo.

tbyholm commented 2 years ago

@tbyholm You should use this fork. It has support for Potree 2.0 and also has fixed shaders to work on Android and various other browsers. The fork is based on this repo.

That's the one I used and modified a little but maybe there has been fixes in the last three weeks ?

shiukaheng commented 2 years ago

I think I tested it on android some time ago and it worked alright, not entirely sure about that though. The shaders should be functionally the same, but I updated to WebGL2 so I modified the shaders to use GLSL 300 es, which just has a slightly different syntax. Can you attach some logs to see what errors you are getting?

tbyholm commented 2 years ago

I think I tested it on android some time ago and it worked alright, not entirely sure about that though. The shaders should be functionally the same, but I updated to WebGL2 so I modified the shaders to use GLSL 300 es, which just has a slightly different syntax. Can you attach some logs to see what errors you are getting?

I will need to set up some debugging for the phone, with the normal version of three-loader there has never been any problem with Chrome on Android, so I haven't even had to setup any debugging env. and our main usage is not on phones. It seems like the cloud is loading and trying to display something but nothing is output on the screen.

Br, Thomas

tbyholm commented 2 years ago

I think I tested it on android some time ago and it worked alright, not entirely sure about that though. The shaders should be functionally the same, but I updated to WebGL2 so I modified the shaders to use GLSL 300 es, which just has a slightly different syntax. Can you attach some logs to see what errors you are getting?

THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false

Program Info Log: invalid shaders

VERTEX

ERROR: 0:130: 'round' : Name of a built-in function cannot be redeclared as function

I wonder if there is some cache problem now because I see that it round has been commented out in the new version i tried, I will check.

MPanknin commented 3 months ago

Support for potree format v2 is available since version 0.3.0. https://github.com/pnext/three-loader/pull/139