Processing.js

I decided to look into using processing.js to embed processing sketches on my website. It’s actually pretty straight forward. In fact someone was nice enough put together a wordpress implementation of processing.js, so all I had to do to include sketches in my posts was install a plugin. I’ve tried a bunch of different sketches and most of them work. A couple, however, didn’t and I’m not sure why as I haven’t tried anything that needs anything but the default processing libraries. Also the wordpress plugin is using an older version of processing.js and I don’t know if the person that made it has any intention of updating it so it may just be a temporary solution.

A new branch

I generated a video of the 2D branching script I posted the other day. Unfortunately it wasn’t as easy as I had hoped it would be. Apparently all of iGeo’s computations are done separately from the main runtime in processing, so it wont let make active references from within the iGeo methods. This means that doing something like adding a new frame to a video every time the agents update is impossible because as far as processing is concerned everything inside iGeo isn’t actually ever changing. So I had to add the frames to the movie once every processing cycle. In this case it isn’t that big of a problem because my computer has no trouble doing all the calculations for the 2D branching in real time and I was able to generate a video of what I see in my processing window in real time.

However when I tried to generate a video from a 3D version of the branching script I made this became a big problem. My computer couldn’t calculate all the agent interactions 30 times a second for the video and started to lag behind. This is pretty standard for large multi-agent code, and is actually the primary reason I usually generate videos from processing. The script is to slow to show off in real time so I compile the results into a video that will play back in real time. But this time my workaround of adding a frame to the video each time there is a new frame displayed in processing doesn’t work. It just duplicates exactly what I see in the window.

I have a couple more things I want to try to see if I can get it to do what I want, but I’m not terribly familiar with static objects in javascript. It may not even be possible and I may have to rewrite the whole thing to do the agent calculations inside the processing runtime rather than inside a static iGeo instance. If that’s the case then I probably wont be using iGeo’s agent class again. As I said before it’s little more than a minor convenience and not being able to interact with active functions and variables from processing or from other plugins is a huge downside.

Branching out

I was going through some of the tutorials for iGeo today and I ended up spending some time messing around with the built in agent class. It’s not really much more than a minor convenience but it is nice to have the framework already in place. One of the examples was a simple branching script that removes overlapping lines. I carried it on a bit further myself in attempt to make something more interesting. I added in some variation based on the generation of the branches so that the angles become more extreme as it progresses, as well as adding some additional rules about when the new branches occur so the lines don’t fill in the gaps too much. I also made the color vary with the generation so the ultimate effect is a transition from a ridged cold grid to an energetic chaos. Its pretty fun to watch it grow, I’ll probably compile a video later and post it so you can see it in action.

Young Grasshopper

A few students have recently been using the Cornell Scripting Group to ask questions about Grasshopper, the parametric modeling plugin for Rhino. The group was setup for students to be able to ask scripting questions and get answers from graduates, myself and 3 others, who have experience writing code. The problem here is that I don’t actually have any experience with grasshopper. To remedy this I’ve spent some time watching tutorials and reading The Grasshopper Primer. Grasshopper is pretty different than most of the scripting tools I use in that you don’t actually write code. Instead you use a visual programming language similar to vvvv and Generative Components.



Having used Generative Components before, one of the first things I did was attempt to recreate one of the models I made with it in Grasshopper. Everything went fine until I wanted to take the spiral that I had made and parametrically array it so I could adjust the number of spirals on the fly. Unfortunately there was no array command and none of my attempts to use the built in functions to do it failed. It seems the only way to duplicate objects is to have a separate function for each copy you want to make. This means hard coding the number of duplications in, which is pretty disappointing for a piece of parametric software. Of course grasshopper is still in beta so I guess there is still hope for a set of array functions in a future update.

Overall though it is a very polished piece of software that has had a lot of work put into it to make it very easy to generate lots of code very quickly. Oh and another nice feature? Slider animations!