LGEO Libray for POV-Ray
The LGEO library is a fan created collection of definitions for LEGO™ Geometrical Equivalent Objects (called parts from here on) to be used with POV-Ray. It is no way related or sponsored by the LEGO™ Group and free of charge. It may be redistributed freely while copyright of the intellectual property remains with the author. The LEGO logo displayed on the studs is under copyright of the LEGO™ Group.
I started creating the parts in 1997, when there was no other option to create POV-Ray renderings from models created with James Jessiman's LDRAW program. Back then, there also was a l2p program to convert the models, based on binary files lg_color.tab and lg_elmnt.tab. Until some point in 2000 irregular updates were published. Lars C. Hassing created the L3P program, which not only performs the tasks of l2p but also is able to create POV-Ray code for parts not in the LGEO library. As it was still depending on the tab files, it was stuck to the LGEO parts created until 2000. In 2007, Lars and I came up to communicate frequently for new versions of L3P and LGEO with better support for each other. The l2p program is officially out of support, as I will focus on creating the LGEO parts. The tab files were replaced by the better readable lst files. Additionally, I was given permission from Anton Raves to create shortcuts to some of the parts in his library, kept distinct from the LGEO parts by prefixing with ar instead of lg , as I do not have and want the copyright and reputation for his original creations. Also, all files have been checked to be usable with stud logos correctly, and not to produce so many warnings as before when used with POV-Ray 3.1 or higher (initially, it was done for 3.0, which had less restrictive syntax). All errors reported and collected by Lars during the years 2000 to 2007 have been fixed.
The full package should include the folder lgeo , which includes LGEO.pdf , lg_element.lst and lg_colors.lst. The two subfolders ar and l g contain the object definition files, named lg_xxxx.inc and ar_xxxx.inc respectively, where xxxx is four or more alphanumeric characters representing the corresponding LDRAW DAT file. The lg folder also should contain the files lg_defs.inc a n d lg_color.inc. The LGEO colors include all colors defined in the ldconfig.ldr , adjusted a little to my personal preference, some of the colors seemed to bright in my opinion.
I stopped LGEO in 2000 because I ran out of time with my studies and a job for a living. I still noticed renderings using the LGEO parts, which finally let me start over with it, also as I have more time again. So, I hope to have fun with it for the future to create more and more parts. If you
encounter any problems with specific parts, feel free to mail me, so I can try to fix it. To be honest, I think I have very high expectations towards quality of LGEO parts, that why I officially refuse to include any sent material in the official distribution of this library in most cases. Some part of me is sorry for that, some part wants the credit all for myself... Anyway, I hope you have fun with the package!
Basically, nothing more than POV-Ray version 3.1 or higher, or compatible Renderer is the only requirement to make use of the files. To be used nicely with L3P, copy the lgeo and ar folders to your LDRAW folder.
Copy the lgeo folder wherever you want, just be sure to make POV-Ray find the files when including them, best way is to add them to the search path for include files. Refer to your POV-Ray manual on help for this topic. However, for the easiest use with L3P copy the lgeo folder to your LDRAW folder. If you want to make use of Anton Raves parts, you need to download his library (not included for copyright issues here) from his website http://www.antonraves.nl/downloads.php. Select the Library Link to download the latest version. As Anton uses version numbers in the filenames which can not be foreseen, the ar files refer to ar_library.inc and ar_material.inc. So you have to rename or symbolic link (alias) this files from Anton files, usually called library_xxx.lib and material_xxx.lib , where xxx is the version number. Make sure also this files are found by POV-Ray. The ar files in this distribution just contain reference from part number to Anton's name of the parts with scaling and orientation to match corresponding LDRAW parts.
2.3. Standalone usage
Well, it is possible but not recommended. LGEO uses a different coordinate system and scaling than LDRAW, so it may be pretty hard to build a model by placing the parts by hand. In LGEO, for historic reasons Y axis is the depth axis, and Z is the up axis, where also Z has switched sign to LDRAW Y axis. Sorry for that, but my understanding of coordinate to this time was a flat standard XY coordinate system with a third Z axis coming out of the plane. Scaling is to real measurements, where 1 POV-Ray unit is 10mm. So 0.8 is 20 LDU (width of a LEGO™ brick) and 0.96 is 24 LDU (height of a LEGO™ brick). If you want to try, go ahead. But you should be familar with POV-Ray to have some success. LGEO is clearly meant to work best with L3P, which is available for Linux, Windows™ and Mac OS X™.
2.4. Usage with L3P
L3P by Lars C. Hassing is a converter tool for LDRAW or compatible model files. It can be downloaded from his website at http://www.hassings.dk/l3/l3p.html. L3P needs to know where the lgeo folder is, because it uses lg_colors.lst and lg_elements.lst to gather information about which colors and parts are available in LGEO. The easy way is to copy the lgeo folder to your LDRAW folder. If you would like to have the lgeo folder elsewhere, then you must to set the environment variable LGEODIR or use the -lgd option to tell L3P the location of this folder. Output of L3P should be renderable by POV-Ray from scratch if all is set up correctly. If you are experienced or want to learn about, feel free to play around with the files produced by L3P to modify the scene to your likes.
3. Technical Information
This section is for the interested, but not necessarily needed if you just want to run L3P and render the output files.
3.1. File and Object Names
The File names are basically the same as corresponding LDRAW parts names, prefixed with lg or ar , and names (numbers mostly) expanded with leading 0s if shorter than 4 characters for historical reasons (l2p based on numbers only). If parts come in different versions, characters as a,b,c etc. Are suffixed, not touching the basic at least 4 characters. Sounds confusing? So, lg_0013b.inc refers to 13b.DAT in LDRAW, lg_30030p01.inc refers to 30030p01.DAT. The objects to be used in POV-Ray have the same name as the filename, missing the .inc suffix. Characters not being usable in POV-Ray object names are replaced by underscore characters “”, as in lg_3062_old.inc , referring to 3062-old.DAT. All DAT and LGEO name relations are listed in lg_elements.lst. Since official release in late 2008, lg changes.txt lists all additions and bug fixes applied to the LGEO library.
3.2. Color Names
Colors are defined in lg_color.inc. Color names are prosaic with lg prefix, if not sure take a closer look, all colors are noted with number from ldrconfig.ldr. Some colors have aliases, as lg_teal (old name) refers to lg_dark _ turquoise. Also all color number and name relations are listed in lg_colors.lst.
3.3. Global declarations
In lg_defs.inc there are several global declarations you might to experiment with. Some parameters are declared at the beginning of the file with explanations. As long as you prefer the LGEO parts to render nicely, do not change the numeric declarations listed in the dimensions section.
3.4. Known Problems
There is a lot of precolored parts in the LDRAW library. In LGEO, they are created as reference to the uncolored parts and a texture is added. For example lg_300101, Brick 2 x 4 is created of object lg_3001 with material lg_white. Although this has a color, it could be specified to have another color, though it does not have any effect in LDRAW. So if a model would use 300101.DAT in color 4 maybe, it still should be white. In POV-Ray, the white color from the lg_300101 would be substituted with the other color 4. To avoid this, lg_300101 is created as union (lg_300101) of object lg_3001, and the union attached material lg_white. So when using object lg_300101 and specifing another color, it keeps white. But as there actually is only one object in lg_300101, POV- Ray produces a warning for “Should have at least 2 objects in csg”. Currently, I do not know a fix for this, and it works. My advice would be not to use precolored parts.
Recent development of LGEO library was done on an Intel-based Mac Mini running Mac OS X™ 10.4.10/11, using MegaPOV 1.2.1 for rendering. MegaPOV 1.2.1 is based on POV-Ray 3.6. There is still no official Intel-compiled version of POV-Ray for Mac OS X, so I used this version. Basically, LGEO should work with any POV-Ray from 3.1 up.