All vertex colors are white if BufferAttribute is backed by Uint8Array
See original GitHub issueDescription of the problem
I am trying to render a point cloud from a Kinect device. My colors are coming from a Uint8Array
of RGBA data. However all my points are always white. I adopted the example at https://threejs.org/examples/?q=points#webgl_buffergeometry_points and managed to get it to work with the vertex positions but cannot get the colors from my Uint8Array.
I found this bug #8358 which has been closed as fixed. The jsfiddle mentioned in that bugreport has the same problem I am seeing.
https://jsfiddle.net/huningxin/594jjzb9/3/ (original fiddle from bug #8358) https://jsfiddle.net/h3c62gs5/ (version which also sets normalized to false)
The fiddle has code for both Float32Array
and Uint8Array
and if I switch back and forth the vertices get colors (float32) or turns all white (Uin8t).
Three.js version
- Dev
- r111
Browser
- Electron 7.1.1
- Edge Insider (based on Chromium)
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Closing. Please use the fourm if you need more help.
Yes, but I just want to highlight that this type of array represents integers. It seems more right to me to provide integers to the array in the first place.
Uint8Array
holds (integers) values in the range of[0,255]
. You need to normalized this data into the range of[0,1]
(floats) so the shader is able to correctly process the color values. Please read the docs for more information about this topic:https://threejs.org/docs/index.html#api/en/core/BufferAttribute