Stereographic Lampshades using the Blender API
Recently I read an inspirational post on how to create stereographic lampshades. I noticed the author created the model in MATLAB and then rendered the lampshades in Blender. I feel like Blender on its own provides all the features necessary to create stereographic lampshades, so I set out to write a script to do just that.
My script is [here] on Github.
Check it out!
I created a SVG pattern modified from a public domain snowflake on Pixabay.
Then I imported the SVG into Blender and ran my script. My script converted the SVG into a mesh and transformed each vertex according to the post’s instructions.
I admit I cheated a little. In the original post, the input to the lampshade creation was a raster image. I instead jumped straight into vector images with SVGs. Since Blender can manipulate SVGs easily and there’re good tools on converting raster images to SVGs, I felt no need to reinvent the wheel.
There are two things that were non-obvious to me initially for computing the new vertices’ coordinates. First, all angles were supposed to be in radians. Luckily the default math functions like
cos() operate in radians, so that wasn’t a big trip-up. Second was that the default arctangent function
atan() only returned a compressed range which resulted in a super collapsed/deformed hemispherical blob. I needed to use
atan2() to get the full range. A fuller explanation can be found on Wikipedia.
After transforming each vertex the resulting mesh is a non-manifold surface. It’s basically a sheet with infinite thinness, which isn’t 3D printable.
My first instinct was to use Blender’s solidify modifier to turn the surface into a solid, but it didn’t behave like I expected. I ended up choosing extrude and scaling the extruded faces. Since I scaled proportionally to the thickness of the extrusion, I hope that the image projected by my lampshade won’t be distorted.
Since I don’t own a 3D printer, I sent my model to a service for printing. I’ll update with my results (hopefully it comes before holiday time!)
To print your own, you need an SVG (you can convert raster images to SVGs using Inkscape). I’ve provided the snowflake pattern as well as the final STL I used in the Github repository.
After you import the SVG into Blender, open up my script in the the Blender Text Editor.
Select the SVG and hit
You might need to rescale to the desired print size.
Have fun! Feedback welcome!
This is most amazing. Thank you for sharing your talent.
Thank you for your wonderful article.
Can you please provide a detailed reference of the post on designing stereo graphic lampshades with Matlab.
If you’re looking for the MATLAB article, it’s here: http://jasmcole.com/2014/11/01/stereographic-lampshades/
Thank you for sharing your script! I made an interactive piece with it here: https://twitter.com/marquizzo/status/859225123533889536 I’m hoping to have some of them 3D printed soon!
Hi, I’m having trouble with running the script in blender. It says that python script failed and shows me line 156 in your code. It’s like it’s not reading the selected objects and putting it into the mesh.
Hi, I’m having trouble running your script. Could you help me? It says that Python script failed and it shows me line 156. I don’t know why this isn’t working.