Unit dirt texture Idea/Brainstorm

Unit dirt texture Idea/Brainstorm

Requests for features in the spring code.

Moderator: Moderators

User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Unit dirt texture Idea/Brainstorm

Post by Guessmyname »

Just this random idea I had when unable to sleep.

To make it look more like the units are interacting with their environment, I propose the addition of a 'dirtmap' texture. It would be greyscale, so if there's any spare channels left on texture two, it could use one of those.

Basically, it works like this:
The dirtmap is, as it's name implies, a greyscale representation of all the dirt on the model, ie mud/dust on trackguards etc, similar to how teamcolour works. A new map .smd value (dirtcolour=R G B; or somesuch) would define what colour to apply to this greyscale map, ie a brownish sand map could set the dirtcolour to an appropriate brown colour, and hey presto, sand on the trackguards, whilst a snow map could have a white dirtcolour and the unit would be appear to be covered in snow. You could even bring dirtcolour into the CEG code, so that you could have dust-trails and explosions the right colour for the map.

Thoughts?

EDIT: In theory, this could also be used to create map-appropriate camouflage.

I should probably also mention how the greyscale works: it's pretty much an alpha map for the dirtcolour, similar to how the greyscale teamcolour channel is an alpha map for the teamcolour: white = full colour, black=invisible (or whichever way around it is, I can never remember)
User avatar
AF
AI Developer
Posts: 20686
Joined: 14 Sep 2004, 11:32

Re: Unit dirt texture Idea/Brainstorm

Post by AF »

+1000

This dirt colour could also be used to tint dirt particles so no more brown dust clouds on snow maps
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Unit dirt texture Idea/Brainstorm

Post by Tobi »

Could even make it blend alpha with a map defined dirt texture, but this could easily be second step, once the channel has been defined.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Unit dirt texture Idea/Brainstorm

Post by Guessmyname »

Could indeed.

For maps lacking the dirtcolour tag, I guess either a default colour (brown) or some sort of LUA script that finds the most common colour/RGB value in the map...?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Unit dirt texture Idea/Brainstorm

Post by hoijui »

soo.. this color would be the smae for all the map?
i am thinking of a map where half of it is snow and the rest is dirt. would it be too difficult then?
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Unit dirt texture Idea/Brainstorm

Post by Guessmyname »

...quite probably hoijui... I'd recommend just using a dirt colour for that map (presumably the snow is only light)

For extra fun, we could even have the dirt texture only gradually begin to appear as the unit moves around (new units = clean) and fade away again if the unit goes in water.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Unit dirt texture Idea/Brainstorm

Post by hoijui »

yeah yo uare right. adn god idea that with washing the dirt away in the water :D
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Unit dirt texture Idea/Brainstorm

Post by Pxtl »

Guessmyname wrote:Could indeed.

For maps lacking the dirtcolour tag, I guess either a default colour (brown) or some sort of LUA script that finds the most common colour/RGB value in the map...?
Default = don't render dirtmap. Some maps won't want a dirt map - maps on clean, pristine surfaces that have no dirt, like (non-rusty) metal maps.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Unit dirt texture Idea/Brainstorm

Post by Warlord Zsinj »

While this is a good idea, I'd much, much rather have a 'battle damage' texture that slowly increases opacity as the unit takes on more damage.
Warlord Zsinj wrote:I remember suggesting something similar a little while ago.

Infact, what I wanted was a damage system that would slowly increase the opacity of a 'damaged' overlay texture, and then when health =0%, the engine would stop the unit, play an explosion, and then simply display the overlay texture at the maximum opacity (80% or whatever). So, unless you specified a custom one, we would have engine created dynamic corpses, which would be pretty cool, imo.
viewtopic.php?f=23&t=15833
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Unit dirt texture Idea/Brainstorm

Post by Guessmyname »

Yes. That would also be nice, thanks for the derail. What, pray tell, is wrong with having both rather than one or the other? The only problematic question being which was applied over the other... logically, shouldn't the dirt appear over even the battle damage? Or would it look odd with craters and cracks full of dust that still appears applied to a completely unharmed unit? Maybe there would be a way to merge the two dynamically as they both get applied to the model...

*wanders off into theoryland...*
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Unit dirt texture Idea/Brainstorm

Post by Warlord Zsinj »

Well, if dev interest was a limited pool, and there was interest in delving into texture overlays again, in my opinion, damage textures would be more noticeable, immersive, and interesting then dirt textures. Also, if the texture was utilising the blue channel on texture 2, then again I'd rather it be used for battle damage (though I thought they were going to split reflectivity and specularity there?).

Now, to bring this back on topic (actually, this is what I thought the topic would be about when I clicked on it):

I thought it could be interesting if CEG effects could also specify a certain greyscale colour or something along those lines that would read the dirt value in the smd. The reason I say this, is that you could have explosions that are reading the dirt colour from the ground, so that their dirt is coloured according to the terrain that the explosion was on. So if you have an explosion over snow, it sends up white dirt, or pink dirt on planet Smoth.

Another area that could be interesting is to get a value on the texture to read the dirt colour (which should probably be mapwide so that you don't have to do any 'what terrain are they on now' checks) and allow modders to read that colour into their textures. The point there being that you can design in camo that colours itself according to the overlying textures on the map. So, your units will have white camo on snow maps, desert camo on desert maps, and green camo on green maps...
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Unit dirt texture Idea/Brainstorm

Post by yuritch »

IMO per-map camo is no less noticeable than battle damage, I'd say it's even more visible. Visual battle damage can be simulated with scripting anyway (using some extra model parts that are normally hidden and get shown once health drops to some level), unlike custom camo coloring.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Unit dirt texture Idea/Brainstorm

Post by hoijui »

i like both ideas (dirt and damage), but if we had to choose one of them, i would prefer the dirt one. it can be used for dirt on the unit, explosions, camouflage, dust, ...
and from a users point of view, it will add more value to the game, then damage textures. the problem i see with damage textures is also, that it is always the same:
wether the crogoth gets hit by a bertha or a flash tank, it will show the same signs of damage, same scars, right?. while dirt on a unit would not suffer from something like that.

but of course, both of them are good ideas.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Unit dirt texture Idea/Brainstorm

Post by Argh »

WZ, doing damage textures with Lua is trivial.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Unit dirt texture Idea/Brainstorm

Post by Warlord Zsinj »

trivial if you know lua :P

hoijui; damage would not be directional or styled on what weapon has hit - but it would be proportional. If a unit is hit by a bertha (and managed to survive), its damage texture would appear far more opaque then if the same unit was hit by a flash tank. In other words, it'd look much more beaten up.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Unit dirt texture Idea/Brainstorm

Post by hoijui »

yeah.... i though of it like this. what i meant was rather: when hit by a bertha once, the unit would (in reality ;-) ) have a big crater, while receiving the smae ammount of damage from flashes would result in a lot of small craters, or melting points.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Unit dirt texture Idea/Brainstorm

Post by Argh »

trivial if you know lua
So, sit down and learn it. Or have Gnome whip it out, or ask Mael for some Lua, or whatever.

All you need, for a "damage map", if you're willing to eat some performance... is a texture with an alpha channel that shows the damage, and some simple code that does a gl.Unit call using the texture to do simple transparency, offset from the model's surface a tiny amount so that it renders without z-fighting. It's really, really, really trivial Lua.

The problem that I have with this particular idea, and the main reason I'm not providing any code (other than the fact that this is, after all, really trivial to write, and would be a great intro project) is that, unless you go the ultra-fancy route and devise a fragment shader method to "wrap" that texture around adjacent triangles, it's pretty expensive, because you're going to have to use a similar resolution for the "damage".

But I haven't the foggiest idea how to do a wrap around the triangles, and thus use a small-polycount object with a small texture to get the job done (er, that, and some fairly hefty code to store huge numbers of display lists, so that the "damage" shows up later, exactly like it was before). I'm sure that there is a way, trepan was talking about it before he left, and Spring uses a similar method for groundscars et al.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Unit dirt texture Idea/Brainstorm

Post by Guessmyname »

Eh? What are you talking about? I always figured that Warlord's suggestion was something like this:

Have the ordinary texture, and have a second one that's just the first all bashed up and that - a corpse texture if you will - with an alpha texture.

As the unit has the crap steadily beaten out of it, blend in the damage map, using the alpha as a sort of threshold similar to how it can be used in cob scripting right now (though with a softer effect. You know the 'BlendIf' thing in photoshop? Something like that), making it appear that the unit was gradually getting smashed up, with parts of it getting smashed up faster than others.

At 100% dead, the damage map takes over the ordinary one entire, and a corpse is generated using the positions of all the pieces (ie dynamically generated corpses that die in the same position they were last in)

At 0% dead, the damage map cannot be seen at all

That was my impression of Zsinj's suggestion anyway
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Unit dirt texture Idea/Brainstorm

Post by Argh »

Well, that's another valid way to go about it- just change the alpha value of the "damage" texture vs. current damage level. Not a big deal to do, either, and it's pretty much the exact same Lua, except that instead of using the source alpha, you'd just use a flat value.
User avatar
REVENGE
Posts: 2381
Joined: 24 Aug 2006, 06:13

Re: Unit dirt texture Idea/Brainstorm

Post by REVENGE »

All of these are pretty nice ideas. I'm going to contribute some conjecturing contribution: overlay the damage ground decal over units first if present, instead of just over the ground. So if a large plasma projectile landed near a factory, for example, the ground decal would get applied to the ground and any part of the factory it touched.
Post Reply

Return to “Feature Requests”