LDraw.org Discussion Forums
POV-Ray error - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Rendering Techniques (https://forums.ldraw.org/forum-20.html)
+--- Thread: POV-Ray error (/thread-23718.html)



POV-Ray error - Arjan - 2019-10-19

I'm trying to convert LDraw ldr-files first to a POV-Ray pov-file using pyldraw and then to a png using POV-Ray.

On a Mac I have installed pyldraw using pip and POV-Ray using Homebrew.

As a first simple test I have tried to convert the car.pov from the testdata from pyldraw to png using POV-Ray (basically just using "povray car.pov"). Unfortunately I get the following error message:

Code:
==== [Parsing...] ==========================================================
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 7979:
Parse Warning: Should have at least 2 objects in csg.
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 11261:
Parse Warning: Should have at least 2 objects in csg.
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 16690:
Parse Error: Expected 'object or directive.', float function 'float constant'
found instead
Fatal error in parser: Cannot parse input.
Render failed

I have spent quite some time on Google to find a solution to this but I'm not finding anything closely related. Does anyone know what I'm doing wrong?


RE: POV-Ray error - Johann Eisner - 2019-10-19

(2019-10-19, 6:49)Arjan Wrote: I'm trying to convert LDraw ldr-files first to a POV-Ray pov-file using pyldraw and then to a png using POV-Ray.

On a Mac I have installed pyldraw using pip and POV-Ray using Homebrew.

As a first simple test I have tried to convert the car.pov from the testdata from pyldraw to png using POV-Ray (basically just using "povray car.pov"). Unfortunately I get the following error message:

Code:
==== [Parsing...] ==========================================================
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 7979:
Parse Warning: Should have at least 2 objects in csg.
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 11261:
Parse Warning: Should have at least 2 objects in csg.
File '~/repos/pyldraw-0.8.2/tests/test_data/car.pov' line 16690:
Parse Error: Expected 'object or directive.', float function 'float constant'
found instead
Fatal error in parser: Cannot parse input.
Render failed

I have spent quite some time on Google to find a solution to this but I'm not finding anything closely related. Does anyone know what I'm doing wrong?

Hi
Do you really want to use Pov-ray or could it also be a other program?
Why do not you use Studio2. 0 for rendering?
If you want use Pov-ray, you could also use LDCad to export the model to a .pov file and then render with Pov-ray. You also can use LDCad and export directly to a .png File.


RE: POV-Ray error - Orion Pobursky - 2019-10-19

Since you're using MacOS, I recommend that you use LDView's POV-Ray export instead of pyldraw (which I have never heard of).


RE: POV-Ray error - Johann Eisner - 2019-10-19

(2019-10-19, 14:15)Orion Pobursky Wrote: Since you're using MacOS, I recommend that you use LDView's POV-Ray export instead of pyldraw (which I have never heard of).

Sorry, didn't read that you use a mac.


RE: POV-Ray error - Arjan - 2019-10-20

(2019-10-19, 14:15)Orion Pobursky Wrote: Since you're using MacOS, I recommend that you use LDView's POV-Ray export instead of pyldraw (which I have never heard of).
Hi Orion and Johann,

Thanks for your help. I'm looking for a solution to create a large amount of rendered bricks from the ldraw library in png/jpg format, that is why I'm looking into packages like pyldraw to do this using python and command line tools like POV-Ray to enable automating this stuff, instead of tools having a GUI.

As a first test I tried to render just an example pov-file (from the pyldraw package) using the command line POV-Ray tool. So I haven't used pyldraw yet to convert ldr files to pov files.


RE: POV-Ray error - Travis Cobbs - 2019-10-20

(2019-10-20, 11:27)Arjan Wrote: Hi Orion and Johann,

Thanks for your help. I'm looking for a solution to create a large amount of rendered bricks from the ldraw library in png/jpg format, that is why I'm looking into packages like pyldraw to do this using python and command line tools like POV-Ray to enable automating this stuff, instead of tools having a GUI.

As a first test I tried to render just an example pov-file (from the pyldraw package) using the command line POV-Ray tool. So I haven't used pyldraw yet to convert ldr files to pov files.

While nobody (least of all me) ever accused LDView of being fast at loading files, its latest officially released version does support POV exports from the command line. So you can use it from any command line scripts you create, in Windows, Linux, and macOS.


RE: POV-Ray error - Martin James - 2019-10-21

Out of curiosity I had a look at the pyldraw package (because I'd never heard of it before). I presume the authors generated that car.pov file themselves and it does, indeed, contain 3 coding errors. So the problem probably isn't of your own making.

The first two are UNION statements, but each of them only has one object defined. They have to define two objects in order to calculate the union between them.

The third one is really wierd. It's the last statement in the file, and it looks like some incomplete template information has been left over. It's a PIGMENT definition, but:
-- It is missing the COLOR keyword (or something similar, depending what it's trying to specify)
-- The RGB parameter is supposed to be at least a 3-term vector (for the R, G and B components), not a single HTML-style hash value. The fact that the colour is given as #123456 makes me very suspicious - or it's a large coincidence!

You could try going back a step, and use pyldraw to do your own conversion of car.ldr to car.pov, to see if you get the same result. (And if you do, you need to get back to the package authors for assistance.) You could also try one of the other conversion tools, as suggested in previous replies, to see if things get better.

--
Martin James