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.

On Syndicate

Since I started on my Syndicate Wars remake / OpenGL engine project, EA have announced a remake of their own, due out next month. In many ways it’s quite odd seeing such a complete reimagining of what Syndicate is – I had long since assumed the IP was dead and buried, and had several times wondered what additions and changes I’d make to Syndicate Wars to bring it up to date. It’s a shame to see it return as ‘just’ an FPS rather than the pseudo RTS of the original, especially so close on the heels of the new Deus Ex – I think the similarities between them in the art style and story background is going to make the new Syndicate feel a bit ‘me too’, even though they were developed concurrently and independently, with the long development time of AAA games leaving little time for ‘borrowed’ ideas, anyway.

This, combined with the return of the original Syndicate (and perhaps later Syndicate Wars) on the GOG download service is raising the level in interest for these original classics, so it’s a bit of a shame I haven’t made more progress with my own Syndicate Wars engine. It would have been nice to ‘show off’ a bit! Oh well 🙂

Work does slowly continue on new graphical features, partially as an offshoot of my work supporting the Graphics For Games MSc module at Newcastle University. My most recent addition is in ‘projective lighting’ – using the colour values of a projected texture as attenuation values in my lighting calculations. Integrating projective texturing as an additional step in my deferred renderer was a fun little project, and ended up replacing my old code for projecting sprites to use as shadows. It allows some neat little extra effects, as shown in the following screenshot:


In the future, headlights will project nyancats.

In the future, headlights will project nyancats.

Syndicate Wars Map Editing

Part of the fun in decoding the Syndicate Wars map format (beyond the excellent existing work by others) is in being able to make changes to a map, and put it back in the original game. Below are a couple of screenshots of the first Eurocorp level, with all of the ‘map furniture’ sprites changed to a) the big streetlights (which explode in quite a pleasing manner!) and b) the bizarre ‘Burning Man’ sprite easter egg from the New Delhi mission (press the ‘hide buildings’ button to see it!). Other things I’ve found include the tag which sets a section of the map as being water, and so should have a ‘wave’ animation effect – it’s quite disorienting seeing the entire map ‘wibble’ on screen! Also below is the earliest screenshot I can find of my engine, back when I was just getting started trying to think of what to do about lighting; you can see I’ve got the normals wrong on the landscape as there’s incorrect lighting everywhere – that’s what happens when you think normals are per triangle, rather than per vertex!

I have a website again!

It took me a year, but I finally managed to get around to buying some more webspace! I also managed to not back up my old site, so I’ve had to redo it all by hand, and lost all my news posts and comments. Oh well.