Friday, July 28, 2006

Some recent Fine Arts stuff

Here are a couple of things I've been working on lately for my Fine Arts class. I've been doing an animation using the Maya Dynamics simulations mixed with Maya's global illumination and caustics stuff in Mental Ray. The purpose is to get some pretty glass caustics effects on the wall, and I think that stuff is really cool. Some day I'd like to add that to my Raytracer too.

Here are some frames from the Animation, it's not done yet but it's getting closer now. Also here are some updates of a couple of other images I was working on, a 3D drawing thing and also that fruit bowl dealie from a while back. I'm not done these yet but they are getting closer now which is good. I meet with my Fine Arts Prof again once more before the end of term so I should have time to finish these off and get them to a better state, so that's pretty rockin'.

Caustics on the wall and refraction through the glass

More nice caustics

Pretty colours, sweeeeeet

A 3D drawing I started last night, it's kinda working ok but my Prof said it's not quite what he wanted me to go for with this. So I am going to scrap it for now but come back to it later when I feel like working on it more.

The 'ol fruit bowl painting, sortof Monet style. Hehe it's my first one so please don't laugh if it doesn't look a thing like any of Monet's work. :)

Almost done the term

Well it's been a fantastic term, but man it's been crrraaaaaazy. :) After the 270-ish hours that was my Graphics project, and the general amazing lack of sleep over the past month, I've taken a few days just to relax which is pretty good.

Tomorrow I've got to go "sign off" on the design for the Graphics class T-shirts I designed (see post from last week) and then get rockin' with some fierce studying. Should be a decent exam time this year, since I don't have as many as usual (thank you, independent study Fine Arts classes!) So that is pretty great but it's still a bit hard to get back into gear after coming off the Graphics Project racetrack. I'm still pretty tired from that, it was awesome but wow I think that's the most insane project I've done so far at University. Crazy.

Anyhoo tonight was a good relaxing one again, had an extra graphics class today where our Professor showed us some videos of water simulation, and really cool smoke and fire simulation, then some interesting (but apparently not "physically correct") subsurface-scattering NVidia stuff that simulates skin, it looks good but apparently real skin totally doesn't do that in real life. Hehe anyway it sure looked pretty cool. Hehe I love Graphics. :)

So I'm up again at 3:20am, I should probably be getting some earlier nights now, but I'm so used to going to bed at 5am lately that I'm not really tired yet. Hehe we sure watched enough Chapelle's Show tonight though, fantastic. I don't think Matt has seen it before so he thought it was pretty awesome. Dave Chapelle totally rocks, I love how his show is sooooo insanely ridiculous, but under all of the humour there are some super serious messages about society and American culture and racism and the list goes on. It's really kindof amazing that he can pull of that insane of a show, make it that awesomely entertaining and still get his message across loud and clear. I've said it once, I'll say it again... he's a comedic genius. :)

So other than wasting some more time on Facebook and MySpace tonight, I haven't done too much. I guess I needed a few days to wind down after the project. My Prof sounded happy with it today and they told me during my presentation that I might be in the top 3, which would ROCK THE HOUSE!!! I am reaaaaaaaaaaaaaaally hoping for a medal - the best 3 projects in the class get awarded a Bronze, Silver or Gold medal, it would be awesome if I get one, but also I won't be too sad if I don't win.

It's pretty awesome though that my 2 super-smart roommates Matt P and Matt L won Gold and Silver (respectively) last year, which is totally nuts. I am really happy with the knowledge that I've gained from this and how I was able to get it to where I really wanted to get it to, but it sure would be nice to get some props from school once in a while for working this hard! :) Hehe anyway no worries but it would be wicked if that works out.

Hmm I should go to bed. I don't sleep enough anymore. There is a lot to think about after term is done but I gotta try to keep to one thing at a time. I've got to get these CS 488 Shirts sorted and then get studying for my Exams. After those are done I am going to hang with Matt and Alex at Alex's cottage for a while, which will be aweeeesssssooome. I can't wait for that. After this I am heading to London then to Waterloo again, then to California. Pretty much all sorted for California now which is good, and things are a bit easier again this time because I've already got my bank account and Cell phone setup there from last term. I'm really excited to see my California friends again soon too, I really love that crew, they are an awesome bunch.

Oh yes in other news my animation for Fine Arts is starting to get to a decent stage I think. My Prof liked the Animation so far so I think it's pretty close. I have made a sort of hanging mobile that I have animated with some Maya Dynamics simulations, and the purpose is the animated caustics on the wall. Groovy. I'll post some images from it right now.

Wednesday, July 26, 2006

The Last Kiss

Now that my Graphics Project is finally complete and done and presented, I have been spending a bunch of time doing a whole lotta nothin', which is great. Now I am having a bit of trouble getting back into doing some final assignments and stuff but it'll all get finished eventually. Last night, Matt and Matt and I stayed up until like 4am watching TV and movies and we had a couple of celebratory drinks, white russians (a la "The Big Lebowski", of course) and it was great to finally sit back and relax for a bit.

As part of my "doing nothing" agenda for today, I got up at 4pm (12 hours of sleep, I gotta catch up) and I answered some MySpace and Facebook messages that have been sitting around for months and checked out the trailer for Zach Braff's new movie, called "The Last Kiss."

Check it out, it looks totally AWESOME. I have a list of at least 300 reasons (and counting) as to why I am going to love this movie, and it's not just cause Zach Braff is totally awesome, the writer is Paul Haggis, who is from London, Ontario (where I grew up) AND Rachel Bilson ("Summer" from The O.C.) is in it... the list goes on and on. Oh yeah it looks like Z. Braff is compiling the soundtrack too, which is legendary since the Garden State soundtrack was so painfully amazing that it almost hurts to listen to it, it's *that* good.

So that's what's up. I gotta do some Fine Arts and some drawing tonight, but it's hard to focus after coming off the 3 week powerhouse programming train that was my Graphics Project. My presentation to my Professor and the CS Tutor went very well yesterday, so that's groovy too.

Well, off to have some Bagels and Lox, the classic combination that every J-Crew homey can agree is the greatest combination since sliced bread and, um, sliced cheese I guess. Word.

Hi folks,

I'd like to announce the "ribbon cutting" ceremony for a new addition to my website which is a display of my Raytracer that I created for CS 488 at the University of Waterloo.

My technical documentation, along with sample images and runtime comparisons for every major optimization is available on this site. Stills from the animation I created are available as well with a description of which kinds of animation principles are being used and also the animation itself has been posted.

Enjoy and please email me with comments and suggestions for future extensions.

Monday, July 24, 2006

Rendered a movie with my Raytracer

Today I did a silly little animation in Maya with some Maya dynamics too. I wrote some scripts to export the frames to my own Raytracer, and I rendered it tonight. Then I put the movie together in VirtualDUB and made a soundtrack and sound effects in Sonic Foundry ACID.

Hehe yes, it is 5:48am. Please check out my video, the first animation rendered in my Raytracer!!

Download the movie here:

It is in DivX format. (If you need the codec, get it here:

Raytracer is Finished. Awesome.

The past 3 weeks have been awesome, fierce, super insanely intense, and full of the most interesting and most important computer programming I have done over my entire undergrad career.

First, here is my Final Scene. (You can click on it to see it bigger.)

I wrote a huge set of 10 major objectives over the past 3 weeks, plus I did several extra optimizations and a few more extra objectives and features.

I'd estimate at minimum approximately 10 hours of thinking, reading, researching and (mostly) programming, per day. At most, I'd say 14 or 16 hours. I've been going to bed at about 4:30, 5:30, 6:00am every single night for the past 3 weeks. Crazy!

So in total, I'd say this was about 3 weeks * 12 hours per day (on average), minus about 2 days break (one where I went to Toronto, another being a couple of evenings where I took the night off) = approximately 252 hours!!!!!!!!!!!!!!!!! :)

Hehe I'd say this is actually a decent estimate... oh man that's nuts. I have really been working every waking moment on this, and I've been sleeping less and less over the past 3 weeks. I figured it was at least 200 hours, haha I guess more like 250. Wow, that's totally nuts. :) But man... this was SOOOO AWESOME!!!!!!!!!!!!!!!

Anyway for those technical folks in the crowd, I'll be posting my Raytracer Manual to my website quite soon, along with example images of all the major features.

Here are a list of the Objectives I did, and a list of extra Objectives and Features I added.
  • Uniform Spatial Subdivisions (Grid Creation, WCS Axis-Aligned Bbox Transformations and Voxel Traversal): The Raytracer will use Uniform Spatial Subdivisions as a method to increase efficiency. This requires 3D grid creation, bounding box code for for all implemented primitives and Voxel Traversal using a 3D version of DDA.
  • Multi-processing and Analysis: The Raytracer will run a number of processes, greater or equal to 1, which maximizes computational speed. This number will be determined by a set of Raytracing experiments, and will be documented in the analysis.
  • Adaptive Anti-aliasing: Anti-aliasing is carried out on the scene to remove jaggies.
  • Refraction: Snell's law is used to compute the angle of transmission and secondary rays are cast on intersection with translucent objects to produce refraction effects.
  • Glossy Reflections: Objects may have a glossy reflection material applied.
  • Solid Texturing and Procedural Texturing using Noise: Textures can be applied to primitives, including checkerboard and procedurals using Perlin noise.
  • Texture Mapping: Texture mapping has been implemented.
  • Phong Model using Vertex Normal Interpolation on Triangles: Vertex Normal Interpolation is used to create smoother surfaces.
  • Area Light Support and Soft Shadows: Planar light sources are implemented and extra shadow rays are used to produce soft shadow effects.
  • Final Scene: A final, unique scene is created with techniques from Fine Arts. This scene will demonstrate the features of my Raytracer.

My extra objectives and optimizations were:
  • Fresnel Reflectance: Better glass simulation
  • Animation: Animated ball and exploding glass teapot (in total, 380 frames rendered.) The Animation uses some of John Lasseter's principles of Animation as described in class.
Several extra rendering optimizations
In addition to my objectives Uniform Spatial Subdivisions and Multiprocessing, I also did:
  • Voxel-Polygon Sub-Mesh Optimization
  • Shadow Ray Voxel Optimization
  • Optimal Grid Size Calculation
  • Makefile Optimized Build Settings
What a project!!!!!!!!!!!!!!!!!!! I am sooooooooooooooooooo glad it's done and handed in. Wow this was the hugest and craziest thing I have done in University, by FAR the most fun and important and wow... I just loved it.

Please keep an eye on the blog here for the launch of a new Raytracer section on my Website.

Sunday, July 23, 2006

Almost done Raytracer Final Scene for Project

Today I set the models up better in Maya and re-exported them. Also after some work it was clear that the normals on the picture frame were totally wrong and I couldn't fix them and get the picture frame to look good. Instead I made my own picture frame really quickly and used that instead, and it works pretty well. I also fixed the normals on the back wall and stuff so it is now textured and shadows are being cast on it correctly.

At the moment I am rendering my Final Scene with Anti-Aliasing, so that is going to take another few hours. I have some cool setup images though from today, and the render of my Final Scene without Anti-aliasing.

Note that the Final Scene image that I am going to submit will look a bit smoother than this one and a bit sharper so that's good.

Scene with no reflection or refraction to get placement correct, new camera angle

Almost done

Final Scene marked for Anti-Aliasing, about 50% of the image will be supersampled

Final image with no anti-aliasing, renders in 24 minutes on a P4 3.0 Ghz machine

Saturday, July 22, 2006

Finished Final Raytracer code, starting Final Scene

This is really exciting and awesome, I have spent soooo long and worked sooo hard on this Raytracer so it's really awesome to finnnnaally finish the code and get started on some creative stuff for my Final Scene.

I started by placing the objects in Maya and then making a Bounding Box version of the scene so I could easily place the camera quickly in LUA.

I then swapped out the bounding box table for my Maya models and it looks sweet. The glass is going to look really awesome I think!! I am rendering a test of this overnight. The glossy reflection mixed with texture mapping on the table looks totally wicked and I am so happy with it.

Initial scene placement

Switch to my Maya models

Add picture frame

Add coke can

Add texture on table

Add glasses and glossy reflections on table!! This looks awesome and note that the glass will
look much better when I run it with a much higher recursion depth.

Awesome glossy reflections on the table

My final scene so far with a recursion depth of 6. Note the glass looks wayyy better (and super awesome, if I don't say so myself) :)

Friday, July 21, 2006

Fixed sphere UV mapping

I had a small issue with sphere UV mapping, I've fixed it now and it's looking groovy.

Image of me on spheres looking correct now

All objects in Nonheir scene

Spheres looking better

Simple cows scene with texturing fixed now

Glass scene with Adaptive Anti-aliasing

Instead of sleeping again, I stayed up to Raytrace the glass scene with Adaptive Anti-Aliasing.

This was rendering in about 4 minutes before Anti-Aliasing, and now it takes about 25 minutes. That's not too bad considering I am casting 36 more rays per "bad pixel" here, so if I was doing the Naive supersampling approach it would take something closer to 2.4 hours rather than 25 minutes, so that's pretty good.

This looks pretty sweet, it has softened some of the edges and this should make my final scene look pretty nice.

Scene with no Anti-aliasing

Areas that were determined to need Anti-Aliasing

Scene with Anti-Aliasing

Adaptive Anti-aliasing

Tonight I wrote Adaptive Anti-Aliasing. This is a process which determines where there are pixels in the image that differ too much from their neighbouring pixels and these pixels are then "super sampled." This means sending a grid of rays across this pixel by subdividing the pixel a certain amount.

The overall effect of this is that this process smoothes out the Raytraced images so they look sharper and smoother. It's a nice effect and will definitely make my final scene look more professional. Sweeet.

Here are some pics from tonight.

First try at anti-aliasing, dividing by the wrong value!

Non-heir with no anti-aliasing. Notice the jaggies along the edges of the objects and along
the edges of the shadows.

These are the edges determined to be "bad pixels" by my Adaptive method.

Running Adaptive Anti-aliasing, notice the smooth edges.

Naive super sampling runtime

Adaptive Anti-aliasing runtime with removal of double entries for super sampling

Cows scene, not anti-aliased. Notice the jaggies on the edges of the cows and the shadows.

Cows scene, pixels marked by Adaptive Anti-aliasing method.

Cows scene with Anti-aliasing

Naive supersampling runtime

Adaptive Anti-aliasing runtime

Adaptive Anti-aliasing runtime with extra optimization, so that initial ray from 1st pass of ray tracing is re-used and not cast into the scene again.

Thursday, July 20, 2006

Scholarship-y goodness

Today was sweet, I found out that I won a scholarship!! It is totally sweet and will make a big difference for my last term in Waterloo which is next Winter. That's sooooooooo awesome and I am really happy about it, it's for Waterloo students who have been or are going on International Co-op terms. Fantastic.

So this is great news and I did the usual celebration and got some Swiss Chalet for delivery. And yes, it was freakin' awesome as expected.

Tuesday, July 18, 2006

Multiprocessing and more Optimizations

Tonight was the night for some more crazy optimizations for my Raytracer. I am almost done all the objectives for the Raytracer now which is sweet. Tonight I did Multiprocessing, so I am calling fork(), a system call which creates multiple processes. This has a slightly slower effect on my own Laptop because I have a Centrino processor, so it is not a Dual-Core and it is not Hyperthreaded either. So this does not have a specifically great effect. But, when running on the Hyperthreaded machines at school, it has a decent speedup, depending on the complexity of the scene. Essentially the purpose of this is to get the multiproc (or hyperthreaded) machine to act like to 2 machines working on one half of the image at a time. I join the processes at the end and combine the image together and delete the two image halves so that I don't have to do this manually in Photoshop.

So I don't have too many interesting images tonight, just lots of render statistics. But this is totally sweet cause it looks like it made a big difference.

The really cool thing though is tonight I tried running a compiler optimization flag, changing from a debug build to an optimized build. Well folks, the Venus De Milo model that was rendering in 46 minutes on my Laptop at home is now rendering in... 10 seconds!!! This is a 276 TIMES speedup... probably my most awesome speedup of all the Raytracing tests I have been doing. Sweet.

Venus De Milo runtime with 1 Process (94 seconds)

Venus De Milo runtime with 2 Processes (optimal - 77 seconds)

Venus De Milo runtime with 4 Processes (note this is slower than just 1 Process - 145 seconds)

Two processes from above (77 seconds), now runs in 22 seconds with an Optimized build

Venus De Milo on my Laptop with an Optimized build, was 46 minutes at start, now 10 seconds!

Table image rendered with 2 processes and optimized build

2 procs without optimization (~17.5 minutes)

2 procs with optimized build (~4 minutes)

CS 488 Class T-Shirt

This evening I made the class T-shirt for my super awesome CS 488 Graphics class. These are a bunch of the puppets that my classmates made for A3 (see my previous posts from June 2006 for a look at my puppet, the iPod man), and some images from A4/A5. Hehe you'll notice my Fresnel beer glass in the bottom left corner. Good times. Please click on these to see a larger version of them.

Front of T-shirt

Back of T-shirt

Monday, July 17, 2006

Big render of glass image with Fresnel

I "empirically" found some better values for the glass shader. Haha I love that word. By "empirically", I mean that I completely and entirely made these numbers up, and I am using them cause they look cool. Awesome.

Anyway here's the image, this is starting to look sweet, and with all the optimizations, this rendered at 1024x1024 in just over an hour, about 70 minutes.

Sunday, July 16, 2006

Soft Shadows and More awesome Optimizations

Tonight was totaaaaaaaally super productive for my Raytracer. I got a ton of stuff done and even more optimizations which is sweet. I also implemented Soft Shadows and Area Lights, so that is pretty groovy too.

Scene using one point light, no soft shadows

Soft shadows with no jittering (note the banding), 1x1 sample size

Soft shadows with jittering (note the noise instead of banding), 1x1 sample size

Soft shadows with no jittering (note the banding), 2x2 sample size

Soft shadows with jittering (note the noise instead of banding), 2x2 sample size

Soft shadows with no jittering (note the banding), 4x4 sample size

Soft shadows with jittering (note the noise instead of banding), 4x4 sample size

Soft shadows with jittering (note the noise instead of banding), 10x10 sample size

Soft shadows, 10x10 sample size, using Voxel traversal optimization method

Venus De Milo model with shadow optimization (looks the same as before)

Venus De Milo mesh with shadow ray optimization, now 35 seconds to render!

Using Matt Pharr's recommended optimal grid size, 3*cubeRoot(numPolys), even faster render time (24 seconds). This has gone from 46 minutes to 24 seconds, so this is now 115 TIMES faster!!

Table scene re-rendered with Voxel-triangle optimization, shadow ray optimization, optimal grid size optimization

Table scene runtime before Optimization (Render time ~ 5.4 hours)

Table scene runtime after all 3 Optimizations: Voxel-triangle optimization, shadow ray optimization, optimal grid size optimization. (Render time ~ 17.4 minutes) This is 18.5 TIMES faster!