Living In A Material World

With teaching on the MSc done with for a while, I’ve had a bit of spare time to work on my engine. As well as the projective lights from the previous post, I’ve finally got round to implementing a basic materials system, allowing me to have differing specularity and brightness values for each texture colour used. To implement this, I first had to generate a ‘materials’ layer for my texture atlas system, to go with the diffuse and normals layers I already had. To generate the actual materials texture, I adapted my Syndicate Wars texture loader, and palette-shifted all of the game’s textures and sprites to a predefined material lookup index – so for example, all water pixels get a new palette index of 56. This proved to be trickier than anticipated, as in some textures ‘green’ is the colour of polluted water, while in another it might be a dull metal, or grass, so I had to cut up the source textures into sub sections when loading them in, and then palette-shift each individually.

Anyway, from this material lookup index, I extract the per-material properties from a couple of 1D textures, allowing me to finally get rid of that annoying ‘shiny’ grass! Seems like a lot of work for not much, but as a nice side effect of changing how I cut up textures, the ‘stretched’ textures of adverts and police signs are stretched no more! Also, it means I can generate mipmaps with less inter-texture bleeding – hooray!

Here's my new debug hud overlay, showing shadows in the top right, and material indices in the bottom right.

Here's what the end result currently looks like. Not quite as much bloom as the new Syndicate game...

This is the result of splitting as many SWARS sprites as possible up, instead of being packed together into 256*256 chunks. Bits that are still packed are due to geometry in the game that has texture coordinates that bleed over.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>