http://underpop.online.fr/n/nielshorn Random thoughts, tips & tricks about Slackware-Linux, Lego and Star Wars Fri, 09 Nov 2012 00:02:45 +0000 http://wordpress.org/?v=2.8.4 en hourly 1 http://underpop.online.fr/n/nielshorn/2011/07/slackware-packages-for-lego-parts-updated/ http://underpop.online.fr/n/nielshorn/2011/07/slackware-packages-for-lego-parts-updated/#comments Thu, 28 Jul 2011 16:57:56 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=1074 The official collection of Lego parts from was updated this week.

This collection of “virtual” pieces is used by programs as LDView, ldglite and l3p.
The program uses its own “pieces” library, but is usually updated right after the LDraw parts library.

I updated the scripts for both packages and submitted the results to SlackBuilds.org, where they are waiting for approval.
In the mean time, you can get the script or the pre-built packages from .

]]> http://underpop.online.fr/n/nielshorn/2011/07/slackware-packages-for-lego-parts-updated/feed/ 0 http://underpop.online.fr/n/nielshorn/2011/06/slackware-packages-for-leocad/ http://underpop.online.fr/n/nielshorn/2011/06/slackware-packages-for-leocad/#comments Thu, 30 Jun 2011 02:24:33 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=1045 1 - leocadAnother update that was long over due… 0.75.2 is out, and the pieces library has grown from 3.934 to 4.351 pieces!

The 0.75.2 release mainly resolves some bugs and crashes, but it needs the newer pieces library to work, so do update both packages!

I already submitted the new scripts and the pre-built packages can be downloaded from .

]]> http://underpop.online.fr/n/nielshorn/2011/06/slackware-packages-for-leocad/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/07/new-slackware-packages-for-lego-data-files-and-program/ http://underpop.online.fr/n/nielshorn/2010/07/new-slackware-packages-for-lego-data-files-and-program/#comments Sat, 17 Jul 2010 17:09:07 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=487 New pieces libraries

released its second update for 2010 of the pieces library this month. As always, a short time afterwards the updated pieces library for was also released.

New LeoCAD version

A new version of LeoCAD (0.75.1) was also released, fixing the Minifig wizard that was broken in the previous Linux versions. With it, you can easily create minifigs using all possible combinations of arms, tools, etc. and insert the result in your model.

Here are some examples of what you can do with it:

Darth Vader

Creating the Darth Vader minifig in the wizard

And after using to create a nice image:

An impressive figure...

Han Solo

With a screwdriver, always fixing the Millenium Falcon...

And with some basic ray-tracing:

Judging from his smile, he fixed it again ;)

Downloading

The SlackBuilds have been submitted and are in the pending queue at .
Pre-built packages can be found on my

]]> http://underpop.online.fr/n/nielshorn/2010/07/new-slackware-packages-for-lego-data-files-and-program/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/04/new-ldraw-leocad-library-packages-for-slackware/ http://underpop.online.fr/n/nielshorn/2010/04/new-ldraw-leocad-library-packages-for-slackware/#comments Fri, 16 Apr 2010 02:18:58 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=287 partsVersion 2010-01 of the parts library was released recently, so I created a new easy-to-install Slackware package for it.
As always, shortly after this release, the pieces library was also updated, to version 3506.

Both packages can be downloaded from my .

]]> http://underpop.online.fr/n/nielshorn/2010/04/new-ldraw-leocad-library-packages-for-slackware/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldglite/ http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldglite/#comments Wed, 27 Jan 2010 20:06:52 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=146 Another package has been updated, this time for version 1.2.4

It’s a simple version update that corrects some small bugs.
As always, packages can be downloaded from my while the SlackBuild is in the pending queue.

]]> http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldglite/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-leocad_pieces/ http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-leocad_pieces/#comments Wed, 27 Jan 2010 18:39:24 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=141 The parts library for has been updated and now contains 3.299 pieces.

The updated Slackware package (~ 14MB) can be downloaded from my .

]]> http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-leocad_pieces/feed/ 0 http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/ http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/#comments Fri, 15 Jan 2010 23:45:28 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/?p=130 I built a new package with LDraw_data for Slackware, containing the latest (200903) library from ldraw.org. Check my for the pre-built while the SlackBuild is in pending.

]]> http://underpop.online.fr/n/nielshorn/2010/01/new-package-for-ldraw_data/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/ http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/#comments Thu, 31 Dec 2009 14:19:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=68 After some requests, I created a Slackware package with the lgeo parts library. It can be downloaded from my .

If you prefer, you can download the library from the author’s and use the to create your own package.

]]> http://underpop.online.fr/n/nielshorn/2009/12/lgeo-slackware-package-available/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/ http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/#comments Fri, 25 Dec 2009 14:40:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=67 I created an updated package with the LDRAW Library of Lego pieces that includes all parts up to September, 16th, 2009.

The “unix-complete” file from ldraw.org has not been updated for years, so this package was based on the Windows file “complete.zip” but can be used without any problems under Slackware.

As always, the package can be downloaded from my .

]]> http://underpop.online.fr/n/nielshorn/2009/12/updated-ldraw_data-package-available/feed/ 0 http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/ http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/#comments Thu, 24 Dec 2009 18:58:00 +0000 Niels Horn http://underpop.online.fr/n/nielshorn/blog/?p=66 Some time ago I promised to give some basic instructions on how to create nice images of Lego constructions with POV-Ray on Linux. Now that Christmas is arriving, I finally found some time to convert my own instructions into something that can almost be called a “tutorial” :)

What will you need:

  1. LeoCAD – to “build” your constrution
  2. (optional) a viewer program, like LDView or ldglite
  3. l3p – to convert the .ldr (LDRaw) file to .pov (POV-Ray)
  4. (optional) The “lgeo” parts collection
  5. POV-Ray – the “Ray-Tracer program”

If you use Slackware, you can find packages for all of these on my and SlackBuilds for all except 3 on . For many other Linux distributions packages are available in their repositories.

First step – Build something!

If you do not have any LDraw file yet with a Lego creation, then now is the time to make one.
As an example for this tutorial, I built a little penguin, based on the instructions , with LeoCAD:


Save your creation with LeoCAD as a “.ldr” file (”File” – “Save as” from the menu). The resulting file in my case was:

0 Model exported from LeoCAD
0 Original name: Penguin.lcd
 1 14 -50.00 -0.00 -60.00 -0.00 0.00 1.00 -0.00 1.00 -0.00 -1.00 -0.00 -0.00 3002.DAT
 1 15 -50.00 -24.00 -60.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 15 -50.00 -48.00 -60.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 0 -50.00 -24.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 0 -70.00 -48.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 0 -30.00 -48.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 0 -50.00 -72.00 -40.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3004.DAT
 1 14 -50.00 -72.00 -70.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3003.DAT
 1 0 -50.00 -96.00 -50.00 -1.00 0.00 -0.00 0.00 1.00 -0.00 0.00 -0.00 -1.00 3003.DAT
0

The file can be downloaded from my as well.

Second step – View your model with ldglite or LDView

This step can be skipped, but it is a nice test to check if the programs can find all the LDRAW parts on your computer. LeoCAD uses its own parts library, so being able to view it there does not necessarily mean that the LDRAW library is accessible.

This is how the penguin looks like in ldglite, a simple but very fast program to visualize your creations:


A second option is to use LDView, a very nice and very complete program to visualize your creations. It creates a more realistic view of the model, with some shading effects:

Third step – Ray-Tracing

So the images created by LDView are nice. But we want something even better! Enter POV-Ray, a very professional Ray-Tracing program that is completely free.
It “traces” light-rays, by tracing paths of “light particles” from one or more light sources, bouncing off surfaces and reflecting into the lens of a camera.

So we define the position and colors of the light sources, the position and angle of the camera, the types of surfaces (smooth, reflective, rough, etc.), etc.

Sounds complicated? Well, there is a very nice utility called l3p that tries to do most if it automatically to help us get started. l3p reads an “ldr” file, guesses the best position and angle for the camera so that the whole creation will fit in the image, and sets up three light sources around the model. Then it creates a .pov file that can be read by POV-Ray.

l3p needs to know where the LDRAW library is stored on your computer. This can be set by the LDRAWDIR environment variable like:
$ export LDRAWDIR=/usr/share/LDRAW

Put this in your start-up script like ~/.bash_profile (if you use bash for a shell).

Enough theory, let’s create our first .pov file:
$ l3p -o Penguin.ldr

This reads the “Penguin.ldr” file we created and writes a “Penguin.pov” file in the current directory.
I used just one option – “-o” – which instructs l3p to overwrite Penguin.pov if it already exists, since we’ll perform various tests before we get the final result.

Now let’s run POV-Ray to transform the .pov file into an image:
$ povray +OPenguin.png +FN +P Penguin.pov

The options here mean:

The result should look like this:


For a first test, it’s just about “OK”… But we can do better than this!

Since in most tests we’ll run l3p and povray as a sequence, we’ll put both commands on one line like this:
$ l3p <options> && povray <options>

The “&&” means that the next command is only executed if the previous terminated without error.

So let’s try:
$ l3p -b -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +P Penguin.pov

What did we add:

The result should look like this:


Let’s improve the image a bit more:
$ l3p -b -q4 -bu -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +A +P Penguin.pov

The new options are:

This should be the result:

Advanced options

As I wrote in the beginning, l3p automatically guesses the best position and angle for the camera and light sources. But we can change them as we please.
Let’s try something:
$ l3p -b -q4 -bu -cg40,45 -cpct10 -f -o Penguin.ldr && povray +OPenguin.png +FN +W640 +H480 +A +P Penguin.pov

I included two new options:

Here is the result:


You can play around with the position of the light sources using the “-lg” option. I’ll leave this as an exercise! :)

There are many more advanced options to try. Type “l3p” without any options to see the complete list! If you have a good tip, feel free to post a comment so that I can learn something new.

Using the lgeo library

The images we created with the standard l3p + povray combination look quite good, but when we enlarge the images, the pieces look a bit unrealistic, with edges that are too sharp, etc.

Enter the “lgeo” library of pieces…

The lgeo pieces are specially designed for use with POV-Ray, with more realistic edges, surfaces, etc. l3p can automatically replace all LDRAW pieces with lgeo pieces if a substitute is available (any many are available, at least for the more “standard” pieces).

We just need to include the “-lgeo” parameter (and have the lgeo library installed and “readable” by povray – this needs some configuration…).
This created a nice image of our Penguin at a larger size:
$ l3p -b -q4 -bu -cg40,45 -cpct10 -f -lgeo -o Penguin.ldr && povray +OPenguin.png +FN +W1280 +H960 +A +P Penguin.pov

And this is the result (click on the image to see the full-scale picture):


As you can see, the studs and the edges look more realistic in this picture.

Have fun!

]]> http://underpop.online.fr/n/nielshorn/2009/12/lego-pov-ray-on-linux/feed/ 2