xeokit / sdk

Next-generation alpha-status xeokit viewer in development
https://xeokit.github.io/sdk/docs/api/index.html
GNU Affero General Public License v3.0
18 stars 10 forks source link

Update colors to be normalized #31

Open paireks opened 5 months ago

paireks commented 5 months ago

Correct me if I'm wrong, colors in xeokit v3 should be normalized (0-1 range)?

paireks commented 5 months ago

Additionally I can try to update face_colors, but I'm thinking what would be the best way. In .bim each element can have face_colors attached. I see SceneGeometryParams contains colors, but these are vertex colors. Should I convert face_colors array into vertex colors array and try to place it there?

xeolabs commented 5 months ago

Correct me if I'm wrong, colors in xeokit v3 should be normalized (0-1 range)?

Yes, in the SceneMeshes they are stored as normalized values between [0..1], then internally stored in textures as [0..255] for drawing by the shaders (to use 8-bits for minimal storage size in the texture).

xeolabs commented 5 months ago

Additionally I can try to update face_colors, but I'm thinking what would be the best way. In .bim each element can have face_colors attached. I see SceneGeometryParams contains colors, but these are vertex colors. Should I convert face_colors array into vertex colors array and try to place it there?

Yes, I think this is the way to go.