SiloCityLabs / Cuttlephone

Phone case generator - Joycon and Junglecat rails for 3D printing
https://silocitylabs.github.io/Cuttlephone/
Creative Commons Attribution Share Alike 4.0 International
5 stars 2 forks source link

image imprint on case #13

Closed maave0 closed 1 year ago

maave0 commented 1 year ago

It's logo time. Maybe we can let users import their own image.

Image to OpenSCAD options:

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#surface

latest version has PNG import. Screw the other options

...

use inkscape to generate OpenSCAD path code. It would be imported in phone_case.scad similar to the libraries:

https://www.instructables.com/Convert-any-2D-image-to-a-3D-object-using-OpenSCAD/

start with a PNG image. Change to greyscale. Use Imagemagick to output a raw binary format, then Ruby code to write a .dat file. Use openscad surface:

https://cubehero.com/2013/11/25/emboss-and-impress-images-onto-a-surface-in-openscad/

maave0 commented 1 year ago

surface() performance is poor. It creates a bunch of triangles. Forums recommend 100x100 pixels max. I can handle a 90x90 px PNG on my laptop but it looks chunky when imported:

dude_med image

275x275 looks smooth but makes OpenSCAD slow, unusably so:

dude image

maave0 commented 1 year ago

OpenSCAD import() looks great and perform well. DPI setting has no noticeable effect. I used Inkscape to convert the traced PNG to SVG.

image

maave0 commented 1 year ago

better PNG import is coming later: https://github.com/openscad/openscad/pull/1110

SVG will do for now