PLY file format and related errors

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
acasta69
Developer
Developer
Posts: 472
Joined: Tue Jan 09, 2018 3:45 pm
Location: Italy

PLY file format and related errors

Post 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.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: PLY file format and related errors

Post 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.
Support LuxCoreRender project with salts and bounties
acasta69
Developer
Developer
Posts: 472
Joined: Tue Jan 09, 2018 3:45 pm
Location: Italy

Re: PLY file format and related errors

Post 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 :)
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87
Post Reply