N-Body Simulation

A long time ago, I created a simple animation using POV-Ray that simulated a Neptune-like planet that I named Augustus-Voltaire 4.  I used POV-Ray’s built-in programmatic texturing features to create a blue banded atmosphere that had white speckled high atmospheric clouds. You can see the video here… It’s got some pretty bad aliasing features due to compression, but you can get a basic idea of what I was going for…

Ultimately, I wasn’t happy with the result, so now years later, I’ve decided to take a stab at the problem again…  This time, armed with a much faster computer!  But how do you simulate turbulent, banded clouds?

I came up with a couple of different ideas for how to do it… but the only one that seemed to produce anything vaguely interesting was N-Body simulation.  Essentially, you assume that the atmosphere is a fluid and realize that fluids can be approximated with particles.  In the simulation, you throw a few thousand simulated particles which interact with each other in set ways (in my case, they all repel each other in an enclosed space).

I wrote the simulator in Java… and is kind of slow.  Here is my first real attempt… it took about 18 hours to render.  The source is too large to include here in the post.  If you’re interested in seeing it, drop me an email.

In this simulation the Red and Blue components of the color describe its mass.  The redder the particle, the heavier it is.  The Green component of the color is controlled by how fast the particle is going.   I introduced a force pushing through the center.  The intensity tapers off as you get closer to the top and bottom.  That the simulation quickly reached a form of equilibrium…. which is kinda cool, but doesn’t make for very interesting weather patterns.

I noted as I watched this run, was.. the particles tended to segregate themselves based on mass.  The heavier stuff accumulated near the center of rotation and the lighter stuff was pushed out to the edges.

In my second N-Body simulation, I used far fewer particles but made each particle way more massive.  I also changed the shape of the force pushing through the center of the simulation, making it much more narrow.

Once again, you can see that we quickly reach a stable pattern.  This one seems to have much more circulation though.  It seems like bigger particles are the way to go.   I have 2 more avenues to explore as far as particles go…

  • Make the simulatiion have a 3rd generation.  This aught to cause different masses to group in layers. That might be visually interesting.
  • Add more complex ambient forces than the simple down-the-middle force.

An Arduino general purpose detector!

I’ve been spending some time getting acquainted with my new Arduino Uno.

I did the first Blinking LED tutorial which went exactly as expected.  This particular board has a built-in LED connected to pin 13, so I didn’t even need to do any wiring!

Having forced the on-board LED to blink, I decided to get a little more ambitious.  Along with my Arduino, I bought a bag of LEDs which came with the appropriate resistors for building simple circuits with the board I have.  I attached a 2nd LED to a small Bread Board and wired it up to pin 12.  After modifying the program a little bit, I got the two LEDs to alternate blinking.

Not wanting to stop at using only 2 LEDs, I strung up 5 more to the Bread Board and connected each to a corresponding pin from 7 to 11.  With everything wired up, I coded up a simple function that would take a number from 0-6 and light up an appropriate number of LEDs.  0 leds if 0 were passed and 6 if six was passed.  You can see that segment of the code here:

void light(int i) {

  if(i < 0) { i = 0; }
  if (i > 6) {  i = 6; }

  for(int j = 0; j < 6; j++) {
     int reg = 12 - j;
     if (j < i) {
        digitalWrite(reg, HIGH);
     } else {
       digitalWrite(reg, LOW);
     }
  }
}

The first time running it, I simply cycled through numbers from 0 to 7 which resulted in the LEDs lighting up one at a time then resetting.

Finally, I decided to mess around with the Arduino’s Analog Input capabilities.  The input seems quite sensitive because as I touched the wire that I connected to the input, it immediately began registering a voltage.   In my program’s main loop, I scaled the analog input to the 0-7 range of my LED array.  Now when I touch the wire, the more fingers I touch the wire with… the more LEDs light up!  Here’s the pic!

Here, I was holding the wire with three fingers; my thumb, pointer  and middle finger… four of the LEDs lit up.  Presumably, if I connect up any random sensor (light, sound, etc), the intensity will light up a corresponding set of LEDs.  That aught to be more useful than detecting fingers touching a wire.

Spherical Robots and Arduino Uno!

Back in November, I was at the Academy of Science for Nightlife and found nestled in the creepy taxidermy (African Hall), I ran into Spherical Robots rolling around. Check out the video:

This particular set of robots were originally created for Burning Man, but it’s no surprise to me that they would tour around the more sciency venues of San Francisco.  I’d never really considered a spherical robot before… but I guess it’s a “thing”.  Go ahead! Google it!

Now to me, the easiest way to get a sphere moving would be to have a rod running through an axis of the ball and you roll around it using either weight or a gyroscope on whatever internal mechanism you’ve got driving.  In this design you effectively have one HUGE wheel. These robots, however did not seem to do that.  They were able to roll in arbitrary directions.  They didn’t have to turn to change direction.

My initial gut feeling was, it used a pair of gyroscopes offset from each other by some angle.  When the orientation of the two gyroscopes change, the sphere’s effective center of gravity would shift causing it to move.  After doing some reading, though, it seems like that is not the case. A more likely scenario is… you have a large pendulum style structure which is moved around with a pair of solenoids.  This apparatus is dangled from a stable platform.  When the pendulum is pushed in a direction by the solenoids, the center of gravity shifts and the ball rolls.  The amount that the pendulum can move the ball is proportional to the weight at the end of the pendulum.

All of this conjecture has lead me to conclude that I need to try it out.  So… I’m off to learn a little bit of robotics.  So… how does one get started in robotics?  One dives right in!

I’ve been wanting to work with the Arduino family of microcontrollers, and this seems like an ideal project.  I ordered myself an Arduino Uno, a couple of add-on boards and am ready to rock!

My first goal will be to familiarize myself with the Arduino programming language and generally make myself comfortable with the tools involved.

There is some soldering involved.  You can see in the above image, my new toys.  The blue circuit board is the actual Arduino itself.  Below the magnifier is an add-on board that will allow me to control two motors.  (some assembly required).   I have a 2nd add-on board coming which will have add a small LCD display. I’m sure that board will be the one I play with the most (At least at first).

Naturally, I had to try to put together the motor controls, but it seems like fate would have other plans… Look at what happened to my soldering pencil:

Yeah. So… a new one is on the way. I guess soldering will have to wait a few days.

Smoke Simulation and the Make Human Project

Over Thanksgiving, I spent time back in Miami, where I grew up.  During that time I essentially took a break from everything… including projects.  However… I did find some interesting material regarding 3D that I made note of to try…

First, check out this tutorial on Blender Smoke Simulation!

I’m pretty impressed with the tutorial.  I need to try to make something that uses this sweet feature!

The 2nd thing is the Make Human project.  Essentially it’s a programmatic way of generating human meshes.  It turns out that I have a very important use of this project… In the first Little Robots animation, I need hands, arms and legs.  Hopefully I’ll be able to use this project for the initial meshes! It’ll save me a HUGE amount of time!

Computer Setup in Scene

This drawing represents how the main computer in the animation will be arranged.  It’s loosely based on my actual computer layout.  Yes, voicing the Richard character from the script isn’t going to be a stretch for me!

In real life, my center display is an iMac and I have a my Mini set up to be a shell server.  I don’t think that the Richard in the animation would need a set up like this… instead he probably has a couple of home made linux servers under his desk.

So, what needs to happen next… I have to model a set of headphones, customize the monitors so that three distinct monitor models exist.  I have to model a mouse and my Griffin Powermate… and I need to start working on the videos that will make up the monitor content.  The latter will be the most challenging, I’m sure.  I honestly don’t know how video as a texture will render.

Workbench Concept Art

Over the weekend, I was having serious trouble modeling out what I thought the assembly area on the desk would look like.

Originally I had envisioned an aligator clip contraption, sets of tweezers, and a magnifier lamp.  That all seemed kind of boring though.  I then came up with a stepper motor kind of arm contraption that would be used in place of the aligator clips.   As it turns out, this is a hard thing to model without some kind of visual reference… and since it’s a fictional piece of equipment… well… I had to go back to the drawing board… literally.

The actual size of this armature would be pretty small as what it held would be the primary focal point of the magnifier lamp.  Since it’d be pretty small, it’s impractical to adjust the thing by hand, so I came up with a set of dials which will connect via wires to the robotic armature.

Here you see three knobs, which ostensibly control three axis of adjustment that the arm can move in.  The larger, shorter section of the knob is used for “course” movement and the smaller, longer inner knob is for “fine” movement.

My first stab at drawing this thing had all 3 knobs lined up in space, but it occurred to me that if I did that, the gearing of the knobs within the housing would all intersect.  Because of that, they’re all offset from each other slightly in the drawing… and will also be in the model.

Hello Seña – The Script

Last weekend I worked out the first draft of “Hello Seña”, the script that I’ll use for the first Little Robots animation.  As I described in my post “Getting it Together“, the scene takes place just before our first Little Robot gets activated.

If you’re interested in reading the script… it can be found [here].

Originally I had planned on making the dialog very plain, but while writing the script, I was inspired to add a few dark elements…

RICHARD: It sounds like we are ahead of schedule then. What about the others? Have you heard anything else from them?

ONEMURI: No, I haven’t and it’s been a while.  I’m getting a little worried that something has happened.

The conversation pauses for a moment.  Richard leans back in his chair and exhales.

RICHARD: Well, even if they were found out, we’re all supposed to be isolated, right?  There’s nothing else that we can do but do our best.

From this excerpt, you can see that I’ve added a layer of secrecy to the overall mythology.  Onemuri and Richard have some secret timeline and they are colluding with others who seem to have gone missing.

An interesting challenge of this script will be that most of the dialog will be in Japanese.  Since I don’t speak Japanese but plan on voicing the Richard character in the story, this means that I’ll have a lot of verbal practice to look forward to.

My first Blender animation

I originally modeled this several months ago… but each of my renderings had little issues… first with lighting… then with camera clipping… I worked out the various issues but never actually went through the 10+ hours of re-rendering it at decent quality until now… here you go… my first blender animation!

Something to write with

Adding to the list of random things on my desk, we have a pen and a piece of paper.

The piece of paper is about as trivial to model as you might thing.  I decided to UV Map it so that I could have both a front and back side of the page (though you can’t see it here).  It also means that the stuff on the page itself will deform properly if I decide to wrinkle or otherwise mess with the page.

The pen was trickier to model than I thought.  There are some funny curves and you have to cinch the subdivision surfaces at the right places for them to look right.  For some reason the label that I applied to the pen refuses to show up in this rendering. I’ll have to dig into that later.

Cables!

The way you model cables in Blender involves is summarized with this video: Making a Cable in Blender.

The thing is, that tutorial was created using the older interface… and it’s a bit tough to find in the new one.  After struggling with it a little bit… I came up with the cable you see to the right.

I can now begin to create lots and lots of cable… which is good because cables make the world go round!