Page 1 of 1

Wreckage Shortcut [texture overlays]

Posted: 04 Dec 2007, 13:16
by Warlord Zsinj
Well, I'm in the middle of the process of creating the wreckages for SWS.

It really is a pretty awful job, having to make multiple-stage wreckages for every unit you have produced.

In order to speed up the process, I've worked out a means of using a number of premade 'scarred' layers, opacity and blending options to very quickly give premade textures a 'shelled out' look.

One thing I was wondering was whether it would be possible to make this process procedural-based within the Spring engine.

What this would mean would be to have textures overlayed (with a certain amount of alpha) on other textures when a certain event occured. This would work vaguely similarly to how groundscars are currently used on maps.

The result of this would allow me to make a handful of 'wreckage overlays', and then when units die, simply have the wreckage model load the original unit texture, and then overlay the specified 'wreckage overlay'. This would cut out a significant amount of workload from my end, as well as reducing the processing-hit in terms of simultaneously loaded textures (as the overlays could be reused across multiple units), as well as reducing the filesize of my mod (~5-10 texture files compared to ~100).

An offshoot advantage of something like this would be the ability to have units dynamically show battle damage as the battle wears on. So, say you produce a "battle damage overlay" texture, when a unit/structure is at say, 90% health, the battle damage texture is overlayed on the unit/building at 10% opacity. (Ideally this damage would be optionally reduced/removed during repairs by working in the opposite manner)

That way, you would have a visual cue of how damaged units are, as well as having your battle-weary armies look battle-weary. I'm sure people can think of all sorts of other visual things to do if they have the ability to dynamically change textures according to in-game actions.

Please note that yes, I have investigated the possibilities of doing this in lua, but it seems that while vaguely possible, the efficiency of doing it so would make it unfeasible, making a hard-coded option preferable.

Posted: 04 Dec 2007, 17:57
by KDR_11k
I don't think the efficiency in Lua would be all that bad, drawing the unit is done completely in C++ anyway and you only change the texture state before drawing it.

Posted: 04 Dec 2007, 18:44
by AF
Trepans been quoted as saying that lua model rendering can at times be faster than the engine because of the removal of a lot of engine stuff that could get in the way.

Posted: 04 Dec 2007, 23:54
by Warlord Zsinj
*cries*

Thanks for engaging with what was clearly the most important point of my post...

Posted: 05 Dec 2007, 00:00
by lurker
There there, don't cry, you at least got some coders thinking about it.

Posted: 05 Dec 2007, 07:52
by yuritch
Not directly related to the first post, but related to wrecks.
It would also be cool if wreckage 'inherited' relative piece positions and rotations of the base unit model when piece names match. That is, if the tank has a turret piece and the wreck also has a piece named turret, then wreck's turret should be turned to the same degree a unit's turret was when it died.