Index

Showing posts with label CNC. Show all posts
Showing posts with label CNC. Show all posts

4.29.2016

2D Rectangle Overlap Algorithms


 While working (not so) diligently on the re-write of Holocraft I encountered a situation where the need for an age-old algorithm arose. The algorithm itself, and/or its implementation, has had many minds over the course of time to boil it down to a few bare-necessity lines of code.


Example of the problem and some possible conditions.
From: http://www.owenpellegrin.com/articles/vb-net/simple-collision-detection/

 Determining whether or not two rectangles overlap or intersect has been one of those problems that has found application in many a project. It's rather simple to implement, and most novice programmers take pride in discovering a solution to the problem, even including the case where the algorithm is extended into the 3rd dimension in the form of 'axis-aligned bounding-boxes', or 'AABBs'.


3D axis-aligned bounding boxes intersecting.
From: http://www.miguelcasillas.com/?p=30

 There have been many games which utilize either a 2D or 3D variant of this algorithm to determine if two objects in a game world are colliding with one-another. The original Quake game is an example of a game where entities had their collision volume defined by way of an axis-aligned bounding box. This caused players to axially slide off other objects as if they were a flat cubical shape. Personally, I prefer using a cylindrical or capsule collision volume for players and NPCs, because this gives a smoother collision resolution where the player just sort of slips and slides around other players and objects. Most modern games utilize this sort of collision volume for players nowadays for low-fidelity intersection tests, and sometimes as a pre-test to avoid the cost of doing more intricate intersection tests in the case of hitscan weapons and the like.

 At any rate, during my outset to re-write Holocraft it became clear that it was imperative that there be a way to detect where groove optics are overlapping, or otherwise intersecting one-another due to the fact that many of my trial-holograms thus far have been muddied in areas where the density of intersecting groove optics is too many. Too many intersections and too much overlap of grooves can completely annihilate the clarity of their reflectivity. The solution is to prevent the machining process from scribing over the same areas, allowing the fore-front optics of the hologram to take precedence over the background optics, optimizing the overall clarity of the hologram as a whole.


A screenshot of the new Holocraft showing the geometry and optics of a moderately detailed specular hologram. As you can see it is very easy to create many overlapping and intersecting optics (the curved colored lines) which will reflect light to depict the white dots along the edges of the model's geometry. Blue optics will appear nearest, red the furthest, and green will appear with mid-range depth.

 Now, per Matt Brand's whitepaper on Specular Holography, groove optics are hyperbolas that are calculated from the assumed incident light ray altitude angle that will be illuminating the hologram. I have chosen to calculate from the the hyperbola a cubic Bezier curve, which is defined by a starting and ending point, and two control points which dictate the curvature of the line that traverses the space between the endpoints. This curve then serves as the internal representation of the base shape from which all optics for the hologram are then derived, based on the 3D position of the point that is chosen from the source hologram geometry's vertices, edges, or surfaces that will be depicted by this reflective optic.

 These optic curves are segmentized by an occlusion-culling pass, which designates which spans of the curve should reflect light based on whether or not the hologram geometry should be 'blocking' their visibility, on a per-degree of viewing angle (or 'azimuth') basis.

 Once these segments of visibility are determined I then need to determine which ones are intersecting or otherwise overlapping one-another too closely to cause degradation in the final hologram. One way is to brute force compare the distance of every single point of each optic segment against every single point of every other optic segment to determine if the segment needs to be clipped or split/culled, etc..

 To speed this process up I have resorted to the use of a simple bounding rectangle overlap comparison. Effectively, this is a 2D axis-aligned bounding box intersection/overlap test. This is what I call an 'early out', where the core loop that is performing these comparisons and tests can quickly and cheaply pre-determine that there is no possible way for two given optic segments to be intersecting (because they are, for example, on opposite sides of the specular hologram).

 If there *is* an overlap detected between the two rectangles bounding two optic segments, then Holocraft proceeds with a more detailed comparison of the two segments, effectively comparing each point on each segment with each point on the segment in question. This is a simplified explanation of the actual process which determines overlap/intersection, as the actual algorithm uses a heuristic method to dynamically adjust the increment at which it 'steps' along each segment to the next point to compare with all the points of another segment to perform a distance check. This helps to accelerate the process, which is albeit fast enough without the heuristic method being as Holocraft only performs intersection detection when the user is saving the holographic output, currently as either an SVG vector image file or directly to CNC g-code.

 Now, the whole point of this blog post is to share the method by which I devised a rectangle intersection test that serves more utility for Holocraft's purposes. It would seem that with my growing years as a programmer I have been growing a rabid aversion to doing things the tried-and-true way, with a sort of desperation to find a novel way to go about doing things that people have already been doing another way for decades.

 A part of the heuristic method by which Holocraft accelerates optic intersection/overlap detection relies on knowing the rectangle of overlap itself in which two given segments are possibly intersecting. Knowing that their bounding rectangles is overlapping as a mere boolean piece of information is not sufficient for it would require that *every* point on each segment is compared against *every* other point on the opposing segment. To minimize this only the points on each segment that are within the overlapping area of the rectangles is considered.

Here's a copy-pasta of what Holocraft does:


//
typedef struct
{
 float x, y;
} vec2;
//

// 2d rectangle
typedef struct
{
 vec2 min, max;
} rect2d;
//

#define MAX(a, b)  ((a) > (b) ? (a) : (b))
#define MIN(a, b)  ((a) < (b) ? (a) : (b))

// returns zero if no overlap, otherwise returns
// area of overlap and optionally the rectangle of overlap via '*o'
float intersect_rects(rect2d a, rect2d b, rect2d *o)
{
 rect2d c;
 float dx, dy;

 // find horizontal overlap
 c.min.x = MAX(a.min.x, b.min.x);
 c.max.x = MIN(a.max.x, b.max.x);

 // not overlapping horizontally...
 if((dx = c.max.x - c.min.x) < 0)
  return 0;

 // find vertical overlap
 c.min.y = MAX(a.min.y, b.min.y);
 c.max.y = MIN(a.max.y, b.max.y);

 // not overlapping vertically...
 if((dy = c.max.y - c.min.y) < 0)
  return 0;

 // caller requires rectangle of overlap ?
 if(o)
  *o = c;

 // return area..
 return dx * dy;
}
//


 This is with the goal of quickly calculating the rectangle of overlap itself, while putting priority over the horizontal check over the vertical check (perhaps in Holocraft's case this should be reversed?) and will bail out if the horizontal overlap fails before bothering with the vertical overlap check.

 This is in contrast to most of the functions you will find on the internet, which perform a few simple greater-than/less-than checks against the min/max of the bounding rectangles/volumes and provide no other useful information.

 In the past, for game physics, I would just make everything a sphere and perform a simple pythagorean distance check against the combined radii of the two entities in question. I almost opted to use circles as early-out bounding volumes for optical segments until I actually sketched on paper how much extra space a circle would typically have over a simple bounding rectangle.

 Incidentally, the rectangle boundary calculated for each segment is derived from the convex hull of each curve, which is defined by both the endpoints of the curve and the control points that define the shape of the curve itself. It is said that the entirety of a cubic Bezier curve is contained within this area, and if there was a fast way to perform intersections against these convex hulls then that is what I would do, but there really isn't. This would require a series of line intersection tests and be quite a bit more complicated than it is worth.

Demonstrating the confinement of a cubic Bezier curve to its convex-hull, as defined by its endpoints and control points.
From: http://www.scratchapixel.com/lessons/advanced-rendering/bezier-curve-rendering-utah-teapot

 One of the advantages of using cubic Bezier curves as an intermediate representation is that outputting a vector image via the SVG file format allows for cubic Bezier curves to be defined as-is, without converting or transforming to any other form.

 This is in contrast with outputting CNC g-code, in which machine toolpaths can only be defined as either linear or circular motions, requiring an intermediate step in Holocraft which deduces a series of circular arcs chained together to form an optic curve. This is done within a user-supplied tolerance value, to give some degree of control over how large/complex the final CNC g-code output is, and the degree to which the machined grooves are faithful to the calculated optic hyperbola.

2.19.2016

Holocraft - The CNC Machining Adventures


 Much has happened with Holocraft since the last blog post. I now have an X-Carve tabletop CNC routing/milling machine now, which I spent the entire holiday season building from the ground up. I needed a place to put the machine on, because I had no space large enough to accommodate it's massive 31" square size (except the kitchen/dining table, but that wouldn't have gone over well with the wife). So I invested in two smaller tables from IKEA that when placed butted up against one-another they create a perfectly sized platform for the machine.


The TARENDO table from IKEA.

The tables are sturdier than they look. I assumed the legs would be wood, just as the top surface of the table is, but they are actually steel, and the whole underside of the table is also braced with similar steel beams. The tables, however, are not completely impervious to wobbling when the machine is dancing about across a hologram, which required some extra fastening and stabilization to be put in place.


The machining setup nearing completion atop the pair of TARENDO tables ordered from IKEA

When I ordered my X-Carve from Inventables.com I went ahead with the option to get the Dewalt 611 router to use as a spindle in the machine. Unfortunately both the DWP611 and the power supply interface board were out of stock and wouldn't be shipped out until January 8th at the latest. I ordered my machine on the 16th of December, which was a Wednesday. Everything arrived (minus the spindle and PSU) the following wednesday in a pair of boxes.

UPS had just left my driveway when this happened.


Since the Dewalt spindle was going to take nearly a month since my X-Carve order was placed to arrive at my homestead, I opted for a backup solution and invested in a high value package deal I found on Amazon for a Konmison 48v DC spindle that comes with it's own PSU, and a set of collets up to 7mm in size (just over a quarter inch). It also comes with its own CNC mounting hardware but it isn't usable on the X-Carve, so I opted for the 'universal spindle mount' that Inventables.com sells on their website, and it has been working out just fine.

Being that both the X-Carve and Konmison spindle have their own PSUs, I opted to stack them so that the fan in the XC PSU would help the Konmison spindle PSU cool down as well, by placing the KSPSU upside down ontop of the XC PSU.

This was the end result:

I call it the 'Frankensupply'.

As you can see, the XC Arduino and GShield are on the left, and the Chinese PSU is strapped ontop of the XC PSU, with the spindle potentiometer strapped down on the corner of the spindle's PSU. I figured that this configuration will best be suited to whatever I come up with insofar as an encasement or enclosure are concerned, cutting holes for the potentiometer, air flow, and power/USB lines. So far I have not been electrocuted, so that's good.

Another issue that arose was how I was going to be mounting my aluminum into the machine as I opted to save 250 bucks by not going for the default wasteboard that comes with the XC machine. Instead, I tried mounting the aluminum directly to the machine frame itself. This *does* work, but it allows for much torque against the X-axis gantry. This is due to the fact that the workpiece sits so far down below the gantry that there is a considerable amount of leverage against the gantry itself, being that the tool is not directly below the gantry but instead jutted out infront of it where the spindle itself is.

The Konmison DC spindle itself has been serving rather appropriately. I have managed to create a few different things with it.. On the plus side it is very light (compared to the DWP611) and runs at a rather decent 12k RPM, according to the seller, but this is something I've yet to determine with something like a tachyometer.


On McMaster Carr's website there is a slew of different metals to choose from. Knowingly, I opted to go for either the 1100 alloy or the 3003 alloy, both of which are extremely pure forms of aluminum. Being that they are pure they are also extremely corrosion resistant, simply because aluminum itself is highly non-corrosive. The other property of aluminum is that it, in its pure state, is very soft. It is on the order of between lead and copper. You can easily scratch it with a pushpin. It's not exactly the softness of lead, but it's definitely not steel.

I had originally opted to go for the softest and purest aluminum available via McMaster, which is the 1100 alloy. The reason for this was simply that it was just the purest they offered, and it was pretty cheap. I started out with five 6x6x0.063" sheets of this (1/16" thick) just to try out. At the time I was still milling the aluminum, using tiny 1/16" and 1/32" ball-nose end mill cutters, and cutting this soft aluminum was wretched at best. It would effectively pile up the removed aluminum along the sides of the grooves. This was disgusting.

I then went ahead and tried out the 3003 alloy, which is actually a bit cheaper than the already-cheap 1100 alloy. It seems to be virtually the same, machining-wise. But sine it's cheaper it's going to be my go-to hologram metal.

The 3003 also comes in a wider variety of thicknesses. Now, provided that I will only be making grooves that are only a few thousandths of an inch deep into the metal, I still need the metal plate itself to not be flimsy and prone to getting bent by slight forces, so thus far I have been opting for sheets that are .050". I actually have on order some more that are only .032" thick, just to see what that's like (plus it's even cheaper).. So hopefully that works out. But thus far, between the 1100 and the 3003 I think I will be sticking with the 3003 simply due to its price.


Makercam.com made life somewhat easy for a while.

Now, being that Holocraft's original means of output was by way of spitting out SVG file paths for the eCraft paper crafting machine, it was a miracle to discover that out of all the free CAM software out there there was only one that could handle the thousands, and even tens of thousands of grooves being output by Holocraft, and that was MakerCam.

MakerCAM made it a snap to convert my hologram toolpaths from an SVG file into a CNC g-code file. This was not without its caveats, of course... For one, the user cannot control how exactly the toolpaths are generated for the paths of any given SVG file. Many times I would find that MC's output would resume cutting a groove from a single side. Over and over it would enter the material to cut a groove, cut through to the other end, then it would raise the tool up over the surface to move back to the beginning side again. To my mind, it would be much quicker to finish a groove, move a little deeper into the material, and then continue back the other way in reverse. No, this wasn't happening with MakerCAM.

In order to actually control my machine and run my hologram-groove CNC programs to create actual metal surfaces I needed a program that would drive my GRBL-based CNC machine. Among the popular online communities there are a few recommendations that seem to satisfy everybody's needs. Unfortunately, I had no luck with these suggestions because they were not suited for massive g-code programs with tens of thousands of lines of code. These programs could only handle *maybe* a thousand lines of g-code at a time, which was useless for specular holography purposes.

Lo-and-behold, I managed to come across grblControl, which is a relatively newer GRBL controller program that features all of the bells and whistles of the other popular programs with the exception that it runs FAST. It can handle the largest of g-code programs I can throw at it, without breaking a sweat. To anybody using a GRBL based CNC I highly recommend you check it out. It is the only program I have used with my CNC, ever.

It is simple, efficient, and has plenty of features that make machining as painless as possible (which is still rather painful, but at least grblControl doesn't contribute to the pain).

There were a few things that were not exactly desirable about grblControl, but being that it is open source I was able to install and load up QT-creator and dive into the code and start making my own custom version of it. The first thing I opted to change was the fact that it operates strictly in metric, and all of my experience, expertise, and tools are designed for imperial. So, after some hunting and pecking I made my own imperial version of grblControl.

Aside from that I have made a slew of other changes, visually, and also functionally, just to get grblCotrol to be best suited to what I am trying to accomplish with it. Thus far I am really happy with where it's at now.





After a while it became apparent that if I were to have finer control over how the grooves were being cut I would need to implement functionality in Holocraft that would directly output g-code for a CNC machine, and completely obviate the need for any CAM software to generate the toolpaths in the first place.

The way that MakerCAM was interpreting the SVG files was random, at best. I could not rely on the fact that just because a path was defined going from point A to point B that it would be machine in that order. In some cases it seemed to make weak attempts at optimizing the toolpath by alternating directions between successive optical grooves, where when it ended cutting one groove it would then move up to the end of the next groove and cut toward the starting side of the groove definition, but there was no metric by which to reliably cause this to happen, or not happen..

As it stands, my machine has issues with machining holograms (or metal, as it were) due to the mere fact that when it is cutting in the Y+ direction (cutting away from the front of the machine) the leverage on the gantry causes it to lift up, which effectively prevents it from cutting as deep as it is supposed to because it is too friendly to the surface when moving in the Y+ direction.

Conversely, when the machine is cutting in the Y- direction, the gantry leverage just sucks the tool down harder and deeper into the material, gouging it much deeper than would be intended. The end result is that I must cut my holograms with the grooves being formed in one direction along the Y axis. I chose the Y+ direction simply because I'd rather have lighter grooves than inevitably and irreversibly deep gouging grooves that are formed otherwise.

This was discovered when originally cutting holograms where the grooves were traveling from X- to X+, in a left-to-right fashion. What was happening was that the left side of the groove (traveling in the Y+ direction while moving X+ rightward) was lighter than the groove was on the downslope traveling in the Y- direction. This is purely a product of the design of my machine, which was not designed to be used as a sort of drag-engraving machine in the first place, and so ways and means have to be put into place to work around this weakness of the machine.

Another issue that arose was the resolution of the machine itself. Was the X-Carve even capable of distincting grooves into the surface of the aluminum without there being obvious stair-stepping resolution artifacts? Well, we are running with 20-tooth pulleys on 2mm pitch belts means one revolution is 40mm along the belt.. With 200 steps per motor shaft revolution, with 8x microstepping, should be at 40mm / 1600steps =  0.025mm.. Therefore, we should easily have a resolution of at the very most .001" of an inch for our grooves, which seems plenty fine provided that we are malking those grooves fast and smooth and not moving to each exact increment of the motor to scribe the metal's surface.

Now, in practice, what I've found is that running the machine at the highest possible speed (going into GRBL config via '$$' command and playing around with max speeds and accelerations while tweaking the power dials on the gShield going out to the steppers) I've managed to get my CNC to fly like none other. The problem is that when I exert force into the surface of aluminum with a carbide bit at such speeds there is enough leverage at play to allow for what we in the States refer to as 'speed wobble'. This is not a machining term, this is something that happens when you are flying down a hill on a bicycle or a skateboard and your rate of speed just becomes too much.... Too.... Much... The end product being that your handlebars or skateboard begin resonating side-to-side uncontrollably so until the point that a crash of some kind is usually inevitable.

In this case, it results in wobbly little grooves, which are exactly *NOT* what we want, because we are trying to scribe optically accurate/useful grooves into the surface of the aluminum.

So, it has become a balance of slowing the machine down to minimize the wobbles as much as possible, without sacrificing speed, and without introducing a sort of stippling that arises from the actual machine position increments manifesting themselves in the grooves themselves, which are equally as ugly when it comes to optical applications.

Playing with the depth of the groove and the speed at which it is formed has been a bit of a journey, as well as taking other measures to mitigate the 'wobble' by raising the workpiece closer to the gantry to minimize the leverage that the tooling edge has against it. Stiffening up everything on the machine has been another project as well.


Here is a low-fi video of a hologram I have been working on for my younger sister, for her birthday. When I can manage a better camera I will (feel free to donate!).




Here is yet another video of another test hologram featuring some random abstract cuboidal shapes merged together in a sort of splatted configuration. Again. feel free to donate better camera ware!




Links:

IKEA TARENDO Table - ikea.com
Konmison 300w Spindle Motor with PSU and 13pcs ER11 - Amazon.com
MakerCAM - makercam.com


12.04.2015

Holocraft - Process for Fabricating Specular Holograms


The clearest video of a Matthew Brand hologram on the web.

It would seem that my blog is getting a bit more traffic now due to my previous post about my adventures with specular holography. I decided that it would be prudent to offer up my holograms in a crowdfunded fashion. I just launched a relatively modest campaign for $5000, which would fund a low-end CNC machine, aluminum stock, and a few months rent on a little tiny office/studio space where I can setup the machine and 'get my hologram on'.



'Holocraft', a program that generates toolpaths for a hologram's fabrication.

Originally, when I set out to do this project, my plan was to refine the cardstock holograms to a viable product that could eventually fund a CNC machine for creating high quality metal plate holograms, but the cardstock holograms are just not quite "there". The cost/benefit for getting them to look pristine is just not a viable route. But, I am sure someone would like to have them just as a novelty item, or maybe even to frame and hang on their wall. I am just not comfortable directly marketing them as a finished product, because I personally wouldn't want one myself. I want a heavy duty super duper shiny metal hologram!

I ask that if you think this project is cool, and want to see more stuff happen, please spread the word about it and tell your friends. Facebook, Tweet, and otherwise social-network the snot out of this blog and/or my Indiegogo campaign. I have this strong feeling that this medium is the tip of the iceberg, and that a lot of energy will change form as a result of it. It just needs to get out there in front of people and on their mind.

I've already figure out virtually everything there is to figure out about how to run Holocraft output on the CNC machine, what cutting tools to experiment with, what grade aluminum I should use, and have already sourced every single thing that I will need to buy to make it all happen.

After much consideration, weighing the pros and cons of every available desktop CNC google would show me, I settled on an X-Carve by Inventables, which is controlled by an Arduino that's running the open source g-code interpreter GRBL. Worst-case it hold a tolerance of 5-thousandths of an inch, which is pretty sloppy by professional fabrication standards, but is just good enough for my holographic endeavors. It also boasts a 31x31 inch work space, which is a far cry better than the size that most other machines offer. Some of them offer less than a foot of working space, but most of them have working area dimensions that are less than two feet. I want to be able to make holograms that are relatively large-format. Once you get too big, though, the fact that the light source isn't infinitely far away starts to interfere and distort the hologram, because each area of the hologram is then receiving incident light at more widely varying angles. This can be compensated for, but it's going to require special attention and more math.



The X-Carve CNC mill I aim to acquire for holographic purposes.
After a bit of research I've opted to go with 1/16th inch plates of 1100 aluminum alloy. 1100 aluminum is 99% pure, which is much more pure than all of the alloys, with the exception of 1050 and 1060. Pure aluminum is much softer to work with, and machine, with a Brinell hardness of 28 (copper is at 35, lead is 5, steel is 150). This means that the tiny cutters used to machine the hologram reflector grooves will not wear down as quickly, which is a good thing. 1100's softness and purity lend themselves well to optical applications, because it can be polished to a mirror shine without impurities mucking it up.

Another issue that cropped up was the fact that CAM software typically isn't designed to handle the sort of input that Holocraft generates. Typically, when importing a path of some kind, these programs like to assume it's a closed shape, that you either want to use as a hole, or an island/extrusion of some kind. In this case it's neither, I just want the machine to cut an arbitrary groove as output by Holocraft.

Of all the different high-end CAM software which I was able to locate trial-versions of to investigate, none of them were going to be able to import Holocraft data and use it properly. I was about to give up when I came across MakerCam, which is actually just a Flash applet that runs in a browser (http://www.makercam.com). By the grace of awesomeness it happens to do exactly what I need it to do. It will import an SVG that Holocraft outputs, and allows me a 'follow path' operation, and let me output the g-code as such. However, it struggles a *little* with the high number of paths that Holocraft outputs, which can be upwards of tens of thousands of individual little curved reflecting groove optics, which tempts me to just implement direct g-code generation capabilities into Holocraft. It would not be the first time that I wrote a program which generates g-code.


'Chamfer King' - One of the several CNC machining utilities that I wrote for my dad's CNC shop back in the day.

What I really need to do now is brush up on my 3D modeling skills, and start producing my own content to 'holographize' that actually represents my own creative self-expression, of which I have plenty to draw upon. I've only been testing out Holocraft using models on the various online repositories of 3D-printer models. There are some really decent paid models which would make some good holograms, but I'm more interested in making good holograms that depict what I want them to depict, not just what works.


Links:

12.02.2015

Holocraft - Adventures with Light, in Time and Space


 Bitphoria is not dead. I did, however, take a break over the summer to take care of some Real-Life situations. Recently I have mostly been cleaning up code, doing a second-pass over the code to add in error-checking wherever I didn't when I initially wrote the code. I also managed to work out the bugs and kinks in the networking that were highly problematic. There were a handful of bugs that were total project-killers at the time that I decided to take a break. Once I came back to it, they ended up being simple one-line fixes that I had originally feared would require revamping entire swaths of code. Exciting times. Bitphoria is alive and well, and I will be posting more updates about further progress sooner than later.

 In the meantime, I have recently found myself distracted with another project. My wife and I run a business out of our home, selling crafts we create ourselves using various computer controlled printers and cutting machines. There is a sort of pressure to come up with new products to make and sell to keep ourselves relevant in the online marketplace. This side project seems to me to be quite a lucrative endeavor that I am excited to be able to work on.

 Now, in the late 90's, when I was barely a teenager, I discovered a website by a man named William Beaty. This page was about his discovery and adventures with something that is now referred to as 'scratch' or 'abrasion' holography. At the time I thought it was interesting, but only cared about learning about conventional holography, using lasers, and producing interference patterns in photographic media. I hadn't really thought much about scratch holograms since then, until one night a few weeks ago.


William Beaty's Website as of 1999 (via Archive.org) I specifically remember this ASCII art from my initial discovery of his webpage.

 I was goofing around in the dark in the bathroom of our home with my four year old daughter, with a flashlight. Incidentally I was telling her about the 'ghosts' I wanted to make in Bitphoria, that chase the player around, just like the ones in Pacman. She asked what they looked like, and being quick on my feet I smudged one into the mirror above the sink. We discovered and observed a few neat optical properties of this greasy smudge I made. Shining the flashlight on it casted a shadow on the ceiling of the smudge, because it wasn't reflecting the light to the ceiling the way the rest of the mirror was. I also noticed the holographic depth effect being produced by the fact that both my eyes were receiving a different specular configuration of light reflecting from the smudge.. This reminded me of the scratch hologram website, particularly where he explains that he witnessed a holographic effect in a car's windshield that exhibited the same properties and behavior.


Beaty's 20-year old photograph of the hand smudges that inspired his experiments.


 The site I originally stumbled across as a teenager is still up today, and I managed to track it down that night. I don't know exactly when or why I became fixated. Maybe I had unconsciously wanted to make these holograms all my life, at some point, and it seemed that point in time had come.

 The gist of scratch holography is that by using a drafting compass, or some other means for producing circular arcs, one can embed scratches, or grooves, into a reflective surface, which will then catch the light producing specular glints that shift depending on the angle of the viewer/light/surface. The end result is that one can produce points of light that behave as if they are suspended behind or infront of the medium or material. The circular arc scratches that produce these points of light can be configured to yield various shapes and designs that exhibit themselves with a holographic effect.


A collection of Beaty's hand-drawn holograms, and a diagram depicting producing a 'V' hologram on an appropriate surface medium, showing the resulting configuration of arc-scratches that produce a V-shaped hologram out of reflected light.

 My first thought was to automate the process, to produce the best possible scratch holograms. It quickly became apparent, in my googleage that I was not the only person to have this idea. I did a lot of searching, and it would seem that there is only one program that became somewhat popular online, called 3DSilhouette. It is a VisualBasic application, and is simply not available online anymore. From what I gather you can email the author for a copy, and he will provide instructions that it must be installed to a specific directory path on your computer in order to work.

 3DSilhouette creates a variety of output. It can output the actual scratch arc positions, or it can output a pattern of vertical lines that allow one to use a compass by anchoring the compass to one end of the line, and then reaching the scratching-end of the compass to the other end of the line to get the proper arc-radius, and then go ahead and make the arc itself. This all seems great, if you want to make scratch holograms by hand.


Raul's scratch-hologram generator program, which loads .3DS model files (as output by 3D Studio Max) and calculates circular arcs that are to be made to reproduce the model in a holographic form via scratch holography.


 The only other program I was able to find anything about was in the form of a video, and the program was a part of a project by a team of MIT students who were creating both the software and the machine to produce the holograms in a completely automated fashion. This Youtube video is all that seems to exist of the man's work, as he has posted no updates about the program, machine, or it's output.




 This program appeared to be very promising, and possibly of higher quality than Raul's 3DSilhouette program. But there is not one other shred of evidence that this program ever existed online for the public, or that it was ever something that actually did anything, and could have just as easily sat and on someone's hard-drive since the making of this video. Judging by the video, however, it does appear to produce the best possible scratch hologram by way of orchestrating a plethora of circular arcs required to reproduce the supplied 3D model data, to some degree.

 After some reading, and Youtubing, I learned that utilizing circular arcs, per-se, as an optical surface are not the ideal geometry if you wanted a rigid holographic effect that didn't show distortion and collapse the 3D scene being displayed. This distortion can be seen on Raul's videos of the scratch holograms his software output patterns for. It's very obvious that the 3D effect is rather distorted, and over-exaggerated, in that the perspective of the 3D scene rotates too much when the viewer moves very little horizontally. This is not desirable.




 Several people have explored scratch holography, in search of optimization of these mechanically produced holograms. One person, named Matthew Brand, had the means and the know-how to go about figuring exactly what was needed to produce the best-possible holographic effect using the scratch hologram medium. He managed to discern the exact math that would allow the calculation of an optical surface topology that would yield distortion-free holograms via the specular reflection of light.

 Brand began this project in 2008, and demonstrated that an optical surface could be machined, which foliates (or approximates) the necessary mathematically accurate surface calculated that would produce the desired holographic effect for a given set of 3D points. His extension of scratch holography is referred to as 'Specular Holography', in that it hinges on calculating how to manipulate a surface and the resulting specular reflectivity so that a much higher fidelity holographic effect is produced. Brand made scratch/abrasion holography into child's-play, and refined the art into something that nobody else has been able, or willing, to explore since.




 He went on to produce over one-hundred works, most of which were a part of an art installation at the 'MoMath' exhibit (Museum of Mathematics) in New York. Currently, the Specular Holography installation is being sold off, for $1,200 per hologram, via http://momath.org/home/light-grooves/

 That is quite a pretty penny that these holograms are fetching. In the meantime, Brand has moved on to bigger and better things (ie: Lumography). He wrote a whitepaper on the workings of Specular Holography, which was published in 2010. Since then, it seems that nobody has taken interest in his work, to expand on it, or explore it further. Brand himself has not even followed through with a second paper that he mentions being necessary in his existing paper. It would seem that Specular Holography, in all of its glorious precision and beauty, has yet to catch on as a medium.

 To my mind, it's something that has the potential to 'catch-on' and go mainstream.

 At any rate, it became clear that if I wanted to create an automated means for producing marketable holograms, I would have to write my own 'hologram generator' program that incorporates Brand's mathematical derivations. I spent a few days decrypting the academic conventions Brand conveys his ideas through, and managed to glean from his paper what was required of a surface to depict rigid beautiful holographic surfaces.

 By happenstance, one of our cutting machines had recently 'died' - a Craftwell eCraft Die Cutting Machine, which we used to create half of the products that we sell online to support ourselves. This machine died whilst being utilized to produce prototype halloween decorations in early September of this year. Now, when I say 'died', I mean that the bearings which are inside the blade-holding assembly, which performs the actual cutting of the paper/cardstock, 'became' jammed (long story).

 The machine still functions as designed, moving the blade head where it's supposed to go on the cutting medium, except for the fact that we can no longer cut out material via the requisite swiveling blade mechanism that it relies on to be able to cut at all. That is to say that the machine still attempts to cut, it just cannot due to the fact that the blade is essentially stuck in one orientation and cannot follow the direction of the cut anymore.. But the software and machine, otherwise, are still operational.

 In the face of my wife telling me to throw the machine out for weeks, or months even, I resisted, knowing all the while that someday I would figure out *something* that I could do with the poor feat of engineering that had lost its way.

 The night with my daughter, and being reminded of Beaty's website as a kid, I had finally found an application that I could re-purpose our otherwise 'dead' machine for, breathing some life back into it's utility and value, thus turning it from a liability, as something just taking up space and collecting dust, into a valuable asset. All that needed to be done was bridge the gap between the idea of making holograms, and producing an actual marketable product, and the resulting income from profits would further fund life, ventures, Bitphoria, etcetera.


The Craftwell eCraft Die Cutting Machine, since discontinued after we acquired ours during the holiday season of 2012. It's a machine that required some 'finesse', thus frustrating many buyers and leading to its demise.

 My work was cut out for me. I had to figure out how to write a program that generates the necessary arcs to produce a viable hologram, and output an SVG file that could be imported into the eCraft software. Then, figure out how to fashion a means for the machine itself to actually produce the proper effect on an unknown material that would yield a hologram as the end result. I began exploring my options for a material or medium that I could scribe light-catching grooves into.

 Initial thoughts were about foil, adhered to cardstock, and using the built-in pen tool of the eCraft to produce relatively cylindrical grooves that would catch the light reliably when embedded in foil/cardstock. After some preliminary tests with foil/cardstock and a ballpoint pen, it was clear that the arcs would not be able to create sharp enough 'glints' of light, and were too hazy and blurry to be usable.

 The next idea was to use something like Mylar adhered to cardstock. Surely Mylar was reflective enough, and flexible/yielding enough to allow these ballpoint-pen embedded grooves to form and produce the necessary specular glints that were required, in order for a hologram to work. After trial-and-error, with Elmer's glue, cardstock, Mylar, it became clear that the moisture in the glue was warping the cardstock too much, and was simply unusable. My next idea was to try to use petroleum jelly (Vaseline, Aquaphor) instead, because I knew that it would not 'absorb' into the cardstock and cause it to expand and warp. This *did* produce perfectly flat sheets of cardstock with Mylar adhered to it, but was a tedious process involving a big greasy mess, and a rubber roller to roll the greasy blob as flat as possible between the Mylar and regular cardstock.

 It became clear that simply using reflective cardstock was the answer. It's effectively cardstock with Mylar adhered to it in a factory, and so it can be expected to be the best possible material for a limited fabrication means. So I picked some up and it seems to be working out as well as one could expect. It took some trial-and-error to determine what sort of tool I could engineer (ie: a finishing-nail I filed down using my late father's tools), that was capable of embedding grooves into the reflective cardstock surface which catches the light at a shallow-enough angle to be a viable means of creating a holographic product which we can market to the average consumer.

 The only requirement for viewing these holograms is that they are positioned below a light source that's not too far infront of the hologram. Brand's work on Specular Holography allows one to compute an optical surface capable of depicting a given set of 3D points for a given illumination point altitude, relative to the hologram itself. One can calculate the best possible configuration/foliation of the optical surface of the hologram for various illumination altitudes, where the light source is progressively more infront and less above the hologram. If you take a hologram calculated to work with an illumination point positioned almost directly above it, the 3D depth effect is magnified as one moves the light source further and further infront of the hologram. The grooves catch the light as steeper and steeper angles, resulting in the glints moving across the curve of the grooves more and more as one's perspective changes. This effectively turns the hologram into a smear of light because the specular 'glints' stretch out as every position of the groove approaches an angle that can reflect light to the viewer.

 It is my belief that a hologram produced to operate ideally at a 22.5 degree illumination angle (where the light source is half-way between a 45-degree angle and being positioned directly above the hologram) one could reliably decorate a wider variety of rooms with an overhead light source and have the holographic effect operate as much as can be expected. This is what I believe to be a marketable hologram, because it will work in the widest variety of situations that the holograms will probably wind up.

 Once I figured out a viable material for creating the holograms on, the next step was actually writing a program that could properly calculate tool paths for the hologram grooves, output them as an SVG file which could then be loaded into the eCraft software, and then actually produce the hologram on the reflective cardstock. Somehow I opted for the name 'Holocraft', combining 'hologram' and 'eCraft'.

 I spent some time surfing 3D model websites, and reading up on various model formats. I opted to use the STL, or 'Stereolithography', model file format, which happens to be one of the primary formats used to store and convey 3D printer models. Many of the websites that serve as platforms for communities of 3D printer enthusiasts are chocked full of STL models one can download and print on their own 3D printer. Simultaneously, the STL file format itself is extremely simple to load and parse.

 After a few days I had something usable. Initially I was working with circular arcs, to get everything up and running, and produce something interesting. I had to figure out the best size and width/height ratio for the arcs, and also learned how to use the arc path command in SVG so that I wouldn't have to output individual points for the arcs, but could instead utilize the built-in capabilities of the SVG vector image format. This would effectively allow the eCraft software to determine the best possible set of points to re-create the arcs itself, and keep the SVG files being output as small as possible.

Holocraft, in its earliest form, before it was actually generating correct toolpaths.

 After things began shaping up, I re-worked the arcpath code to create the proper hyperbolic toolpaths described in Matthew Brand's whitepaper on Specular Holography. This allowed me to then produce holograms that do not distort and warp beyond a viewing position that was directly infront of the hologram. This meant that my arcpath SVG output was no longer viable. Initially it appeared that I would have to start outputting giant SVG files with many points being plotted along each curve. After some more reading about the SVG format, it appeared that I could utilize the cubic Bezier curve functionality in the SVG format to keep the output small. Then it became a matter of calculating the starting and ending control points that manipulate the Bezier curve from a set of points that lie on eah hyperbola. This took a day or two to fully figure out and write into Holocraft.

 At this point in time I am still working on Holocraft, it is unfinished. I have added a few other features. One in particular allows the user to select from a few different modes of generating the points used to construct the hologram from, instead of being limited to using a model's vertices or a selection of points on polygon edges. Using procedural texturing techniques I am generating a variety of different patterns and textures of points on the surface of the models that can be used to create a hologram. This allows for a wider variety of models to be usable to generate holograms from, instead of being limited to simple low-polygon models, now larger more complex models can be used and a surface pattern texture can be generated to simplify its appearance so as to prevent too many overlapping grooves from being generated, which only serves to corrupt their ability to reflect light.

 I am also in the middle of finishing up some occlusion culling code that allows the model to obstruct itself and 'chop' the grooves into smaller and or shorter segments so that a point of light can appear to disappear behind the foreground parts of the model as the viewer's perspective changes.

 As great as all of this sounds, the reflective cardstock isn't the best medium, nor is the eCraft the best machine for producing a hologram with. The cardstock can only support so many grooves before the hologram turns into a mess that no longer catches the light properly. The cardstock is also prone to warping with enough grooves, and even shredding the reflective material if the tool goes over the same spot too many times. Putting the finished holograms into a heat press has shown to be somewhat effective in flattening out some of the warping, but it's not one-hundred percent effective. Using the fabrication method I've fashioned requires some finessing with Holocraft, to try and squeeze as many grooves into the hologram as possible without them hindering one-another by overlapping too much, which is extremely easy to do.




 Ideally I'd like to offer up the reflective cardstock holograms as a product in our online store. The best possible way to use them is to frame them in a way that keeps them flattened as much as possible, and hang them or set them where there is a light shining on them from above. The reality is, though, that better holograms are to be had. By fabricating holograms into metal, using a CNC machine, many more grooves can be embedded to create a more vivid and detailed hologram, with a greater specularity than the reflective cardstock can produce, making holograms brighter and sharper. This can be seen looking at images of Brand's holograms. They are simply beautiful.

 That is why I will be launching a crowdfunding campaign, either to fund a simple low-end CNC setup, or fund a CNC retrofit kit for my late father's manual Bridgeport manual milling machine that's setup and ready to go, but that nobody is using for anything at all. I have a nagging sense that I owe it to him to put his old stuff to use as much as I can, in his spirit, and in celebration of his life and who he was. A part of me wishes I had discovered this project while he was still alive and well, and it could have been one of the father-son projects that will always seem too few and far in-between.


Links:
William Beaty's Hand Drawn Holograms Page - Amasci.com
Scratch Holography Software - 50megs.com
Abrasion Hologram Printer Video - Youtube.com
Light and Illusion by Matt Brand - Zintaglio.com
M.Brand's Specular Holography Paper - Arxiv.org