Tsunami texture mapping at long last

I added texture mapping and blend mapping to Tsunami. The textures aren’t mine, they’re from a book and it’s associated tutorial. It looks much better now than the bland triangles from before. There isn’t a whole lot else to say about this except that I still need to add in the material system, which is next on the list.

I was able to add in a blend mapping. It just takes 3 different textures and blends them together based on what is defined in the blend map. These textures were also taken from a book’s tutorials because I don’t really care to make the textures or the blend map for that matter.

Lighting for Tsunami

I managed to get some lighting into Tsunami in the form of point lights, spot lights, and directional lights. Currently it only supports one light, but that will change. The next step I need to do is create a material system because, as of right now, there isn’t one and it’s a serious pain to pass stuff into the shaders manually.

The lighting in this image is vertex shaded lighting with ambient, diffuse, and specularity. The image is just a single spot light emanating from the camera in the direction of the camera, so it acts like a flash light. Wherever I point the camera, the light shines in that direction.

I’m not really sure if this is considered phong lighting/shading. I don’t really care that much since I’ll probably implement it later, but it seems that when people refer to phong lighting, they mean it’s per pixel, and the normals are interpolated and then renormalized on a per-pixel basis. These normals aren’t renormalized, but they are interpolated, since it’s a vertex shader that’s doing the work, but that’s about all. I’ve mentioned before that I planned on implementing a bunch of different lighting algorithms in the vertex shader and then doing the same for pixel shaders and then place them side by side to compare them, so eventually I’ll implement phong.

The next step on this ridiculous quest is to add texture mapping and the material system. For texture mapping, I’m just talking about basic diffuse texture mapping to at least make the ground plane look decent. I want crates too.

VS with diffuse and ambient lighting

This is just an update, not really meant to show how awesome it is or anything.  I managed to implement diffuse and ambient lighting (which I’ve done like 1000 times but can’t seem to locate the shaders for). I’ll get in specularity after a while with both vertex and pixel shaders. I’m also debating on implementing specular maps. There is an obvious tradeoff. If I eventually get my material system up and running, the object will be able to specify whether or not to use spec maps or have spec calculated.

Did implement a cool little pyramid object in the background though. I’m planning on working in lots of different lighting algorithms as well. Phong is popular, but the interesting thing is that they can all be per-vertex or per-pixel. So I will be implementing both so you can see side by side comparisons.

Sine wave with Tsunami

Sine wave

Sine wave using a vertex shader

Look kids, math.  Done using sine wave where the distance from the center is passed into the sine function (along with some other stuff). It animates with time too, but I didn’t feel like putting up a youtube video. I’ve wanted to make this for quite some time but I’ve just never gotten around to doing it. I always thought this looked cool though. May build off of this for a water scene in the future, but we’ll see. It used to have color associated with the height of each vertex, but I removed the colors and just made the height get darker. You can see the valleys get lighter in color.

On a side note, I’ve decided to keep posting the progress of my engine (which I’ve decided to call Tsunami). Mainly for myself to see where I’ve been because it’s kind of nice to see the progress I’ve made.

Good vertex buffers gone bad

I encountered a particularly interesting bug, I thought I’d post it here. It’s actually fairly easy to reproduce. As you can see from the screenshot, my scene is all screwed up. I’m attempting to draw a triangle grid. I know it’s being generated correctly because it was displaying earlier, but as you can see, it’s interesting because I’m drawing in wireframe. The real reason is because I have a memcpy() going on that is copying a vertex from 1 array to another (for various reasons). When I did this, I was copying only 3 vertices ( and forgetting about the 4th color), and overwriting the 4th element (the color) with the next vertex component (x value).  Note the vertex positions are capped along the x,y, & z. This is because I am giving (what I thought), each vertex a red color. This red color stomps all over the vertex positions in the array. The reason it caps the x,y,z is because the red has a max value of 255.

Besides that, I finally got my camera operational. I’ve done cameras in the past, but I had a bit of trouble with this one because I was hazy on my transforms.. After brushing up, I was trying different things such as using Quaternions, giving the camera a model world matrix and just inverting that for the view transform. Calculating the view transform myself by using only cross products or by using the Grahm Schmidt rule. For the mean time, I opted not to go with Quaternions even though I wanted to because I don’t have my quaternion library fully operational yet. So I decided to use spherical coordinates.

This worked better than expected, but there are a few corner cases. Looking straight up or straight down results in a division by zero so the screen goes blank. Also, you can flip the camera completely around so the controls are backwards. For example, if you were to look up, and then keep rotating your head so that you’re head is upside down and you were looking behind you (don’t try this at home, or anywhere else for that matter, you might scare people). This was really irritating for me, but clamping the latitude value between 0 and pi for the camera orientation solved all 3 cases.

Where delta is some small value.

Engine Update 001

I’m in the process of redoing my “testing” engine. I hope to make it robust, scalable, modular, while supporting a lot of other different technologies. This is the start of it using D3D9, but don’t worry, I’ll eventually port it over to d3d11. I’m going to skip 10 though. I have lots of things in the works for it too!

As you can see here, I have a few simple cubes and a triangle grid. Most likely the grid will turn into terrain. I haven’t decided what I wanted to name the engine yet. I’m leaning towards “Tornado.” I remember looking into a physics engine a while ago named “Cyclone” and I thought the name was interesting.

VS2010 Extension – Better Fix Mixed Tabs

I frequently deal with code that has tabs in it that needs to be converted over to code without tabs, preferably without losing any formatting. Unfortunately I have yet to find an extension to do this. I thought an extension called “Fix Mixed Tabs” would do the trick, but it only untabifies or tabifies the beginning of a line, so I wrote this one which can be found in Microsoft’s Visual Studio 2010’s gallery.

It can convert between tabs and spaces, it doesn’t go just one way.

Title: Better Fix Mixed Tabs (because Fix Mixed Tabs doesn’t do what I needed)
Link on Microsoft’s site (recommended): Better Fix Mixed Tabs


Azeem Khan wrote a script that allows the user to export data from joomla and move it over to wordpress.
Unfortunately it didn’t work with the latest: Joomla: 1.5.20 Stable and WordPress: 3.0.1.
So I extended it, you can find the script here: Joomla2WordPressV4

Azeem Khan’s site is here: http://azeemkhan.info/

Shortcut Drive Fixer

Allows the user to change a bunch of shortcuts to point from one drive to another.

Download: sdf.7z

Shortcut drive fixer

I made another one time use utility. I call it the “Shortcut Drive Fixer.”

After naming it that, I realized I should have named it “Shortcut drive changer”. Basically, I ran into an issue where I upgraded my computer and I wanted my games to be placed on my faster drive. I could have changed the drive letters around, but I wanted to take my games off of my slow drive, so if I changed the drive letters, other stuff would have broke anyways. So i made this simple little utility that reads in a directory (possibly containing subdirectories), and changes the shortcuts to point from one drive, to another.

It fixed all of my shortcuts in one go. You made it a little user-friendly (though still command line). I’m sure you could break it if you wanted to though.

You can grab it here.

Port Scanner Proggie

I created a little port scanning program in C# today. I found a tutorial on how to do it. It’s really easy. But it wasn’t multithreaded, so I made it multithreaded to keep the UI responsive. You can find it here.

Port Scanner

A multithreaded port scanning program written in C#. I wrote this because I saw a nifty little tutorial on how to do it, but it wasn’t multithreaded. I thought it would be a neat little exercise for me.

Download: PortScanner.7z

Copy and Rename

I developed this little tool because I had a ton of pictures that all had meaningless names in a directory, and I wanted some sense of organization. This tool was written in VB and it basically takes all of the files in a directory, copies them to a new directory and renames them sequentially so there is some form of organization. This was a throw away app for me and probably no one will ever use it, but here it is anyways. I have included the source code as well, but this app was written a very long time ago.

Download: CopyAndRename.7z

Restore Maximize Toggle

I developed this little tool because the software that came with Microsoft’s Intellimouse didn’t support a way to use the mouse to maximize and restore a window using one of their buttons on the mouse. With this tool though, you can tell the intellimouse software to run this little exe when a mouse button is pressed (one of the special mouse buttons), and whatever window is currently selected it will either maximize or restore the window. Very handy I think.

Download: restoremaximizetoggle.exe

Opera Session Exporter 2

I developed a small little tool that exports the URLs from an opera session file to a plain text file. It doesn’t save the history, just the tab urls. Also I have included the source. It’s not that great because I developed it in haste. Check the readme though.

Download: OperaSessionExporter2.7z

High Dynamic Range

Description: This is a DirectX application that I developed that is highly based off of the directX sdk sample. It implements glare/bloom, crosses/stars, blue shift, tone mapping, & light adaptation.

Date: 2009


  • Tone mapping
  • Light Adaptation
  • Blue Shift
  • Stars / Crosses
  • Glare / Bloom

Platform: PC

Requirements: None

Controls: None

Download: None

Screen Shots:

Blue shift off

Blue shift on.

Deferred Shading

Description: This is a DirectX application where I implemented deferred shading. Essentially it renders the scene to a G-Buffer where is stores normals, color, position, depth, & lighting information to different render targets. Then, you can combine them any way you want. This has the added benefit in that you don’t have to loop through each light and for each light, render each object.

Date: 2009


  • Directional Light Sources
  • Point Light Sources (Not implemented, coming soon)

Platform: PC

Requirements: Windows XP, 512 MB RAM, 1.6 GHz Processor

Controls: None

Download: None

Note the three directional light sources. Green, Red, & Blue.

Precomputed Radiance Transfer – Spherical Harmonics Lighting

Description: This is a DirectX application that I developed using Precomputed Radiance Transfer (PRT) and Spherical Harmonics (SH) in order to implement a form of Global Illumination (GI). The two screen shots show the scene using a directional light source and a cube map as a light source.

Date: 2009

Features and Notes:

  • Self Shadowing
  • Soft Shadows
  • Realistic Lighting
  • Scene objects must stay static relative to each other
  • Scene objects can not deform
  • No Specularity
  • Only uses vs_1_1
  • Real-time
  • Requires a long precomputation process
  • Dependant upon mesh resolution of scene objects
  • Can be extended for inter-reflected diffuse (Not implemented, coming soon)
  • Can be extended for subsurface scattering (SSS) (Not implemented, coming soon)

Platform: PC

Requirements: Windows XP, 512 MB RAM, 1.6 GHz Processor

Controls: None

Download: None

Screen Shots:

Directional Light Source

Rotating Cube Map Light source. Note the new color of the objects.

Sundown Cerose

Description: A fast-paced comic book style 3D isometric based action/adventure game where the player must battle hordes of minions in order to save the galaxy.

Gameplay video footage of Sundown Cerose.

Position: Technical Director

Date: 2008 – 2009


  • Designed and coded the input, using DirectInput, scene management system, using TinyXML, physics, collision detection, and the engine framework to allow for dynamic object interactivity.
  • Implemented all of the required features by utilizing C/C++, the Win32 API, DirectX, C/C++ Standard Libraries, and the STL to ensure a robust framework on the Windows PC platform.
  • Worked closely with the designer and the producer to successfully implement the game’s required features before the preceded milestones.
  • Engineered a component based design using Object Oriented Programming principles to allow for versatility in the engine framework.
  • Assisted in the core design of “Sundown Cerose” in order to plan the development of a dynamic and robust engine architecture that would meet the designs requirements.
  • Designed and Implemented the level editor

Platform: PC

Requirements: Windows XP, DirectX 9 compatible graphics card, 512 MB RAM, 1.6 GHz Processor, Vertex/Pixel shaders 2.0 or greater.

Controls: Move: W,A,S,D
Aim: Mouse
Shoot fireball:Left mouse button
Flame thrower: Right mouse button

Screen Shots:

The flame thrower in action.

The player was hit and is now running away.

The player shooting fireballs.

The player charging at the enemies.

Prerendered 3D Projects


  1. A chess set. Modeled in 3DS Max.
  2. A close up of the chess set.
  3. A castle that I modeled based off of blueprints. Untextured wire frame. Modeled in 3DS Max.
  4. A Deathwurm. Not textured. Modeled in 3DS Max.
  5. A level for Unreal Tournament 2003. Modeled using UnrealEd. A 3 story building on my school’s campus. Modeled and textured completely. Textures were created by me using a digital camera. Includes a cafeteria, offices, kitchen, book store, post office area, cafe and game area.