Saturday, August 18, 2012

Semiramis Ray Tracer (2003)

In school, towards the end of my diploma, I was allowed to take a class outside my engineering field: computer graphics.  This class, CS488, was a blast.  I recall a warning during the first class indicating that the workload was somewhat intense, and that students have been known to take only that one class for a semester.  This scared me a bit in the start, but it was a calculated risk since I already had a somewhat solid grip on graphics basics at that point and I mostly saw the class and required coursework as a fun and stimulating way to deepen my knowledge of fundamentals.  It all worked out and in the end; my heaviest class that term was a cognitive psychology class, which by itself dwarfed the course load of all my other classes put together.

The second-last assignment in that class is to write a simple raytracer, using python to describe scenes which are thereafter rendered by a C/C++ back-end.  Once the basic requirements are met - simple lighting, shadows, scene hierarchies, etc. are working - students are free to add three (or more) features of their own accord.  I chose to add supersampling, reflections, and isosurface (blob) rendering using a simple solver.  Here are a few sample images.






The course-required images are somewhat less... erotic:



Shadebob/Flare (1997)


Another old-school demo effect written as a teen, though I suppose it was somewhat more present-school back then.  A mask slides over the frame buffer in a lissajous pattern, incrementing the frame buffer values wherever it goes.  A smooth palette in an indexed color mode gives the final appearance.

A flare variant applies fade/color decay by subtracting a constant value from the entire frame buffer after every frame.


E3 and XDimension (1996)

Just after writing E, I thought I would write a 3D version of the same as a school project in Secondary IV, to learn more about 3D.  This was both a very interesting and bad idea; I learned a lot, but I was forced by my teacher to write an auto-tutorial mode stepping the user through most of the available functionality, which drastically cut down on the amount of time I had to spend adding to said functionality.

Years later I still think this project would have had much more educational value if I had not been forced to write this tutorial mode, which is a sort of stone age equivalent to today's 3D modelling tutorial videos on YouTube.  However, the tutorial mode proved quite handy when recording a video of the application.  I doubled the play speed to make the video less tiresome, though it's still pretty bland.  Keep in mind everything is happening by itself here; I'm just banging spacebar to skip through the dialogs.

E3 ran on an assembly-language engine I had dubbed XDimension, which basically only supported wireframe rendering.  It wasn't much, but hey for a 15 year-old with little no linear algebra notions and only a few short HOWTO.TXT-style references available from BBSes, it wasn't too bad.  (I'm not sure whether our family had dialup internet access yet at that point, but in any case I still hadn't latched onto the web as much of a resource.)

Moire Effect (1999)

In 1999, when starting university, I was still operating on somewhat older hardware (a pentium 133 and a 486/66, where most roommates had 400-500 MHz machines).  This being as it was, there were still a number of interesting demoscene effects I hadn't written up for myself, and I was still interested in learning about them.  On a rainy afternoon I tried my hand at writing a moiré effect.

The technique is pretty simple: a giant sprite is precomputed where the value of the color of a pixel is the radius from the center of the sprite, times a scalar constant to control radius, mod 32.  This yields a picture whose colour values consist of concentric rings with values increasing from 0 to 31, then 0 through 31 again, etc.  The palette is configured to consist of a gradient from black to white in colors 0 through 15, then white back to black in 16 to 31, so a single copy of the sprite rendered to the screen essentially looks like a series of concentric blurry circles.

At runtime, two copies of this sprite are offset in a simple moving pattern, and they are XORed into the framebuffer.  The XOR operation always a yields a value between 0 and 31, keeping the resulting colors in the frame buffer within the range of the preconfigured palette.  This yields the pattern which can be seen in the following movie.


F1-Maths (1996)

When I was 15, in 1996, I did not yet have ready access to a Turbo Pascal compiler; as far as PC programming went, I still worked within the confines of QuickBasic.  I can't exactly recall how I got it into my head to write an educational game - I think it might have started out as a school project - but that's what I did.  Thus F1-Maths was born, a palpitating game where you get to race cars in order to test your mental calculation prowess!  Or at least that was the idea, anyway.

There was some passing interest from a neighbouring schoolboard to buy the game for a nominal fee; though the idea never came to fruition, it was the first time I truly came into contact with the concept of time spent in effort being worth money.  Specifically, it opened my eyes to the fact that said effort need not be unpleasant in order to be valuable from an financial standpoint.

You can tailor the difficult level for each player in order to level the playing field between people of different skills, and with USB now making it trivial to connect multiple keyboards to the same PC, the game would actually be much better to play with everybody having their own keyboard.


Star Wars Identities

We're just back from a really cool exhibit called Star Wars Identities.  It's on its first stop of a six-year world tour, and it's really quite something.  If you like Star Wars at all, you should really check it out; it's definitely worth a good detour.

They have a ton of original props, costumes, and sketches on display.  As you tour, there are stations which outline the character development behind many Star Wars characters,  with emphasis on Anakin and Luke Skywalker.  In parallel with this analysis, you are invited to create your own character from the Star Wars universe by making a series of choices about your character's life and characteristics at eleven points around the circuit.  At the end, your created character will be displayed on a giant wall, and you can elect to receive the character's picture and biography by e-mail.

As a geek, one of the things I was interested in was the techology behind the exhibit.  It is quite well put together, and things run very smoothly.  At the beginning of the exhibit, you are given an audioguide unit as well as a bracelet.  The audioguide unit, a bit smaller than a hockey puck - and much lighter - hangs around your neck in a translucent case.  It sports a power button, a volume dial, a channel button, and an earpiece.  It does not actually contain any data; it receives the audio streams over infrared from emitters scattered on racks in the ceilings.  You stand in a delineated area on the ground representing the IR coverage, and wham the audio just comes in.  Though this means you essentially jump into the station's audio loop at a random point, the loops are very well written and recorded and never sound confusing; they are short and meaningful.  This is great because it allows them to put as many IR stations as they want on the circuit, and people are not left fumbling with the audioguide units, trying to punch in the usual numbers corresponding to each station.  Just walk up to the station and wham it talks to you; great for kids, lazy adults, and immersion.

The bracelet is an RFID(-like) device, used for the create-your-own-character feature.  At many points during the exhibit, there are illuminated, raised hexagons, perhaps ten centimeters across, into which you can touch your bracelet.  These hexagons respond by lighting up and emitting a tone.  They are used in many fashions.  For example, the first choice you have to make is your character's race; all possible races are displayed (statically) on a large wall, with a hexagon underneath each, and you simply touch your bracelet to the desired race's hexagon to select it for your character.  At other stations, there are 8-12 touchscreens with a hexagon by them; by activating the hexagon with your bracelet, you "log in" to the touchscreen and are invited to make choices about your character's history in an interactive fashion.

Aside from that, in the exhibit, there are numerous non-interactive and interactive flatscreen displays around the showpieces.  Everything written or recorded is extremely clear, easy to understand (even for kids I would believe), pertinent, and interesting.  The exhibit is child-friendly as well; because everybody has earpieces, everything remains relatively quiet, and all the blinky lights and beautiful displays will captivate the attention of anybody, even if unfamiliar with the Star Wars universe.  (We were there with a toddler in her terrible twos and everything went smoothly.)  It really was a pleasure all the way through and I would return with other visitors for sure.

On a last technical note there was one other thing I thought was very nice: for some of the (presumably less-fragile) items like many of the costumes from the more recent episodes and some of the bigger props, like the full-scale pod racer, they eschewed the glass barriers and simply cordoned off the display areas with a warning saying they are protected by alarm.  I noticed many sirens mounted to the ceiling, and what appeared to be blinkered motion detectors hanging from the ceiling as well.  That was a great touch; it was awe-inspiring to stand by an original Darth Vader costume.

I read a bit about X3 Productions, the Montreal-based company who developed this exhibit.  Their stated goal is "to give more and more people reasons to enter museums;" well, as far as I'm concerned, they did a stellar (haha) job in this case.

Here follow some pretty shoddy pictures from my inept telephone.  Pretty much everything in the exhibit was original; there were extremely few replicas.  I believe all items below are originals.

R2-D2.

C-3PO.

More 3PO.

Anakin's pod racer.

Tusken raider and a Jawa.

Han in carbonite.

Leia's costume when held captive by Jabba the Hutt.

Jabba the Hutt puppet's eyes, one of the very few parts of the puppet which have survived to this day.

A station where you got to choose your character's mentor.

Original Yoda animatronic.

Y-wing.

X-wing, snowspeeder, Mon Calamari cruiser.

A-wing, B-wing and the Mon Calamri cruiser (hard to get the cruiser on its own).

AT-AT.

TIE Fighter, TIE Interceptor and TIE Bomber.

Star destroyer, shuttle, TIE Bomber and TIE Advanced.

Back of the star destroyer - this thing is huge.

Close-up of the TIE Advanced.

Chewbacca and Han's costumes.

Han.

Leia Organa.

Lando Calrissian.

Millenium Falcon.  Apparently Lucas inspired himself from the shape of a hamburger when designing this.

More ships because it's cool to see them all at once :-)

Helmets worn by pilots during the space fighting scenes.

Space suit worn by Luke.

Anakin's suit.

Speeder bike.

Speeder bike from the front.

Amidala costume.

Another Amidala costume. 
Same, from the back.

More Amidala.
Select your occupation.

Inside of Darth Vader's helmet, when Luke frees his father at the end of Episode VI.

Same; hard to get a picture without reflections.

Idem.

I believe this was one of Qui-Gon's costumes, not 100% sure.  (Looks quite similar to one of Mace Windu's as well.)

Note 100% sure who this one was either.

Obi-Wan's costume.

A Kel Dor Jedi costume.

Darth Maul.

Darth Sidious, aka the Emperor.

The man himself: Darth Vader.
Finally, a picture of my butt-kicking bounty hunter character, whom I named after a tuber because potatoes are awesome.
Our characters being displayed on a giant projection screen.

Friday, August 17, 2012

Forging a Ring (2004)


In January 2004 I took a one-day blacksmithing course with some friends from UW engineering, which was great fun.  We essentially drove out to the boonies in the dead of winter, and spent our day huddled around forges in a real workshop.

We spent the morning learning the basics and forging hooks.  I'm not sure I recall the terminology, but we learned how to forge a flat tail (looks like a beaver tail), a pointy end (looks like a stabby weapon type of implement), and how to twist the rod.  This last operation was the most satisfying; you stick one end of the rod in a vise, and using a giant two-handed lever that threads around the square section of iron, you basically literally twist the metal with your bare strength after heating up the central section.  You even get to see little bits of colder metal flake of the twisting sections as you pull, which is very gratifying for the ego.

During the afternoon, we got around to forging iron rings.  (I had yet to see a true engineering iron ring at that point in my life, so my ring doesn't really look like the real thing.)  The teacher mag-welded our rings for us, and we polished them afterwards.