Page 1 of 1
The colors are being inverted when sampling points from a FBX model
Posted: Fri Jun 06, 2025 7:40 pm
by omarladen
I have a FBX model that has a color for each element, which is represented in hexadecimal. When using the option "Sample points on a mesh" to generate the cloud, I noticed that the resulting RGB for each element is being saved as (255,255,255) - (R,G,B) + (1,1,1). I wanted to know what is the reason for this, beacause I then have to make the reverse operation to correct
Re: The colors are being inverted when sampling points from a FBX model
Posted: Tue Jun 10, 2025 8:43 pm
by daniel
Hum, hard to know.
We simply set the vertex color with an FbxColor element initialized as R/255, G/255, B/255 (see
https://github.com/CloudCompare/CloudCo ... r.cpp#L353).
No inversion, or shift by +1. Is the issue coming from the FBX reader maybe?
Re: The colors are being inverted when sampling points from a FBX model
Posted: Wed Jun 18, 2025 7:55 pm
by omarladen
For more details, I am converting a colored NWD model to FBX using Navisworks 2024, and if I export it in ascii I can clearly see the colors in hexadecimal. And then in CloudCompare v2.14.alpha I import the bin FBX, select all items and make Sample point on a mash. The get colors is from material/texture, and then save them in CSV using non float RGB. The colors always get inverted.
Re: The colors are being inverted when sampling points from a FBX model
Posted: Sat Jun 21, 2025 8:36 am
by daniel
Are you able to share the original FBX file with me? (
admin@cloudcompare.org)
Re: The colors are being inverted when sampling points from a FBX model
Posted: Mon Jun 23, 2025 12:35 pm
by omarladen
I cannot send the entire FBX bc its a confidential company data. But I will send soon a sample of how the ascii FBX is
Re: The colors are being inverted when sampling points from a FBX model
Posted: Tue Jun 24, 2025 11:46 am
by omarladen
I have sent and email with an example of a FBX with inverted colors
Re: The colors are being inverted when sampling points from a FBX model
Posted: Tue Jun 24, 2025 7:04 pm
by daniel
So I see that the issue comes from the fact that the color components in this FBX file are stored as integers between 0 and 255, while CC expects floating point values between 0 and 1. Which is consistent with the fact that color components are stored as doubles, and the few examples I've found all use floating points values between 0 and 1:
https://help.autodesk.com/view/FBX/2020 ... utils_html
https://forums.autodesk.com/t5/fbx-foru ... -p/5960494
Even Unity seems to expect floating points values between 0 and 1:
https://discussions.unity.com/t/fbx-imp ... fix/530777
Unless there's a property in FBX files to explicitly declare whether colors are stored with one convention or the other?
Otherwise I would challenge the choice of Navisworks to use the integer format to store colors in double fields.
Re: The colors are being inverted when sampling points from a FBX model
Posted: Wed Jun 25, 2025 1:24 am
by omarladen
Thank you very much for the reply. I forgot to mention that I am using a unique method of coloring elements that is in development, so I will check if I am able to correct it and use a standard way of storing the colors.