For my CS 488 final project, I improved upon the ray tracer I built for a previous assignment to include advanced effects and optimizations. I started with the goal to build a renderer that can imitate the art style of the artist k3, who specializes in colorful and fun 3D renderings.


1. Reflection


Reflection on objects

2. Transparency + refraction


Rows of glass spheres and blocks demonstrating refraction

3. Caustics

Caustics were not implemented due to lack of time.

4. Soft shadows

The following three images show the same scene rendered with 3 different lights:


No soft shadow


Soft shadow with area lighting size 1, 8 samples.


Soft shadow with area lighting size 2, 32 samples.

5.  Texture mapping


Texture mapping of cubes and spheres.

6. Constructive solid geometry


Constructive solid geometry was implemented, supporting union, intersection, and subtraction of cube, sphere, cylinder, and cone primitives.

7. Additional primitives: cylinder and cone


Rows of cylinders and cones.

8. Normal interpolation for Phong shading

Not completed due to lack of time.

9. Uniform spatial partitioning for meshes

Uniform spatial partitioning can be enabled for each individual mesh object. The following scene (from A4) contains 3 cow models, each with 5804 polygons. 09_uniform_spatial_subdivision

This scene was rendered with increasing number of partitions to compare render time. All renders done with bounding box optimization, 8 threads and no supersampling.


This graph shows rendering and total time as the number of partitions increases. Total time = render time + preprocessing time. We can see that partitioning the model into 2x2x2 partitions had huge benefits, but there is diminishing returns after that, and eventually the increase in processing time outweighs the improvement in rendering time.

10. Final scene

This is my final scene. Inspired by artworks by k3. 10_final_scene_small

The following is the same scene rendered at a larger size. Unfortunately, this rendering didn’t finish until past the submission deadline.


Extra Objectives

Schlick’s approximation of Fresnel reflection

I implemented Schlick’s approximation of Fresnel refraction to make my glass objects look better. Here is a comparison:


Without Schlick’s approximation.


With Schlick’s approximation. Notice the reflection on surfaces when the view angle is shallow.

Parallel processing

Tracing of rays is split among a number of worker threads. Here are the rendering times for the reflection scene at 2x supersampling, on a Intel 4 core CPU with hyper-threading:

parallel processing render time

Rendering time with parallel processing.

Bounding box optimization for meshes

For meshes with large number of polygons, significant time savings can be achieved by first testing rays against the mesh’s bounding box. Rendering times for macho-cows.lua (8 threads, no supersampling):
Without bounding box optimization: 854 seconds (14.2 minutes)
With bounding box optimization: 27.161 seconds

I know it’s been a while since I last updated Tenshi, but university just started and I didn’t have as much free time as before. Anyways, I’ve put together a relatively major update for the Tenshi Pet. I added dual screen support that Michael requested, and some new features (see change log).
Also, I decided to just use mediafire for all my file hosting, since it’s more reliable and less hassle than free web hosts.

Download (1.2.1)
Please read previous posts for the required fonts and .NET framework:

Change Log:
Ver 1.2.1:

– Added dual screen support
– Added “about” window
– Now if you drop the rock on Tenshi when she’s standing, she will grab it right away
– Added “Dismiss/Summon Tenshi” option
– Added right click menu on rock
– Added the ability to drag Tenshi (she will follow your mouse if you click on her and drag left or right)
– Added opacity options
– Fixed some problems with Tenshi getting stuck not doing anything

Download (1.13):
New Version Available:
Old DL:

For those who didn’t read the post a few days ago: you also need to install the font here.
Also, you might need the .NET Framework (x86) or (x64) to run this

You can right click Tenshi for a menu of options

Update Log:
Version 1.10:
– Tenshi levels up from being hit now! (I don’t know how that makes sense, but I know we all love watching a colored bar fill up!)
– Leveling up increases the strength she throws the rock with
– Interface is now more colorful
– Save files are encrypted to discourage cheating
– New achievement: Ping-pong (this one’s possible, I even did it a few times myself)

Version 1.11:
– Progress is automatically saved every minute to prevent progress loss from unexpected exits
– Tenshi is more.. jelly-like? idk if this makes it better, but I think it looks funnier this way.
– Fixed most collision glitches
– Removed the “telekinetic grab” “feature”
– Fixed tenshi going off screen
– Reduced exp required to level up
– Increased the amount of influence tenshi’s level has on the throwing strength’

Version 1.12:
– Fixed the error that some people encountered when opening the Stats window.

Version 1.13:
– “No Way That’s Impossible” is more possible now.

Back in Feburary, I left a comment on Walfas saying I’d make a desktop version of the Pet Tenshi game/flash/thing. Now I have finally finished it! (Hey, it’s only been 5 months, that’s not bad.)
Anyways, here it is:

Font Download:
Before you get the program, I recommend downloading and installing the font above. Without this font, some text may not display properly. (I didn’t want to distribute the font with the program because it’s a commercial font)

Program Download:
New Version Available:

Features Added/Removed from Original Walfas Version
– Some of the original achievements are changed to make them more possible
– An impossible new achievement is added
– Autorun on startup (probably useless)
– The rock now obeys the laws of physics when colliding with Tenshi’s head (more or less) so you can hit her sideways and get the rock to bounce up
– Didn’t add the ‘charge’ thing (I didn’t really understand how it worked anyways)
– You can’t change the rock’s sprite =(

There are still a few bugs and glitches here and there. Here are some that I’ve found:

– If tenshi is standing close to the wall and the rock is dropped in the gap between her and the wall, weird stuff happen. (I don’t think I’ll be fixing this..)
– Tenshi might walk into the wall (This should be an easy fix)
– Tenshi could get stuck at pushing the rock against the wall
– Tenshi might get stuck, period.
– Sometimes the combo display doesn’t disappear
– Autorun doesn’t work on Vista/Win7 because the program doesn’t have permission to edit the registry
– The achievement checkboxes look ugly on Vista/Win7
-Tenshi sometimes grabs the rock telekinetically ._. (Maybe I should call this a feature…)
There are probably a lot of other glitches, leave a comment if you find a new one… Actually, nvm, I don’t really want to fix them.

– Credits to KibyM and Thefre for their brilliant idea and the original flash game.
– Sprites are from the original flash by KirbyM (and thanks to flash decompilers lol)
– Thanks to programmer-in-training for his Per-Pixel Alpha Form
– Also thanks to the various online resources that I used, and google which helped me to find them.

Arrangement Title: U-espace
Album: A-WA-I-RO
Artist? Composer?: アカツキ (Akatsuki)
Original: [Tabula rasa ~ 空白少女] from Touhou 3.0 – Phantasmagoria of Dim.Dream

Yesterday I felt like learning a song to play on the piano, so I spent half a day listening to Touhou piano arrangements. At first I decided to try Voyage 1970, but that didn’t go too well D= (216bpm is impossible…). However, that somehow lead me to discovering kkcwkoh’s channel where I randomly clicked on this song. This song instantly caught my attention because I’ve always been a fan of mysterious-sounding music, and after listening to it many times, I decided to transcribe it. It’s a pretty easy song especially compared with other Touhou music, so I recommend piano novices like me to try it out.

PDF here:
mp3 here:

mp3 uploaded by kkcwkoh:

Did this transcription some time ago. Original song by DenKare (short for 電気式華憐音楽集団). It’s not a well-known band, but for those of you that like Yousei Teikoku (妖精帝國), you’d find the vocal really familiar, because both bands feature Yousei Yui as the vocalist. The song’s from “Gore Screaming Show”, which is a pretty disturbing visual novel by the looks of it. But anyways the song is good.

And mp3:

Original song:

Theme of Payon is one of my favourite songs in Ragnarok. It brings back such good memories of when I played RO with my friends (it’s not as nostalgic as theme of Prontera though, since I spent hours and hours vending in Prontera so that song is like, more familiar to me than the windows XP startup sound).

MintJam, one of my favourite bands, did an awesome piano arrangement for Theme of Payon in their 2004 Ragnarok Online Arrange album. Awesome band + nice song = perfect song.

Since this song is so good and is all in piano, I decided to transcribe it so I, as well as other people interested, would be able to play it on the piano.

And mp3

Original song:

I made some inserts for pen modding for those penspinners out there that are also Touhou fans. The sizes are for RSVP, but you can probably crop it a bit to fit other pens. Sorry for the lack of color on some of them — I made them with my printer’s ink in mind.

Thanks to the creators of these images, and also for allowing me to find them easily.

And here they are: (Click for full size)

touhou insert 1

touhou insert 2

touhou insert 3

touhou insert 4

touhou insert 5

touhou insert 6

We haven’t updated Fobcraft for like, half a year, so it was pretty much dead. Typingmania was down because of x10hosting’s policy of suspending accounts if they’re not accessed for 2 weeks…

However, I’ve been working on a game programmed in Java. It’s a defense game based on the Korean mmorpg Ragnarok Online, and inspired by Twilight Frontier’s Patchcon. I’ve actually been working on this project since two years ago, in the process taking months-long breaks and never got much done. But I’ve decided to finish soon. In fact, it’s already playable, just that there are many bugs to fix and things to add. The sprites and effects are made by Shuvora, and he’s lazy so a lot of stuff are missing sprites which I used an Alice sprite from Patchcon.

I uploaded the game on Take a look if you’re interested (it’s an Applet, runs in your browser).

So I decided to resurrect Fobcraft as a place to keep track of my progress on the game.

In other news, Shuvora uploaded Typingmania on a new host:

I know, the address sounds pretty inappropriate, I laughed at it when he first told me… Please give him a lesson on how to make normal-sounding domain names…

Fixed some things on Clicky:
-Fixed inaccurate interval (it’s still around 10~30ms off right now though)
-Fixed preference saving




Get every new post delivered to your Inbox.