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.

rendered lampshade

My script is [here] on Github.

Check it out!

I created a SVG pattern modified from a public domain snowflake on Pixabay.

snow pattern

Let it snow!

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 sin() and 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.

imported SVG

After you import the SVG into Blender, open up my script in the the Blender Text Editor.

hit Run Script!

Select the SVG and hit Run Script.

final object

You might need to rescale to the desired print size.

Have fun! Feedback welcome!

Click for Update


  1. Sha said:

    This is most amazing. Thank you for sharing your talent.


  2. Tareq said:

    Thank you for your wonderful article.
    Can you please provide a detailed reference of the post on designing stereo graphic lampshades with Matlab.
    Thank you.

  3. Jacob said:

    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.

  4. Jacob said:

    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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: