Adventures with Arduino: From 41 Instructions to 1

A couple of weeks ago, I was looking for a fun project to do with my 8 year old son. By chance, I saw a recent issue of Make Magazine which had a feature about an electronics prototyping platform called Arduino. I thought it sounded pretty cool, and could be a good introduction for my son to some basic electronics as well as some simple programming. The Arduino is designed to be very easy to use. It comes with a set of tools based on the Wiring programming environment and…

What’s wrong with this picture?

Well, you could point out a number of things to answer that question. There’s some pretty obvious aliasing, a random pixel on the ground which should be in shadow but isn’t, it’s noisy, boring etc. But that’s not my point. The point is: It’s too dark! I know it’s too dark because I know how I rendered it, and I rendered it wrong. It still kind of looks acceptable (well to me at least) though. I’m not sure that I would say that it’s implausibly dark if I didn’t know…

Direct3D 11 Multithreading

I’ve been putting it off for a while, but with my recent trip to GDC and the arrival of the Direct3D 11 beta, I thought it was about time I switched my renderer to be multithreaded. One of the things I learned at a Direct3D 11 talk at GDC is that it works on ‘down-level hardware’, which means DirectX 9 & 10 cards. Of course, you don’t get the snazzy new hardware features, but you do get some of the benefits of the new API, like multithreading and limited compute…

Another MockItNow Update

I fixed a problem with the EXPECT_THROW macro (I had uploaded the wrong file). Also, I added the ability to stub out results for function arguments passed by pointer. I would recommend downloading the zip file to take a look since there were a few files that had to change this time. I added one new example to show the new functionality.

Energy Conservation In Games

Recently at work I was chatting with a colleague, and the topic of energy conservation for specular reflections came up. This reminded me that I’ve been sitting on a blog post for a while about just this subject, so I thought it was time to finish it. First of all, I’d like to start by looking at the standard diffuse reflection model. In games, the typical formula for calculating diffuse reflection from a particular light is: Where Cd is the diffuse material color, Li is the light color, N is…

Irradiance Caching: Part 2

In my previous post, I wrote very briefly about anĀ  important improvement to the irradiance caching algorithm – irradiance gradients – and I’m going to expand on rotational gradients this time. Gradients The gradient of a function represents both the direction and rate of change of that function as the inputs vary. For a one dimensional function this is simply the derivative of the function. As you move into higher dimensions, you need to consider which coordinate system the inputs for the function are specified in, as this will change…

Irradiance Caching: Part 1

Solving the rendering equation with even just one bounce of indirect lighting can take a long time. The majority of time spent rendering a frame is in estimating the lighting integral. For example, rendering a single bounce of indirect lighting at 720p resolution with 256 sample rays for a Monte Carlo estimator requires about 237 million rays to be cast. This doesn’t even include the rays needed for sampling the lights for direct lighting, so in practice, the total will be even higher. One interesting observation made by Greg Ward…

MockItNow: Throwing Exceptions

I’ve made a small update to MockItNow to allow you to throw exceptions when replaying function calls. You basically record the function call as normal, and provide the exception object that you want to throw during the replay using the EXPECT_THROW macro. You can also make a function default to throwing an exception at registration time using REGISTER_THROW. If you want to see a couple of examples of this feature, take a look at the bottom of the sample file here.

Books

A couple of days ago, I stacked the random assortment of books I had lying on my desk at work, and for some reason I decided to take a photo. It’s a bit of a mixed bag of good and not-so-good books. Every now and then I know I’m in trouble because I have to whip out the yellow maths book to remind myself of something that I have forgotten. I enjoy the challenge of reading the quaternions book, but it’s pretty hard to motivate myself to really get into…

Better Sampling

A couple of days ago, I compared the images my ambient occlusion integrator produced with those of Modo using similar settings. I noticed immediately how much ‘cleaner’ the render from Modo was. Clearly there was an issue with the way I was picking my samples, so I set about improving things. My approach for generating the ambient occlusion rays was to generate uniform random samples over the hemisphere about the normal. Based on two random numbers in the range [0,1), I calculate the normalized sample direction using the following function:…