More playing with XNA…

So in my endevours to do at least 10 minutes of programming a day, I have been playing around more with XNA. In the past few days I have run into a few things worth nothing.

For the longest time I couldn’t get my model to properly load or display. All the code would compile fine, but would throw an exception saying that it couldn’t find the model. I knew that I had properly added it to the project, so I knew that wasn’t an issue. What it turned out to be was when I was using the content manager to load it, I had something like “content\\models\\dude.fbx” when what I needed was “content\\models\dude”. I thought it was pretty weird that I didn’t need the file extension on it. Weird, eh?

The other thing that I am playing around with right now is drawing a grid and one of those little things that points along the three axis so that you can tell how things are oriented. I figured it wouldn’t be that challenging to draw a few simple lines, but to get exactly what I want has been… interesting. I have been learning lots about how to draw simple primitives.

Something I really would like to learn how to do is write my own shaders. There is a particular technique that I want to try out. On the first rendering pass you do standard lighting on everything in your scene. Then, you create a cube map from the position of the main character (or object of focus). The cube map doesn’t have to be very big at all – in fact, the smaller the better (I am thinking a 64 or 32 pixel cube map would work fine – where each face is 64×64 or 32×32 pixels). Take that cube map, and blur it until no detail is left (perhaps a 4x vertical and a 4x horizontal blur), then apply it to the main character. It should give a very nice lighting effect if done properly – complete with radiosity! It might be necessary to compine it with a regularly lit model, but considering how fast it is to render cube maps on new hardware, it’s a moot issue.

You can read about it here. That’s where I first came across the technique. For more information, try googling for “cube map lighting” (in quotes). It looks like a variation of the technique was used in the “Dawn” NVidia demo, as mentioned in this paper.

I really do think this looks good, and is very underused. I mean, who doesn’t like free radiosity?!

Leave a comment