javascript 3d rendering

What I did

Once upon a workday, I decided it would be fun to learn JavaScript. Web development has been one of my hobbies1 for a while now, and JavaScript appears to be an increasingly fundamental piece of the internet pie.

As a student at DigiPen Institute of Technology, my greatest interest was in graphics programming. So much so that one of our projects in which we made a primitive 3D rendering pipeline entirely in software was so intriguing to me that I chose to take it well beyond the course requirements.

‘Well,’ I thought, ‘to get my 3D renderer to run in JavaScript I’d really need to get a good grasp of the language.’ It seemed like a sufficient task to keep me motivated. So with that idea, my porting was underway. Here is the result (if your browser supports the canvas tag):

Your browser does not support HTML5 Canvas.

What I learned

  1. Javascript is an honest-to-God programming language. Sure it’s made for “scripting”, but it’s very functional and well conceived.
  2. Webkit browsers come standard with a decent set of development tools built right in, including a great debugger and profiler. It’s actually quite an advanced environment. Clearly, there are web developers who use these tools every day. Otherwise, I can’t imagine how such a thorough toolset magically appeared.
  3. Firefox appears to be way behind Safari/Chrome in JavaScript performance. Granted it may just be tuned to normal case scripting tasks. I doubt JavaScript was initially conceived with a 3D software rasterizer in mind.
  4. Most importantly, I learned how much there is to learn. I still know nothing of this so called jQuery business. Maybe one of these days I’ll actually get a good idea, and make a iOS web app.

Is this useful?

Probably not. This renderer is far from optimized. I’m sure the JavaScript code is creating way too many objects. Also, it’s lacking many optimizations standard to a rendering system. No z-buffer, no clipping, and it’s doing full per-pixel hyperbolic interpolation too, which you don’t understand, but it was fun to say.

I hope you’ve found this interesting. I normally write about Apple and other tech stuff here. If that interests you, feel free to subscribe, or follow @skoda on twitter. Or not, I don’t care.

  1. Hobbies, as I refer to them, are only differentiated from work in that no one gives me money for them (yet)

one hot iphone?

A fellow coworker from work just saw this on his brand new iPhone 4:

One hot iPhone.

The funniest part is that it was completely cool to the touch. I have never seen this message on any iPhone. Has anyone else experienced this?

status bar mania

A number of times recently I’ve seen ridicule from fellow Apple enthusiasts toward Android’s hideous status bar. While it’s true in normal situations you’re likely to have a much nicer and less cluttered status bar on an iPhone when compared with Android, the gap is closing. And unfortunately it’s not because Android’s bar is getting better. I whipped up this scenario today on my iPhone:

Full iPhone status bar.

The kicker is, Apple knows that this is way too many icons. My phone is set to display battery percentage as well, but when too many icons get crammed up there the setting appears to get ignored to reclaim some extra space. Maybe it’s time to rethink which of these things deserve status icons, or maybe even give control to the user which get displayed, as with the icons displayed on the Menu Bar on a Mac.

origami hang glider

I can’t wait to give origami hang gliding a shot. (via Phil Coffman)

what is i.b.m.’s watson?

Taking the fiction out of science fiction. (via Daring Fireball)

tip for apple

Citing issues with the WiFi at the recent keynote presentation at this year’s WWDC, I’d like to offer a suggestion to Apple to prevent such issues in the future:

Stream the keynote live yourselves!

If Apple streamed their presentations live, it would obviate the need for all the live blogging, video streams, audio streams, etc. No one would be concerned about breaking the news. All the blog sites could be kept current by people watching the keynote remotely. Also, I’d get way more excited about watching the presentations if I knew I was seeing it live.

Just a friendly suggestion.

calling all innovators, make me some new peripherals

Today I was sent this link for a new tablet concept. The big feature being touted? Three USB ports. Sigh…

Let’s all stop and imagine for a second what it would be like to use an otherwise wireless tablet connected to three different peripherals with cables all at once. I don’t need to elaborate, any 5-year-old imagination should see how terrible that would be.

As it is, I can’t wait to be rid of that old iPod dock-connector on my iPad. Wireless everything. That’s the future. Putting USB ports on a tablet hinders forward progress by maintaining the idea that wired peripherals are good enough, and we don’t need to move on.

“But I can’t print from my iPad!”

Well, maybe the problem isn’t with your iPad! Why can’t I just email a PDF to my printer from whatever device I’m on, and let the printer figure out how to print? Device drivers suck. Just mentioning them makes me cringe a little. Why can’t someone make peripherals that suit the way I use technology now, rather than expecting newer devices to support an interface that’s decades old?

modify the look of the safari 5 reader function

Love Safari’s new Reader feature, but wish it was just a little different? You can edit the CSS yourself. No more justified text! Woot!

@skoda on @technochocolate on