Page 1 of 1

PLY file format and related errors

Posted: Mon Mar 26, 2018 5:33 pm
by acasta69
Is it correct that PLY files should have LF terminated lines?
And if lines terminate with LF+CR, is it so that luxcore cannot read them?

I found out by chance that I could not render some scenes, including some of those in the luxcore repo.
For example, with python I got this when loading the cornell box scene:

Code: Select all

RPly: Not a PLY file. Expected magic number 'ply\n'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Unable to read PLY mesh file 'scenes/cornell/Khaki.ply'
Again by chance, I found that I had some files with LF+CR line termination and some with Unix-style. Setting them all to LF termination solved the problem.

I would imagine that under Windows one might want to load a LF+CR style file, but preferred to ask before opening a bug report.

Re: PLY file format and related errors

Posted: Mon Mar 26, 2018 8:33 pm
by Dade
acasta69 wrote: Mon Mar 26, 2018 5:33 pm Is it correct that PLY files should have LF terminated lines?
And if lines terminate with LF+CR, is it so that luxcore cannot read them?
I think so. The header is in text format but the vertices/etc. are nowadays in binary format (check the files exported by BlendLuxCore for .ply files) so it must be considered a binary file.

You may have a just misconfigured GIT, the .gitattributes file should look like:

Code: Select all

*.ply	binary
Otherwise GIT will translate all LF into LF+CR at the checkout on Windows thinking of a text file and, effectively, corrupting the PLY.

Re: PLY file format and related errors

Posted: Tue Mar 27, 2018 7:06 am
by acasta69
Dade wrote: Mon Mar 26, 2018 8:33 pm I think so. The header is in text format but the vertices/etc. are nowadays in binary format (check the files exported by BlendLuxCore for .ply files) so it must be considered a binary file.

You may have a just misconfigured GIT, the .gitattributes file should look like:

Code: Select all

*.ply	binary
Otherwise GIT will translate all LF into LF+CR at the checkout on Windows thinking of a text file and, effectively, corrupting the PLY.
Thanks for the explanation.
GIT configuration was ok, so I don't understand how it happened...
Anyway, they are again all correct now :)