Category: Computers

Learning 3D Modeling in Blender

I’ve been meaning to learn Blender for awhile, but the interface is so complicated, I just get overwhelmed.  Along came a Udemy course offering to teach how to 3D model in Blender.  I’ve taken a Udemy course before, and it was great.  The instruction is really very good, and the classes always seem to be on sale, so it’s very inexpensive — less than a book would cost.  I’m only a couple of hours in, but already we’ve learned how to create objects with simple primitives, color them, light the scene, and render the image.  Not bad.  I’m looking forward to the next 61 hours of instruction (!).

 

Bubbles!

One of my motivations to learn the Processing language is that I wanted to make an animation of randomly-generated bubbles gently bouncing off each other.  Don’t ask me why the idea of this image was compelling.  I just remember coding as being fun (since I don’t do it for my day job), and I wanted to re-experience the almost-immediate gratification of hitting the “run” button and seeing your planned cartoon spring to life.

So here’s a clip of it in action.  The bubbles have randomly-generated positions, have varying diameters, and are an array of shades of green.  A new bubble cannot be created if it is too close to another bubble.  When all the bubbles are created, they move to maximize the space between them.  I can click on a bubble with my mouse to “pop” it, and then the adjacent bubbles fill in to maximize the separation from each other.

Bubbles that move and pop
Bubbles that move and pop

Source code for the Bubbles program is posted on GitHub.  Feel free to download it and experiment.

Processing: A computing platform

I don’t code for a living, but I can write a bit of script if absolutely necessary.  A few years ago, I had a hankering to write some programs to make some simple animations.  I wanted to have balloons appear and bounce off each other.  But learning a new language always seemed like such a steep learning curve, that it was just wasn’t worth the trouble.

Then I discovered Processing through Dan Shiffman‘s YouTube videos.  One episode, and I was hooked.

At the time, I was travelling a great deal for my day job, with many long international flights.  I bought a small computer and some books, and spent some of the flight time learning this new computer program.

Why Processing is different

Processing is fantastic.  It’s compact and runs on my cheapie PC.  It makes learning about objects and methods totally simple.  Within a few weeks I had my bubble program running.  Then I expanded to more.  Plus it’s all totally free (though it would be great if you could support the foundation, too.)

Processing is build around the assumption that you want to make a window, put some things in the window, and have those things move around or interact.  There are two predefined functions setup() and draw ().  Setup() has the code you want to execute once.  Code in draw() is executed repeatedly.  Every time draw() executes, the output window is updated, giving the illusion of motion.  The beauty is that you don’t have to think about the infrastructure behind how the screen is updating.  You can focus what you want to put in the window.  “Would the balloons look better if they were green or blue?”

How to get started

Watch some of Dan Shiffman’s Coding Train YouTube videos.  Each 15-20 minute video walks you through how he goes about coding up a particular challenge, say making Purple Rain or visualizing the digits of pi.  There is also a Javascript version.  I haven’t begun to explore it, but if you want to put stuff up on the web, it might be the better starting point for you.

Download the code from Processing.org, and dig in.

I initially borrowed the textbook on Processing from the library.  I liked it so much I bought the new version.  Then I realized it was missing some material from the first edition.  So I went back and bought a copy of the first edition, too.  It’s the only book I own in two editions.  It isn’t necessary to buy the book, but because I was doing most of my learning on airplanes, the book format worked well for me.