Saving an STL as a depth map image?

1,919 views
Skip to first unread message

Mark Harris

unread,
Jul 1, 2017, 7:16:11 PM7/1/17
to Nottingham Hackspace - Nottinghack
I have several models which I currently CNC carve, but I'm wanting to offer a cheaper laser engraved version as the carving can take an hour or so for a small item. Has anyone come across software for projecting a STL into a depthmap image which could then be laser engraved as a dithered image, or with varied power?

James Taylor

unread,
Jul 2, 2017, 3:29:15 PM7/2/17
to Nottingham Hackspace - Nottinghack

Hi Mark,

In terms of producing depth maps, this can be done in most rendering software as it is used for things like depth-based effects in images (such as fog and aerial perspective).
I don't know what CAD software you currently use but the rendering program V-Ray can create depth maps and is compatible with most common CAD programs I know of. A completely free workaround might be SketchUp with a plug-in (I haven't tried one to reccomend but looking online it seems they exist).

As an architecture student, I use Rhino among other programs but you can get free trials of most software.
I've attached some images that show a depth map created from an arbitrary .stl file within Rhino using Rhino's native renderer.

You would then need to either use laser engraving software to engrave using variable power on the laser based on how dark parts of the image are or 'posterise' the image sort of like paint-by-numbers, which could be done using programs like Illustrator/Inkscape. 
I've done this before using the educational program '2D Design'. I've attached an image of the Barbican I engraved from a photo a few years ago as a test (this was just a regular RGB image not a depth map but the principle is the same).
I'm not sure whether the software at the hackspace is capable of engraving directly from image files though as I've never tried.
1.png
2.png
3 rhino render.png
rhino depth map.png
DSC03315.jpg

James Taylor

unread,
Jul 2, 2017, 3:41:21 PM7/2/17
to Nottingham Hackspace - Nottinghack
If your parts are fairly simple a better alternative may be to 'slice' the .stl file into lots of layers at a resolution appropriate for what you are doing and use the outlines of these slices to make a series of closed loops. Each closed loop could then be engraved with greater power/slower speed on the laser according to its depth by setting different fill colours or simply by going over the deeper areas more than once. The attached images a, b, c, d show how this works for a simple example.

This would become pretty time-consuming for more complex stl files or at higher resolutions though.

Whatever way you do this the most suitable solution is probably going to depend on how detailed the .stl file is and the application (whether it's decorative or dimensionally critical, etc.)

Let me know if you want clarification on any of my suggestions/whether they're helpful for your case or not.

If you have a go or find better solutions do post them here as they may be useful for others. :)

James
a.png
b.png
c.png
d.png

Mark Harris

unread,
Jul 2, 2017, 11:11:35 PM7/2/17
to Nottingham Hackspace - Nottinghack
Thanks James, I use SolidWorks for my CAD, but also have Fusion which I use for CAM on my jigs (don't trust it enough to use it for production stuff yet).

Attached is a picture of a carving in Aspire - I can save them out as STL files. I haven't managed to get these STL files to be useful in Fusion for CAM, so I still use Aspire for the modelling and CAM. It's not always the fastest or smartest, but it gets the job done, and I can't draw models anywhere near as fast in solidworks as it's really not intended to be used for this sort of thing!

The render you have from Rhino looks more like it has a lightsource at the top, rather than a depth map (as you go down Z the image gets darker). Vectric will save out as a greyscale bitmap, pretty sure ArtCAM will do as well (I dont have it or know how to use it though), but Aspire's not giving me sufficient dynamic range from light to dark - see attached.

I'm using a Trotec Speedy 300 laser for these, it handles this sort of thing very nicely -- if i can get the image!
bearcarving.jpg
bear-greyscale.jpg

James Taylor

unread,
Jul 3, 2017, 7:14:02 AM7/3/17
to Nottingham Hackspace - Nottinghack
The output in 'rhino depth map.png' should be mapping z-depth as the distance channel is selected. The other images with it are just the viewports in Rhino and a default render just for comparison. I admit it does look quite suspect though for some reason ... perhaps arbitrary wavy patterns aren't the clearest example...

Here's one using LIDAR data of Nottingham (the central-ish feature is a rocky outcrop on which Nottingham castle sits overlooking the canal to the south. Should be clearer that greater z-depth is shown as a darker tone as buildings are all brighter than the ground they sit on. Left is RGB render and right is z-depth mapped.

Have you tried improving the range using any photo-editing software perhaps?

By the way how big would that carving be as manufactured with laser engraving? 

James

James Taylor

unread,
Jul 3, 2017, 8:17:22 AM7/3/17
to Nottingham Hackspace - Nottinghack
Oops.
Forgot attachments
rgb.png
z-depth.png

Mark Harris

unread,
Jul 3, 2017, 10:53:42 PM7/3/17
to Nottingham Hackspace - Nottinghack
I have pieces from about 40x25mm to around 90mm circle at the moment, but i'm looking at making some clocks too which would be bigger.

The z depth looks like what i'm trying to achieve, but with software that isn't US$1k ;) 

I had a go with photoshop messing with the levels, but when its just an 8bit bitmap, there just isnt enough bits of data there in the grey scale to expand. Guess I'll have to play with Aspire some more and see if there's anything I can tweak to get the range to be better.
Reply all
Reply to author
Forward
0 new messages