Apparently there has been a decal implementation in FSO before but that got removed again for some reason. This new decal system should work better and more importantly should work for the foreseeable future. This new system is based on our deferred renderer infrastructure which makes it very easy to render decals onto arbitrary geometry. Here are the test builds: http://swc.fs2downloads.com/builds/test/decals/
Typically these decal system would also allow to change the normal data of the surface where the decal is created but due to the way the rendering engine of FSO works at the moment that is not possible to implement. Once this initial version is integrated into FSO I will take a look at how the engine can be changed in order to allow normal mapped decals to be implemented.
The integration of the decals into the engine is quite limited at the moment since I first wanted to actually have a working system before adding more elaborate features. The builds introduce a new decal table type. There is no main table so you have to use modular tables that are named <something>-dcl.tbm
. At the start of the table you need a #Decals
and terminate that with #End
at the end of the file. After that you can add as many decals as you like with $Decal
you need to specify the name of the decal definition e.g. $Decal: TestDecal
This specifies the texture or animation that should be used as the color channel of the decal. Currently there is no other channel but more features will be added in the future.+Loop:
This lets you specify if the animation should reset once it reached its last frame or stay on that last frame.
The only option currently supported is +Diffuse
which specifies what diffuse texture should be used for this decal. This may be an animation.
Here is a complete table that I used for testing:
To use that decal as the impact decal of a weapon you need to add $Impact Decal
after the location where the engine expects $Shots:
. You specify both which decal you want to use and how big the decal should be in the game world like this:
$Impact Decal: TestDecal+Lifetime
+Lifetime: (1.0 5.0)
specifies for how long the decal should stay around after being created. You can specify the range of possible values by using two values. The lifetime of each individual decal will then the chosen within that range. You can also specify the string "Eternal" (I'm still searching for a better term here so let know if you know one) if the decal should never vanish. This should only be used for very important effects since every decal uses some performance so too many will cause FPS issues.
As soon as that weapon hits a ship (it only works for ships at the moment) it will spawn the decal. The decals do not expire at the moment so performance will probably suffer if too many decals are created.
Please let me know if you find any bugs and while you are here, please let me know how this system should be integrated into FSO.