Upload
others
View
10
Download
0
Embed Size (px)
Citation preview
Building 3D Models Using PlasticConstruction Bricks
Nathan Cournia Karl Rasche and Andrew Van Pernis
acnatha rkarl arakelvrclemsonedu
Clemson University
Computer Science Department Colluquium Series ndash p1
Outline
Computer Science Department Colluquium Series ndash p2
Outline
Motivation
Representing 3D Models As Voxels
Representing 2D Images As Voxels
Converting Voxels To Plastic ConstructionBricks
Results
Computer Science Department Colluquium Series ndash p3
Motivation
Computer Science Department Colluquium Series ndash p4
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Outline
Computer Science Department Colluquium Series ndash p2
Outline
Motivation
Representing 3D Models As Voxels
Representing 2D Images As Voxels
Converting Voxels To Plastic ConstructionBricks
Results
Computer Science Department Colluquium Series ndash p3
Motivation
Computer Science Department Colluquium Series ndash p4
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Outline
Motivation
Representing 3D Models As Voxels
Representing 2D Images As Voxels
Converting Voxels To Plastic ConstructionBricks
Results
Computer Science Department Colluquium Series ndash p3
Motivation
Computer Science Department Colluquium Series ndash p4
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Motivation
Computer Science Department Colluquium Series ndash p4
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Problem Definition
Problem Given a three-dimensional model howcan we build that model using plasticconstruction bricks
Our answer Create a voxelization of the modelthen represent that voxelization as a set ofLDraw parts which have been carefully selectedto produce a buildable version of the model
Computer Science Department Colluquium Series ndash p5
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Problem In Pictures
rarr
Computer Science Department Colluquium Series ndash p6
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Motivation
Artistic expressionMosaicsSculpturesMusic videosAnimations
Technical idea + creativityrArr publication
Block construction turns out to be aninteresting problem
Computer Science Department Colluquium Series ndash p7
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Representing 3D Models As Voxels
Computer Science Department Colluquium Series ndash p8
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxelization
Given a polygonal model generate a set ofvoxels
Computer Science Department Colluquium Series ndash p9
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
What is a voxel
A small 3D box with some properties(density color etc)
Short for volume element
3D counterpart of a 2D pixel
Computer Science Department Colluquium Series ndash p10
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxelization
Process of converting a geometricrepresentation of a synthetic model into a setof voxels
Some processes are easier to use whenoperating on voxel data
Computing VolumeCSG (Intersection Union etc)Collision Detection
The reverse is also true Voxels are notoptimal for everything
Computer Science Department Colluquium Series ndash p11
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxelization
Several methods for generating avoxelization exist
Casting RaysScan Converting
Most are not pretty to code
Can be slow
Can we speed it up Yes use the GPU
See httpwwwcssunysbedu vislabprojectsvolumePapersVoxel
Computer Science Department Colluquium Series ndash p12
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Hardware Accelerated Voxelization
Modern graphics hardware is fast (exceedingMoorersquos Law)
Modern graphics hardware is programmable
Computationally expensive algorithms arebeing offloaded to the GPU
Fast Fourier TransformGlobal Illumination ComputationsPath Finding (AI)Collision Detection
Computer Science Department Colluquium Series ndash p13
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Hardware Accelerated Voxelization
Turns out we donrsquot need to use theprogrammable GPU
Standard fixed function color and depthbuffers will suffice
Color buffer stores the color of each pixel inthe rendered scene
But what is the depth buffer
Computer Science Department Colluquium Series ndash p14
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Depth Buffer
Also known as the Z-buffer
Stores the depth of each pixel in the scene
Values range from [01]
Usually initialized to 1
Smaller values are closer to the near clipplane (camera)
Traditionally used for hidden surface removal
Computer Science Department Colluquium Series ndash p15
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Depth Buffer Example
Computer Science Department Colluquium Series ndash p16
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
HW Voxelization Algorithm
Center mesh around world origin
Set viewport to NtimesN where N is the size of adimension in the NtimesNtimesN voxel lattice
Render scene through a tightly fittedorthographic (parallel) projection from eachside of the modelrsquos bounding box
Record depth and color buffers from eachrender
Produces six set of images (6 color bufferimages 6 depth buffer images)
See httpwwwacmorgjgtpapersKarabassiEtAl99b
Computer Science Department Colluquium Series ndash p17
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
DepthColor Buffer Visualization
FrontBack
Computer Science Department Colluquium Series ndash p18
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
DepthColor Buffer Visualization
LeftRight
Computer Science Department Colluquium Series ndash p19
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
DepthColor Buffer Visualization
TopBottom
Computer Science Department Colluquium Series ndash p20
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Determing if a Voxel is On
For each voxel in the lattice compute thedistance to each side of the cube
Test if this distance is bounded by the depthbuffers in each axis
If so voxel is inside otherwise its outside
Holes not visable from outside the object willbe filled
Computer Science Department Colluquium Series ndash p21
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Determining a Voxelrsquos Color
Find the depth map which is closest to thevoxel
Look up the voxelrsquos color in the depth maprsquoscorrespoding color map
Interior voxels share the same color asclosest surface voxel
Computer Science Department Colluquium Series ndash p22
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxelization Algorithm Notes
Works for polygonal and analytical models
Efficiency is independent of modelcomplexity
Voxelizes data in O(n)
Does not handle concave models
Computer Science Department Colluquium Series ndash p23
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxel Visualization
Can view voxel data as slices
Viewing voxel data is useful for manyapplication specifically in medicine
See httpwwwnlmnihgovresearchvisiblevisible_humanhtml
Computer Science Department Colluquium Series ndash p24
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Plastic Construction Brick Specifics
Plastic Construction Bricks are not cubes
A 1times1 brick has a 56 aspect ratio
Model must be squashed during voxelizationto perserve aspect ratio
Computer Science Department Colluquium Series ndash p25
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Demo
Computer Science Department Colluquium Series ndash p26
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Representing 2D Images As Voxels
Computer Science Department Colluquium Series ndash p27
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Voxelization of Images
Goal Given any 2D image output avoxelization
Pixels directly correspond to a voxel slice
Perform image scaling to reduceenlarge todesired number of voxels
Computer Science Department Colluquium Series ndash p28
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Brick Mosaics
Studs-up Studs-out
X-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Brick Mosaics
Studs-up Studs-outX-Y plane X-Z plane
Computer Science Department Colluquium Series ndash p29
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Giving Voxels Color
Platic Construction Bricks have a limitednumber of colors
Convert image to brick palette
Problem Limited number of colors in brickpalette causes banding
Computer Science Department Colluquium Series ndash p30
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Converting to Brick Palette
Solution Dither the image
Dithering is the addition of a sub-quantumsignal (often high frequency noise) to asignal of interest that is being quantized
Many dithering algorithms exist
Computer Science Department Colluquium Series ndash p31
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Dithering
We use Floyd-Steinberg dithering
Spreads error in quantization overneighboring pixels
Computer Science Department Colluquium Series ndash p32
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Generating a Construction Plan
We use a simple greedy algorithm thatprocesses 1 brick row at a time
Computer Science Department Colluquium Series ndash p33
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Converting Voxels To PlasticConstruction Bricks
Computer Science Department Colluquium Series ndash p34
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
What Is LDraw
Originally DOS programs LDraw and LEditwith a file format representing severaldifferent plastic construction brick shapes
Many editors have been developed using theLDraw parts file format
Programs exist to convert to a variety of 3Dapplications
Maintained by a standards committee now
Computer Science Department Colluquium Series ndash p35
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
LDraw File Format
ASCII text
First value is an integer indicating line type
Line Type
0 comment or meta-command
1 reference to another LDraw file
2 line between two points
3 triangle
4 quadrilateral
5 conditional line between two points
Computer Science Department Colluquium Series ndash p36
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
LDraw File Format (cont)
Reference line type is as follows1 ltcolorgt lttransformation matrixgt ltfile namegt
Line between two points is as follows2 ltcolorgt ltpoint1gt ltpoint2gt
Triangle line type is as follows3 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt
Quadrilateral line type is as follows4 ltcolorgt ltpoint1gt ltpoint2gt ltpoint3gt ltpoint4gt
Computer Science Department Colluquium Series ndash p37
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
LDraw Conventions
Brick Sizes - given using aWidthtimesLengthtimesHeight notation
Part Numbers - each different brick is given aunique part number attempts to match thoseused by the LEGOtrade Corporation
Colors - based on those used by the LEGOtradeCorporation each is assigned a uniqueinteger
Computer Science Department Colluquium Series ndash p38
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
The Simple Answer
Replace each voxel with a 1x1 brick of theappropriate color Interior voxels can beassigned any color desired
Problem This solution does not create abuildable version of the model
Computer Science Department Colluquium Series ndash p39
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Algorithm Goals
Replace neighboring voxels of the samecolor with an appropriate brick
Check for support for a brick in the layerabove or below
Use 2timesn bricks whenever possible
Avoid 1times1 bricks whenever possible
Fix building impossibilities
Computer Science Department Colluquium Series ndash p40
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithm
Voxelization is of size xsize times ysize times zsize
Consider only an X-Z slice of the voxelization
Search for adjacent voxels in the X directionfirst
Search for adjacent voxels in the Z directionsecond
Replace neighboring voxels with the largestbrick possible
Computer Science Department Colluquium Series ndash p41
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithmrsquos Bricks
1 times 1 1 times 2 1 times 3 1 times 4 1 times 6 1 times 8
2 times 2 2 times 3 2 times 4 2 times 6 2 times 8
Computer Science Department Colluquium Series ndash p42
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithm (cont)
for (i=ysize minus 1 ige0 i--)
for (k=0 klt zsize k++)
j=0
while (jlt xsize)
start x = FindFirstVoxelX()
end x = FindLastVoxelX()
while(start x le endx)
length x = endx - start x + 1
if (length x == 1)
startz = k
endz = FindLastVoxelZ()
lengthz = endz - startz + 1
Computer Science Department Colluquium Series ndash p43
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithm (cont)
if (lengthz == 1)
AddBrickZ(1times1)
else if (lengthz == 2)
AddBrickZ(1times2)
else if (lengthz == 4)
AddBrickZ(1times4)
else
AddBrickZ(1times3)
start x += 1
else if (length x2 = 0)
AddBrickX(1times3)
start x += 3
Computer Science Department Colluquium Series ndash p44
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithm (cont)
else if (length x le 8)
AddBrickX(1timeslength x)
start x += length x
else if (length x == 10)
AddBrickX(1times6)
start x += 6
AddBrickX(1times4)
start x += 4
Computer Science Department Colluquium Series ndash p45
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
A Greedy Algorithm (cont)
else if (length x == 12)
AddBrickX(1times6)
start x += 6
AddBrickX(1times6)
start x += 6
else
AddBrickX(1times8)
start x += 8
j = endx + 1
Computer Science Department Colluquium Series ndash p46
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Improvements
Alternate primary greedy direction betweenX and Z
Use L-shaped corner pieces
Connect ldquofloatingrdquo pieces
Use bricks taller than 1
Push smaller bricks to the center
Computer Science Department Colluquium Series ndash p47
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Results
Computer Science Department Colluquium Series ndash p48
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Bauul
Computer Science Department Colluquium Series ndash p49
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Beachball
Computer Science Department Colluquium Series ndash p50
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Bunny
Computer Science Department Colluquium Series ndash p51
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Construction Plans
Use a program called LPub
Insert step meta-commands between eachX-Z slice
Example plans
Some reworking done during build
Computer Science Department Colluquium Series ndash p52
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
References
Computer Science Department Colluquium Series ndash p53
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
References
ldquoA Fast Depth-Buffer-Based Voxelization AlgorithmrdquoEvaggelia-Aggeliki Karabassi GeorgiosPapaioannou and Theoharis TheoharisACM Journal of Graphics Tools 4(4)5-101999
LDraw website httpwwwldraworg
ldquoVolume Graphicsrdquo Arie Kaufman Daniel Cohenand Roni Yagel IEEE Computer Vol26 No7 July 1993 pg 51-64
Computer Science Department Colluquium Series ndash p54
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55
Media
All source code publically available (via CVS)
uber httpgraphicsvrclemsonedu
CVShttpjetvrclemsoneduviewcvsviewcvscgiuberdemoslegocvsroot=UBER
Computer Science Department Colluquium Series ndash p55