3d graphics in Excel
March 6, 2008 1:48 PM   Subscribe

A 3d graphics engine written in Excel. Money shot on page 4. Blatantly stolen from seanyboy.
posted by signal (32 comments total) 11 users marked this as a favorite
 
Man, that guy really heads into crazytown when he starts talking about how Excel is a new paradigm in programming.
posted by delmoi at 1:54 PM on March 6, 2008 [1 favorite]


I think it's a joke.

But then again, your comment might be a joke, too.

Life is so difficult.
posted by mr_roboto at 1:57 PM on March 6, 2008 [2 favorites]


There's a reason they didn't name it "Be Subpar".
posted by cortex at 2:05 PM on March 6, 2008 [2 favorites]


/brain explodes.....
posted by Senator at 2:12 PM on March 6, 2008


What HL3 is gonna be written in tbh.
posted by dragontail at 2:14 PM on March 6, 2008


I daren't show this to my boss. He'll want all future data represented thus.
posted by urbanwhaleshark at 2:16 PM on March 6, 2008 [3 favorites]


My first reaction was, "Well, that's nothing terribly profound -- 3D graphics are just matrix operations and transforms" -- but then I saw how fast it was. That's pretty damn impressive.
posted by spiderskull at 2:18 PM on March 6, 2008


Damn. I'm impressed, and simultaniously thinking "these guys have way too much free time". Nifty all the way around.

Actually, I think its kind of on the same level as demonstrating that Conway's Life can be made into a full Turing machine. Life wasn't designed for that, yet it can do it, and Excel wasn't designed to do 3d graphics, yet it can do it too. For some humans there is an irresistable urge to use tools for purposes other than what they were made for; most of the time that's pointless, but every now and then something truly nifty comes of it.
posted by sotonohito at 2:21 PM on March 6, 2008 [1 favorite]


Spreadsheets make great programming languages for scientists and engineers. I used to program heat balances in Lotus 123. Each item of equipment would get a chunk of cells relating to heat and mass and you could link them to each other and then have the damn thing iterate until it settled. If we had programmed it in Turbo Pascal it probably would have settled a bit faster (say 5 hours instead of 8, but either way that is an overnight run on an 8088), but writing the code took probably a tenth the time. The original Lotus was amazingly fast. It wasn't like todays bloatware but was written in assembly language.
posted by caddis at 2:24 PM on March 6, 2008


I found the whole "Excel debugging" parts (page 4 and 5) to be really fascinating; what IDE so clearly represents not only the interrelations between code parts/classes as well as real-time envisioning and checking of how a change in one place ripples and affects other places.

Sure, Excel as anything optimized is silly, but in some ways it could be seen as a really effective IDE.
posted by hincandenza at 2:30 PM on March 6, 2008


Man, that guy really heads into crazytown when he starts talking about how Excel is a new paradigm in programming.

You can essentially think of Excel as a crappy functional programming language. That paradigm isn't new—it's been around for decades.

Last time I had to debug a piece of numerical code I wrote in C, which calculates a matrix of different numbers, I used a spreadsheet. Made it much easier to find the bug.
posted by grouse at 2:38 PM on March 6, 2008 [1 favorite]


Cool! Thanks, signal?
posted by brundlefly at 2:47 PM on March 6, 2008


Err... Thanks, signal. Period.
posted by brundlefly at 2:47 PM on March 6, 2008


I mean, I see how they did it. I just ain't getting the why.
posted by quin at 2:57 PM on March 6, 2008


You're welcome?
posted by signal at 3:13 PM on March 6, 2008


Because it was there, quin. Because it was there.
posted by brundlefly at 3:21 PM on March 6, 2008


Oh my god. That's awesome.
posted by sveskemus at 3:43 PM on March 6, 2008


For those who don't know, here is the secret to 3d graphics:

x_screen = F * (x_world / z_world)
y_screen = F * (y_world / z_world)

where F is some number you pick. F = 1.0 is not unreasonable.

Yes, that's it: two divisions and two multiplications per point. This is also why eight points are trivial to make fast.

Yes, there is some other stuff, but rotations without translation are a (3x3)*(3x1) matrix operation per point, which is nine multiplications and six additions per point. Calculating the rotation matrix involves a couple more multiplications and the evaluation of one sine and one cosine.

The actual rendering is done with Excel commands*, so they didn't write a rasterizer themselves. Since the faces don't intersect, they don't need a z-buffer. In fact, since their shape is convex they can get away with nothing more than back face culling to get correct rendering. Back facing culling involves little more than a dot product with the normal of each face and the viewing ray, so for six faces this isn't a gigantic strain.

Lighting appears to be flat face shading. This is a dot product between the face normal and the lighting direction (I am assuming a direction light, rather than a point light) multiplied by the face color and thresholded to zero if the result is negative.

So they have used Excel to implement a couple of fixed size matrix multiplications and a couple of dot products on a trivial number of points, and the final product is a generic spinning cube with RGB coloring.

I am less than impressed.

* They also did rendering with cells, but it is primitive, rendering only lines.
posted by Pyry at 3:44 PM on March 6, 2008 [6 favorites]


Pyry: So they have used Excel to implement a couple of fixed size matrix multiplications and a couple of dot products on a trivial number of points, and the final product is a generic spinning cube with RGB coloring. I am less than impressed.

/comic book guy
posted by sveskemus at 4:01 PM on March 6, 2008 [9 favorites]


It was cleverly done and cleverly written about. I enjoyed it.
posted by empath at 6:19 PM on March 6, 2008


sotonohito writes "For some humans there is an irresistable urge to use tools for purposes other than what they were made for; most of the time that's pointless, but every now and then something truly nifty comes of it."

Yeah.
posted by orthogonality at 6:55 PM on March 6, 2008 [1 favorite]


That's nothing. Wait until you see my real-time raytracer in Excel.

The caustics and soft shadowing are going to blow you away.
posted by demiurge at 7:31 PM on March 6, 2008


Yeah, this is pretty impressive, though mostly because who would think you could do 3d animation in a programming environment as crappy as excel?

The paradigm isn't new — delmoi mentions functional programming, but there's also, e.g., Guy L. Steele's PhD thesis from 1980.
posted by hattifattener at 8:29 PM on March 6, 2008


till someone makes DOOM out of an abacus you people will never be impressed.
posted by joelf at 9:25 PM on March 6, 2008 [1 favorite]


sveskemus: /comic book guy

If the implication is that I'm a loudmouth critic who couldn't do better himself, then here's my rebuttal: I implemented a particle system in Excel.

I haven't used Excel in years and I've never programmed in it, yet this took four or so hours. Implementations of basic graphics algorithms in Excel are neither difficult nor impressive.
posted by Pyry at 10:34 PM on March 6, 2008 [4 favorites]


Here is a sped-up version of the particle system implemented in Excel, where it actually looks reasonable.
posted by Pyry at 11:19 PM on March 6, 2008


Pyry: If the implication is that I'm a loudmouth critic who couldn't do better himself

The implication was supposed to be that you're a loudmouth critic, not that you couldn't do better yourself. (Also, that particular phrase I quoted sounded to me like precisely the kind of thing comic book guy would say.) Anyway, I never intended to offend you and I hope you didn't take it that way.

I think the reason a lot of people are impressed by this is not just because of the technicalities of implementing graphics algorithms in Excel but because they never even thought of the possibility of doing it. My first reaction of "oh my god" was simply that. The realization that the tool I use for the most boring parts of my work was just used by someone for something creative and fun.

Your particle system looks great, by the way.
posted by sveskemus at 1:27 AM on March 7, 2008


delmoi mentions functional programming

Ahem.
posted by grouse at 1:47 AM on March 7, 2008


Okay, fine, fine. "delmoi never shuts up about functional programming."
posted by cortex at 7:53 AM on March 7, 2008


I know that Excel can be used for things it wasn't designed for, that doesn't bother me. What does bother me is wondering why Excel contains the capacity to do things that seem to be beyond the needs of a spreadsheet program (like the ability to create a floating animated graphic as in the FPP). I mean, really. How much lighter, leaner, faster and better would software like this actually be if the programmers weren't determined to add in irrelevant and/or excessive things just because they can?
posted by caution live frogs at 12:57 PM on March 7, 2008


As someone who works a bit in development and testing, I can assure you that 90% of those features are in there because some big mouthed customer demanded them.
posted by empath at 7:15 PM on March 7, 2008


Uh, sorry, grouse. All you people with six letter usernames look the same, y'know?
posted by hattifattener at 11:58 PM on March 8, 2008


« Older small is beautiful!   |   I don't want you to feel alone. Newer »


This thread has been archived and is closed to new comments