L3P -sw<w>   the Seam Width option

To have more realistic renderings L3P can make a little space between the bricks. In the perfect geometric world of LDraw bricks fit hermetically together. Until today you couldn't tell where in the POV-Ray renderings one brick ended and the next brick (with same color) started. In the real world bricks have a little gap between them to ease building.

The Seam Width <w> is the width in LDraw units of the seam (gap) between two adjecent bricks. The default seam width is 0.5 LDraw units (LDU). If you do not want any seams, just specify a value of zero (-sw0). Note (as you can read below) that transparent bricks are always scaled a little (0.001).

The -sw<w> option sets the initial seam width written in the POV-file. L3P will generate a line in the beginning of the POV-file like:

#declare SW = 0.5;  // Width of seam between two bricks
The value can be changed at any time before a new rendering, conveniently in the editor in POV-Ray for Windows.
Only parts from the PARTS directory are scaled by the -sw option.
No seams
l3p -b -f m603 -sw0
The default seam width 0.5 LDU
l3p -b -f m603
Seam width 1 LDU
l3p -b -f m603 -sw1
Seam width 1.5 LDU
l3p -b -f m603 -sw1.5
Seam width 2 LDU
l3p -b -f m603 -sw2
Seam width 6 LDU
l3p -b -f m603 -sw6

Scaling of parts

Because of the perfect geometry of the LDraw parts, many surfaces coincide. Two adjecent bricks share a common surface. Normally this is not a problem because the surface between the bricks obviously is invisible. But for transparent parts we have a real problem.

Let's have a look at an example. The DAT file

 1 0 0 0 0 1 0 0 0 1 0 0 0 1 3031.DAT
 1 43 0 -48 10 1 0 0 0 1 0 0 0 1 3823.DAT
 is converted by L3P to this POV code:
object { _3031_dot_dat matrix <1,0,0,0,1,0,0,0,1,0,0,0> texture { Color14 } }
object { _3823_dot_dat matrix <1,0,0,0,1,0,0,0,1,0,-48,10> texture { Color43 } }
which generates the image to the left (both are 320x240 no AA):

Speckles caused by coincident surfaces Speckles are gone because the window is shrinked a tiny bit

We see a lot of speckles where the window and the plate meet. This is caused by the coincident surfaces of the window and the plate, and by very small numerical inaccuracies. One time the window's surface is hit first by a viewing ray, resulting in the window's color, and another time the plate is hit first, leading to the plate's color. Turning on Anti-Aliasing reduces the problem, but not sufficiently.

The solution is to scale e.g. the window just a little bit, let's say by 0.9999. This scaling is so modest that you won't notice the window shrinking, but enough for avoiding coincidence of surfaces. Changing the POV code to:

object { _3031_dot_dat matrix <1,0,0,0,1,0,0,0,1,0,0,0> texture { Color14 } }
object { _3823_dot_dat scale 0.9999 matrix <1,0,0,0,1,0,0,0,1,0,-48,10> texture { Color43 } }
gives the right image (pun intended :-)

I was thinking about scaling ALL parts by 0.9999. While experimenting with the scaling I made a rendering just for fun with all parts scaled by 0.9:

All parts scaled by 0.9

This lead to the following idea: why not scale the parts so that they become e.g. 0.25 LDraw units shorter in every end? In this way you could have a space between parts of 0.5 Ldraw units. A 1x16 brick (dimension <320,24,20>) should be shrinked to <319.5,23.5,19.5> by scaling it by <319.5/320,23.5/24,19.5/20> = <0.9984,0.9792,0.9750> about its center, whereas a 1x1 plate (dimension <20,8,20>) should be scaled by <0.975,0.9375,0.975> about its center. The POV code is now generated like:

#declare SW = 0.5;  // Width of seam between two bricks
#declare SWT = (SW ? SW : 0.001);  // At least a small seam when transparent

// 1 14  0 0 0  1 0 0  0 1 0  0 0 1 3031.dat
object {
        matrix <1-SW/80,0,0,0,1-SW/12,0,0,0,1-SW/80,0,SW/6,0>
        matrix <1,0,0,0,1,0,0,0,1,0,0,0>
        #if (version >= 3.1) material #else texture #end { Color14 }
// 1 43  0 -48 10  1 0 0  0 1 0  0 0 1 3823.dat
object {
        matrix <1-SWT/80,0,0,0,1-SWT/52,0,0,0,1-SWT/40,0,SWT/2.36364,SWT/-4>
        matrix <1,0,0,0,1,0,0,0,1,0,-48,10>
        #if (version >= 3.1) material #else texture #end { Color43 }
SWT assures that transparent parts are always scaled a little.

L3P main page
Lars C. Hassing's Homepage

Last updated November 16, 2002  Created December 21, 1998