Ex Nihilo

A Processing Sketch Blog

Archive for the ‘3D’ Category

New Project: Elevation

Monday, October 12th, 2009

As hinted in the comments in my last post, I’ve cleaned up my 3D elevation code and released it as a project, source and all. Go check out Elevation to grab Mac and Windows executables, or hit up GitHub to grab the source.


This project was a too-perfect alignment of things relevant to my interests. I got a chance to really stretch my legs with Processing, had an excuse to tinker with GitHub finally, spent some serious design time in Photoshop thinking through the site and app UI visuals, designed a high-res app icon, got to play with mapping and GPS software, and it all gave me the motivation to go out and pedal around this beautiful city to create my route data in the first place. Spending a month coding while racking up over 400km on the bike seems like a fairly healthy work/play balance.

And happily there’s plenty of fodder in here for future posts, from parsing differing XML formats to building a functional GUI. More on those soon.

Thanks for the link love to: CreativeApplications, blprnt, Rubbishcorp

Tags: , , , ,
Posted in 3D, Projects | No Comments »

Manual Geodata

Friday, September 18th, 2009

So if you’ve recently gotten into a visual programming language, and you also recently bought a bike, what’s the logical next step? Merge the two pursuits of course.

There’s an app called RunKeeper for the iPhone 3G/3GS that uses the phone’s GPS to track your route / elevation / time as you’re out being active. If you upload your routes to the web site, you can get the data back out in a couple of XML formats. (Google’s KML kind of sucks, it turns out; I’ve been finding GPX files easier to use. RunKeeper’s web app exports both.)

I’ve started hacking up an app to plot the data in 3D space. Very early stages, but it’s working quite well so far. Here’s a quick video:

Make sure to wait for the shift in plotting modes through the movie; I’ve built three so far: lines, points, and colour-coded points that indicate elevation (blue in the low areas, red in the high areas)

You’re seeing 7 routes I’ve ridden over the past couple of days. I’m already seeing outlines of Vancouver’s city features forming: the distinctive duck’s head outline of Stanley Park, the south downtown seawall, the massive hill heading out to UBC, etc.

What’s obvious is that some of the elevation data, particularly around Stanley Park, is seriously whacked. I think the cliffs obscure the GPS signal or something, because it should be more or less sea level all the way around. (In line view this is most obvious: it’s a series of jagged peaks and valleys, which strikes me as physically impossible). Hard to say whether it’s the app or the phone’s GPS to blame here, but my guess is the latter.

Next step: adding speed indicators, once I figure out how to work with ISO time stamps in Processing. (And going out and biking more paths this weekend to start fleshing out the terrain a bit more. Nice way to stay motivated.)

Posted in 3D | 9 Comments »

Dot Cube

Friday, July 24th, 2009

I’m back to dots again. This time I’m stacking them in an orderly cube, and with the random palette some of them look pretty darn good.

I can’t get this one exported into anything usable in a browser for some reason; the applet that Processing creates just doesn’t want to run. I suspected the photos I’m using to generate the palette are to blame, but after hitting up the troubleshooting guide I appear to be doing everything right. The main symptom (aside from not running) is that the exported applet is only sized to 100×100 in the browser, which is a) wrong and b) strange.

Anyway, in lieu of something you can play with, here are some screen caps:


If for some reason you really really trust me, you can download the native applications Processing generates (Mac OS X, Windows, both around 2.5MB) and play with them on your own system. No guarantees they won’t hose your computer, but, they shouldn’t.

(Use the mouse to rotate the cube, press a or z to zoom in and out — or the mousewheel, but that’s buggy — and you can kind of drag it up and down to reposition, though that doesn’t work well either. Hit the spacebar for a fresh palette. Oh, and s will save out a PNG of the current frame if you’re so inclined.)

Tags: , , ,
Posted in 3D | No Comments »

Ellipse Ribbons

Thursday, July 23rd, 2009

I’ve been playing around with a variation of the radial sketch from my last post that plots a few thousand ellipses along a Perlin-randomized trajectory. I first spent a bit of time converting the ugly coordinate arrays to a cleaner object array, added a custom palette, and then added a bit more control over the view in the form of mouse-enabled 3D rotation and mousewheel zoom.

I’m not done with this sketch yet, I’m going to try generating a random palette from a photograph if I can get that working. For now here’s a dump of some of the more interesting stills:


Tags: , , , ,
Posted in 3D | 1 Comment »

OpenGL Quirks

Wednesday, July 22nd, 2009

I’ve started light by simply merging some of the sketches from last month’s workshop. That has mainly meant translating 2D demos to 3D space so far, and I’m already running into some interesting OpenGL quirks.

3D Radial Demo

This applet (requires Java Virtual Machine) for instance; there’s a clear dividing line between the left and right half; the lines are darker on the left, lighter on the right. This is true no matter whether I use the lights() function or not. No idea what’s causing it.

And 3D shapes appear to be slow as molasses. Admittedly I’m on a MacBook Pro with only a mid-range graphics card, but I’d expect better results than this. Here’s a basic 25 sphere “starfield”, it renders pretty smoothly:

But bump it up to 125 and look out:

Keep in mind the previous applet draws about 5000 2D lines per cycle, vs. the 125 spheres in the last video, so 2D shapes are clearly a lot less taxing than 3D shapes. But 125 shapes is barely scratching the surface of what I imagined Processing could accomplish, so I’m clearly missing something.

What do the pros do? I’m guessing the choice is to either ignore framerate and render to a sped up movie, or fake 3D with 2D objects. I’ll have to keep digging into this one. Update: aha, buffering.

(and actually, now that I’m looking at the movies again, I’m wrong — those aren’t even spheres, they’re just ellipses. No idea why this example’s so bad; I can normally get a few thousand ellipses moving pretty quickly, I guess this is just a crappy example. The point remains when applied to spheres though.)

Tags: , ,
Posted in 3D | No Comments »