[Bug] Missing color property
Loader
Las loader
Description
I'm trying to load the attached LAS file, but the RGB information seems to be missing—all the colors are showing as [0,0,0,255]. However, I know the color data is present because the colors display correctly when I open the file with LiDARView using the RGB settings.
Model: https://mega.nz/file/T4VGyCwC#B0D_F4Cp9LU7mJrQgpJgf3s7NxGB8x84MkGy78QkeKs
Expected Behavior
Model with colors
Steps to Reproduce
const bytes = readFile("path");
const data = parseSync(bytes, LASLoader);
const colors = data.attributes['COLOR_0'];
// All colors are [0, 0, 0, 255]
Environment
- Framework version: [email protected]
- Browser: Chrome 129
- Node: 20.13
- OS: Windows 11
Logs
No response
Thanks for reporting.
- The LAS loader is a wrapper around a compiled WASM library so loaders.gl is just trying to interpret and package the output of that rather opaque code.
- If you could do some debugging by putting breakpoints in the loader and see if there is information coming from the WASM code that is not being forwarded by the JavaScript wrapper, that would be very helpful.
Color is extracted here https://github.com/visgl/loaders.gl/blob/master/modules/las/src/lib/parse-las.ts#L44
On the line 144: https://github.com/visgl/loaders.gl/blob/e4946a503c1ec0460363c834e4e9c386c91ee98b/modules/las/src/lib/parse-las.ts#L114
Colors on the right side are: [20224, 21504, 16384, ...] but on the loader output I have colors [0,0,0,255, ...].
is there any progress
Update
My model has 16b colors, but the default value for options LASLoader is 8b. You can change options for the loader to 'detect' color depth:
const data = parseSync(bytes, LASLoader, { las: { colorDepth: 'auto', fp64: true } });
Shouldn't this be a default value for colorDepth? Same for fp64: true?
If you don't know what models you will be opening these options should be set.
Update
My model has 16b colors, but the default value for options LASLoader is 8b. You can change options for the loader to 'detect' color depth:
const data = parseSync(bytes, LASLoader, { las: { colorDepth: 'auto' } }); Shouldn't this be a default value for colorDepth? Same for fp64: true?
If you don't know what models you will be opening these options should be set.
Thank you, the color value was successfully obtained according to your method