Using Blender and Python to 3D print a dress


[ad_1]

The opening ceremony at the 2016 Paralympic Games in Rio featured snowboarder Amy Purdy wearing a 3D printed dress, wearing prosthetics printed from the same material as the dress, and dancing with a Kuka robotic arm.

The dance was a statement about the merging of the human spirit and technology. “The backstory, which mainstream media passed over, was the critical role open source software played in the making of the dress: it was created using Blender and Python.

Paralympian dress

Image by Danit Peleg. Used with permission.

Occasionally I’ll come across someone involved in computer graphics who has never heard of the increasingly popular open source 3D animation software, Blender. To be fair it’s primarily known in the open source community, but it’s become a global phenomenon for millions of aspiring artists and animators. The open movie project showcases some of what Blender can do. And when it comes to 3D printing, it’s the most popular solution out there for creating and preparing models.

Falling into open source

I first discovered Blender while attending college in 2006 as a music major. While I was working part time for the school’s engineering department, I went over to one of the houses on campus to fix someone’s bathroom sink drain. The tenant just happened to be Nathanael Anderson, an ardent supporter of the open source community. He recently made a splash on Linux Journal as one of the first people out there to create a custom version of Rock Band that uses a real guitar with a midi pickup. Last I heard he accepted a job using VR to create educational tools in the field of medicine.

When I met Nat, I had almost no experience with computers. I had purchased a laptop that I used to take notes, but my knowledge didn’t extend much further than a basic understanding of Microsoft Word.

He on the other hand, he was a different breed. His home was a sight to behold: There were electronic devices of every description covering every flat surface and even lining the walls. Computer monitors were spitting out mysterious lines of code too fast to read. I still have no idea what most that stuff was for. He had cannibalized a slide projector to make a custom home theater system for movies and games. Later he showed me how to use the Fresnel lens with sunlight to liquefy pennies.

In spite of my complete lack of knowledge regarding anything related to computer code, I had an idea for making artificial intelligence more human using a random number generator to create the illusion of individuality and free thought. As I wrenched on the bathroom sink, I kept talking about my ideas. Nat and I hit it off and became friends. Over time, he began introducing me to the world of computer science.

Once he fixed my laptop after someone spilled tea on it, and when I got it back from him he had installed several open source programs on it including Blender.

Learning Blender

I always liked the idea of doing animation: As a kid I made several stop action videos with an old VHS camcorder using Legos and modeling clay. Nat kept pressuring me to start using Blender, and I eventually caved. I followed a simple tutorial and made a chess piece with a few keystrokes. My brain exploded. Here was a way to use math to make artwork. When I discovered key frame animation I had to gather the exploded gray matter so my brain could explode again.

Blender became an instant obsession. I had no idea animation could be this easy.

After a few weeks of playing around with Blender, I was sitting at a Starbucks trying to figure out how to animate a robot using an armature with vertex weights. 3D was still fairly novel then, so when a web developer saw 3D on my computer he dropped everything and started asking me about it. He wanted me to make an animated commercial for a record company. The commercial would consist of a giant medallion covered in gemstones spinning through space and crashing into a lava field leaving an impression of the record company’s logo. It required light caustics, flowing lava, fire and smoke effects, camera targets, path follow—all the nitty gritty details of UV mapping and material setup about which I knew nothing.

It took me about three weeks to learn enough to make the commercial. The web developer and the recording artist loved it, but that was partially because it was the first 3D they had access to. I was paid a whopping $300 for the work, but I didn’t care. My eyes were opened to the possibility of making money by playing with free software.

Kittens and architecture

I started with small freelance projects and eventually had a respectable portfolio. I put together a pitch for the game Kung Fu Kittens with a lot of renders of kittens in various martial arts poses. The game never made it past some prototypes in Unity, but with the kitten renders in my portfolio I landed my first full-time job doing visualizations at an architectural company in Boise, Idaho. For some reason the kitten renders impressed the department head, and I’ve been making a living exclusively using Blender and Python for about seven years now.

I transitioned from animator to developer about two years ago. I now work as a simulation engineer for Gerber Technology. I ended up at Gerber because they are in the process of developing a 3D solution for visualizing pattern design and simulating textile properties for the apparel industry, and they chose Blender as a development environment. I spent a few years making game assets so I knew some things about real-time graphics. I had also done quite a few projects that required various physics simulations, including cloth, which happens to be a huge focus for Gerber. I left the position in architecture and moved my family about 3,000 miles to Connecticut for an opportunity to become a developer.

Community FTW!

When I started writing code for manipulating 3D objects in Euclidean space I began wishing I had taken at least Algebra 1, but I somehow skipped that part of high school. Fortunately, all of that can be learned from free video tutorials. About six months after I wrote my first line of computer code, I created my first cloth engine from scratch using Numpy. I gave a presentation at the Blender conference in Amsterdam on this. Everyone said it was an amazing achievement for me and so on, but I all I could think about was the phenomenon that is the open source community.

So many people in the open source community were doing amazing things I never would have dreamed of and they were all sharing their ideas, assets, and even source code freely.

Exposure to this sort of global generosity (as opposed to generosity encapsulated as a class variable) and creative energy had this cathartic effect close to a spiritual experience. I have yet to find the words to describe it. I suppose I have to settle for the fact that “open source” has a greater depth of meaning than I realized before I had the chance to be part of it at the Blender conference. It’s possible I’m reading too much into Dutch people buying each other beer and hugging, but I don’t think so.

Paralympics dress

What does all this have to do with the Paralympics? I suppose it starts with Danit Peleg. I was going about my business creating UI elements for some texture tool or something when everyone started talking about a rising star in the apparel industry who created a line of 3D printed garments in her home. Someone sent me the link to a video and a Ted Talk, then explained Danit was coming to Connecticut to meet with some people at Gerber. Danit had used Blender to create all the models for her projects, and I was the “Blender expert” at Gerber, so someone invited me to the meeting.

After the meeting she asked when I could get started helping her put together a prototype of a dress to send to the Paralympics committee. An awkward silence followed as I stared at my boss… after some discussion, management cleared me to stop everything I was working on and start modeling a dress.

In many respects, we were in a perfect position to set up the 3D models for a printable dress. I was already proficient in Blender and had been creating tools for garment design for a couple of years. Then, we were sent Amy Purdy’s measurements. Because we were using Blender as the engine in Gerber’s AccuMark 3D software, we just plugged in the measurements and started modeling around our virtual Amy proxy. Through collaboration with Danit, we developed a workflow to support patternmaking for 3D garment design. Danit was able to work on a virtual fiure that had the same body measurements as Amy Purdy and we were off and running.

I wasn’t very far into the process before I realized I needed some tools I didn’t have. Fortunately, the Python API in Blender allowed for creating some pretty sophisticated tools with minimal effort, as far as software development goes. I’m not talking about macros here. The first tool I made used Einstein summations on N-dimensional matrices to measure along contoured sections of the body and the garment to test virtual fit and distortion between the flattened and deformed versions of the geometry.

All this might sound a bit overcomplicated for making a dress. Part of this is because I’m an engineer now and I’m expected to make things sound more complicated than they actually are. Another reason for the complexity was the pressure we were getting from the Paralympics committee to make sure the dress fit correctly and didn’t have any glitches or create any problems. We kept hearing vague things about the robot’s control system—that its movements were partially dynamic, reacting to the dancer’s movements. If the dress flexes too much, it could confuse the robot’s sensors, or if some part of the dress catches on the robot, the dancer could be trapped (and this robot is strong enough to lift a car so the dancer could be injured or killed). We also had a strict deadline and limited time, so the fit had to be right the first time. “Hey we need you to model a dress and if you get it wrong a paralympian could be killed. Good luck, and no pressure.” The danger might have been a bit exaggerated at the time, but I wasn’t taking any chances.  

Several useful tools and workflows came into existence through the process of working with Danit and leveraging Gerber’s AccuMark 2D and 3D applications that will be useful for creating 3D printed garments. I was able to hack into Blender’s UV unwrapping tools, make a few modifications, and extract flat patterns from clothing modeled around the avatar. Numpy let us build a convex hull generator that could step over the avatar to create a basic garment as a starting point. With some rotation matrices around a color wheel we could see where we needed to make darts and seams to allow the flattened geometry to better conform to the shape of the body. Numpy came to the rescue again with a barycentric system for making any shaped mesh follow the distortions of a simple surface. This let us create complex structures on the flat patterns and use the flat pattern to wrap these structures around the avatar in 3D. I realize that was a lot of jargon, but makes a lot more sense when you see what’s happening in the 3D program. To better understand, you can watch my presentation.

Closing thoughts

As a newcomer to the open source community I have to say I’m impressed. I was able to take a coworker with me to the last Blender conference and the work there made him speechless. In fact, he was so speechless he wouldn’t shut up about how amazing the open source community is until about four in the morning after interacting with people at the Blender conference all day. I didn’t mind. I had the same experience at my first Blender conference.

It really is like a paradigm shifting without a clutch, to steal a line from Scott Adams. It’s a big load off my mind not worrying about people stealing my ideas when I’ve already given them away.

[ad_2]

Source link

,

Leave a Reply