-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writePLY() exports vertex colors as float instead of uchar #425
Comments
I think an argument could be made that those other applications should support float, but uchar is indeed the recommended type. The trouble is that the current code puts together a big matrix of values and writes them all using the float format. Mixing some float and some uchar will make writing more complicated and probably slower. Still, I suspect the speed difference doesn't matter, so I'll look into it. |
@aidanmorales : Okay, I have made some changes, but I don't use PLY format much, so I don't know if they are correct. In particular, the colors aren't being displayed the way they look in R, but that might be the fault of the viewer (which is F3D 2.4.0). Could you build |
@dmurdoch Thanks for looking into this! I tested your new patch in my package and everything works flawlessly. In terms of the speed difference, |
fix writePLY to handle colors properly. Fixes #425.
Hi. I am using your excellent rgl library in my package rTwig to efficiently export and visualize cylinder meshes of tree. I found an issue with the
writePLY()
function on both the latest CRAN and development versions.The issue is that custom colors applied to vertices display correctly in the plotting window, but are not correctly applied when using
writePLY()
, and do not display properly when opening the file in third party applications. I believe the issue is that the header of the .ply file assigns the RGBA colors as float, instead of uchar.If I manually edit the header of the exported .ply file:
property float red
property float green
property float blue
property float alpha
to
property uchar red
property uchar green
property uchar blue
property uchar alpha
the colors are now displayed properly in third party applications, such as CloudCompare, for example. Is it possible to modify
writePLY()
to export RGBA colors as unsigned char instead of floating point?Here is a reproducible example:
The issue was also documented in this stackoverflow thread a few years ago: https://stackoverflow.com/questions/39239298/
The text was updated successfully, but these errors were encountered: