Pages

Wednesday, 13 October 2010

Bluestone GPU lightmapper update


2.1 million sample points rendered in 6 seconds (Bluestone screenshot)


The GPU lightmap renderer I've been developing (Bluestone) is written in XNA. It's always been a concern that the remit of XNA most definitely isn't GPU lightmap renderers but until recently that hasn't been an issue.  Unfortunately, the changes made to the framework in XNA 4.0 (link) mean that using XNA for this type of application is probably no longer practical. The biggest issue for me is the loss of control over render targets and depth buffers. In XNA 4.0 render targets are automatically assigned depth buffers. Meaning it's no longer possible to reuse a single depth buffer among multiple render targets, which is what Bluestone requires.

In order to move the project forward I needed to look elsewhere. There were a few different options but I've gone with SlimDX, for several reasons. I can stick with C# for one but it also has the advantage of opening up a lot of very nice DirectX 10 features not available in XNA. So far the porting has gone well and both the direct and indirect lighting systems are in place.

In related news, an unexpected win was a decrease in global illumination render times. I made some alterations to the GI shader which have worked wonders. I need to test it more widely but the improvement seems to be about 30% in most cases.

Monday, 4 October 2010

Untextured lighting stills


Some plain diffuse volume light shots. Click for high res versions.

  





Animation blending

I've done some more work on the animation system recently so I thought I'd change gears slightly and write about that today. 

You will have noticed in the previous video I posted that the robot's animation transitions are very sudden and don't look very natural (even for a ridiculously proportioned robot).  The remedy to this is animation blending, whereby two or more animations are smoothly blended during a transition phase. This has been on my to-do list ever since implementing skeletal animation so I've finally gotten around to it.

The first place I turned to for implementation details was the book Game Engine Architecture by Jason Gregory (which I highly recommend). Chapter 11 contains a wealth of practical information on implementing animation systems. 

The first change required was to store keyframe data in scale/rotation/position format (also known as "SQT") instead of matrix format.  The reasons for this are; a) it's smaller, b) it's impractical to blend between transform matrices. The second was to implement a global time line scheme when dealing with the animation clips (also detailed in the same chapter). I won't go into my implementation as it's still quite rough at this stage and bound to change but definitely check out the book if your interested. 

With that in place, a short transition between animations made a big improvement but you can go one better. Linearly blending between animations doesn't take into account any of the twelve principles of animation and makes for frowny animators (in this case, me). By blending in additional transition clips you can create much more interesting animation behaviour. In this case I've added a transition clip to the start and finish of the walk cycle.


Left: idle to walk. Center: walk loop. Right: walk to idle.
 
  • idle to walk transition: This one's very quick as the character needs to start walking straight away. It basically consists of  a slight anticipatory body dip and also starts the limbs moving.
  • walk to idle transition: A longer animation used to help settle the character back into it's idle pose. There's a slight body sway as the torso comes to rest and the arms swing forward to follow through after the motion of the walk. This helps to convey a sense of weight to the character.
The in game results can be seen in the video below.

Wednesday, 29 September 2010

Light volumes - animated character

Similar to my previous post but with an animated character this time round.

Animated Character
I went about texturing this model a little differently to usual so I thought I'd mention it. I'd normally lay out the UV's, pick a few nice base textures and start painting away in photoshop. I thought I'd try something different this time round, it's a technique I've seen used in lots of places and I was keen to try it. Instead of manually painting in all the rusted / chipped areas (which is actually a lot of fun) you use a bunch of masks and procedural noise to blend between different surface types. The image below shows a rust mask built from ambient occlusion, cavity, 3d noise and a scratchy bitmap. The ao and cavity maps provide rusted areas in the grooves and worn edges while the noise and scratch maps provide general wear and tear.


Below is the resulting texture map, rendered straight from the material editor. It could definitely use a pass in photoshop to add some more specific detail but it's fine for the time being. Rendering out spec and bump maps was also very easy.


With the textures done I animated a walk and idle cycle and exported the character into the engine. I've spent a lot of time on the mesh and animation exporter so thankfully the process isn't painful.

Video
Okay, onto the actual video which came together pretty quickly. I already had a very basic animation system in place but it doesn't support blending so the animations do pop a bit. I also had to manually control the camera so the camera work isn't as smooth as the other videos. Environment wise I'm still using the same volume textures but I have boosted their contribution to the light buffer.

That's all folks, don't forget to switch it over to HD, hope you enjoy and thanks for reading :)

Thursday, 23 September 2010

Light Volumes – animated objects

Another excellent feature of light volumes not mentioned in my previous post is that both static and animated objects can be lit with the exact same data set. The video below shows this in action. It's in HD this time round so be sure and watch it full screen. As with the previous videos the frames were saved straight from the XNA render engine I'm working on.