loaders.gl icon indicating copy to clipboard operation
loaders.gl copied to clipboard

[Bug] Missing color property

Open barvirm opened this issue 1 year ago • 2 comments

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

image

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

Logs

No response

barvirm avatar Oct 14 '24 12:10 barvirm

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

ibgreen avatar Oct 14 '24 20:10 ibgreen

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, ...].

barvirm avatar Oct 17 '24 13:10 barvirm

is there any progress

mcu13321 avatar Dec 13 '24 08:12 mcu13321

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.

barvirm avatar Jan 16 '25 15:01 barvirm

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

mcu13321 avatar Jan 17 '25 11:01 mcu13321