Wednesday, July 16, 2008

To shade or not to shade

As we ramble on towards a demo, we've just switched a gear, okay a few gears, so we can make an internal deadline in time.

The latest build of the game has been stripped of all the shader functionality. For those who aren't familiar with the term, a shader is a program that is compiled and run on the GPU. They have local access to textures and object data, hence making rendering much, much faster than using a software-based renderer.

The shader sub-system that we had written into the game was behaving weirdly. Our in-game editors kept crashing for no apparent reason, and some scenes showed too much lag - something we'd need to address. But knowing that fancy eye-candy isn't on the main todo list, for the upcoming demo atleast, its kinda been kept aside for a bit.

Some bugs have been ironed out though, and there are some screens that we do wish everyone could see. A few screens first, then some explanations...















The above screens show a fur-shader in action. Agreed, the chimera was meant to be a reptilian thing, and reptiles don't really have fur, but hey, it looks nice, doesn't it?

The fur-renderer that I had written into the game build worked pretty nicely. However, the algorithm used needed 6 render-passes - that means each triangle in the above model was drawn 6 times (after depth-testing). This effect is only possible with programmable hardware - and is achieved using shaders in OpenGL. The 6 render passes kills framerates on older hardware, meaning you'd need atleast 256 MB VRAM and a pretty recent GPU, to actually get it to look good at decent frame rates.

Now, though, for the oncoming demo, the shader framework will most likely be out. Do keep your fingers crossed though...

So much for a first glimpse at shaders in the game.

No comments: