Samstag, 29. März 2014

Camo Skins for Tanks

Since I have decided to implement camouflage mechanic to the Tank Game prototype I recently started, I soon encountered one problem creating the graphics for it. Each tank would require its own graphics per camouflage type, so if I had 3 different types of camouflage skins and a total of 6 tanks, I would have to create 18 single images. Most of that work would have been copy and paste in a graphics program and arranging the different parts correctly, which can be very tedious.

So how do you add different camouflage skins to tanks with minimum effort? 

The answer to this question usually is: automation. The idea is to have a tank body/turret shape or outline that is colored using a background image, the camouflage. Then a "shader" image is added to the colored background image to give the tanks some plasticity.

The magenta color is replaced with each pixel in the background image. The shader image is not displayed here but it contains white and black hightlights created with a brush of 25% transparency and 1 pixel size (with max hardness, no anti-alias). The shader image is applied with an additive blending method. The effect of the shader image can be best seen on the gray tank.

The algorhitm used was originally developed for StarFire and was intended to create labels on your spacecraft by modifying 3D textures. I have abstracted it to the extend it can be used by any software or game I'm going to develop in the future.

The result is an easy image merging implementation that spares me the work to create each tank skin individually. I just have to provide a shape along with a shader image and a few background images and the code does the rest. Each of these are very easy and fast to make, too. Maybe I'm going to add some easter egg camos including pink colored skins or heart skins :)

Keine Kommentare:

Kommentar veröffentlichen