CodeItNow

Archive for the 'Uncategorized' Category

Catmull-Clark Subdivision: The Basics

For a little under a year now, I’ve been using Modo to learn how to create 3D models. I’m doing this partly for fun, and partly to help me think about game engine features from the perspective of an artist. Along with the traditional poly-modeling tools, Modo (like many other 3D tools) also has support for subdivision surfaces. A subdivision surface basically allows you to create a low-poly control mesh for your model, and to add detail, you let the application divide each face in your mesh according to a set of rules.

Here’s an example:

Read more

2 comments

Counting Objects In A List in C# 3.5

While I was reading through some C# 2.0 code that a friend of mine wrote, I noticed that he was finding some objects in a List using a foreach loop. As soon as I saw that, I thought to myself that I would probably have done that using FindAll with an anonymous delegate.

That got me thinking about all the different ways you can find things in a List in C#. I’ve recently upgraded to using Visual Studio 2008, so with the advent of C# 3.5 there are even more ways to do something like this. Which method is best is not very clear, so I thought it was time for some performance tests.

The Test

I decided that a nice and simple performance test would be to find all the numbers less than 10,000 in an array of 1,000,000 random integers. To even things out, I perform the same test 100 times for each method, and take the average time. I generated the set of random numbers once, and then used that same set in all tests.
Read more

1 comment

Nothing To Report

Well, there’s not much to report really. I’ve been spreading myself very thin recently, investigating a few different things, so I thought might be nice to post a status update.

Variance Shadow Maps

Yes, I’m jumping on the variance shadow maps boat. They look nice, they’re easy to implement, and have relatively small overhead over traditional shadow maps. I read the article in GPU Gems 3, which is also available here, and it was pretty easy to implement from there. It probably took me about 2 hours to go from no shadows at all to variance shadow maps. After a bit of tomfoolery to get rid of the light-leaking I ended up with the image below. I haven’t implemented any bias yet, so there are some errors there, but the VSMs appear to be working very nicely.

Read more

3 comments

Welcome!

I finally took the plunge to set up my own website! I’ve been wanting to do this for a while to be able to share some of the things that have interested me as I spend my spare time writing a small game engine. I hope that someone somewhere finds these things interesting!

One other reason that I set up the site is to have central place to store information about a couple of small pieces of software I wrote: DoItNow and MockItNow.

DoItNow is a little addin for Visual Studio 2005 that I use both at work and at home to speed certain parts of the development process up. It’s like Visual Assist, but not as good, and freer.

MockItNow is a C++ mocking framework. If you write unit tests in C#, then you have probably tried out using something like RhinoMocks, or maybe TypeMock. There isn’t much choice in C++, so I wanted to see if I could write something.

MockItNow was a great venture into the unknown for me. I wasn’t at all sure that I would be able to pull it off at the start. In fact, I had two failed attempts (based on ludicrous ideas) before I landed on what I use now. Along the way I learned a lot about areas I’d never looked at in great detail before, like stack frames, x86 assembly, calling conventions, type traits… The list goes on and on. I also learned some nasty little tricks that you can do in order to get at certain pieces of information I needed along the way too. I wouldn’t recommend using some of these techniques, but I had to do what I had to do.

I’ll be providing some more of the gritty details about how MockItNow works over the coming weeks, but If you can’t wait, then feel free to download it and take a look.

The site’s still a bit of a work in progress at the moment, but I set myself the goal of getting something up this weekend, so here I am. Unfortunately the great weather stole a lot of my time, but be sure that I’ll be improving things as I learn more!

1 comment