Trail customization

Trail customization

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Trail customization

Post by KDR_11k »

Currently smoketrails are really annoying because of their lack of customization, especially how you can't remove it from some weapons while leaving it on others.

The following were mostly taken from Descent Freespace's trail tags:

TrailTexture: Self-explainatory. Theoretically it's already changeable but the Texture tag only affects the segment that's currently being emitted by the projectile, not the parts that are already there (those use the default texture).
TrailColor/TrailColorMap: Obviously the same old color tags we get everywhere, colormap would fade through all these colors as the trail fades out.
TrailTTL: Time to live. How long a given piece of the trail exists after being emitted.
TrailAlpha/TrailAlphaMap: Same as Color/ColorMap except for the alpha.
TrailWidth/TrailWidthMap: The width, either constant or going through a number of variables again.
TrailRate: How often a new segment is drawn. For weapons that perform quick turns this would need to be much lower than for slow missiles or unguided ones.

Preferrably, again, all weapontypes except beamlaser and lightning would be able to emit a trail with the right tags.
Crampman
Posts: 117
Joined: 22 Dec 2005, 12:17

Post by Crampman »

I would prefer to use the explosion generator for that.
And why not add a 'trail' class in the explosion generator.

This would be more flexible, I think. :wink:
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

We can't attach explo gens to projectiles yet, though.
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

Can u make trails with the explo gen?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Not to my knowledge. How would you do them anyway? You'd need to follow an object for a while to make a trail and explo gens are point events.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

It's funny you just created that thread, because, just yesterday, I was fiddling precisely with custom missile trails! It bothered me that the pointer had a dull grey trail unfitting with the rest, so I took upon myself to redo, giving it more vivid color:

Image

You asked for:
- Choosing your own texture for the trail.
- Using alpha on that texture.
Well, both are already possible, in 74b3. Have a closer look at that resources.tdf of yours.

But, like pointed out, or more precisely, exactly opposite of what you pointed out, indeed it wouldn't use that texture for the first segment that's currently being emitted, only for older segments.

However, currently I have only one kind of smoke trail texture per mod, and maybe some mod will wants to use different kind of trail within the same mod.

TrailTexture: Already here. Just's it's per mod, and is bugged for the first segment.
TrailColor: No. The color is in the texture already.
TrailTTL: Ok
TrailAlpha: No. The alpha is already in the alpha channel of the texture .TGA.
TrailWidth: Ok.
TrailRate: I must point out that old TA had a tag, called "smokedelay", which, as indicated on Maestro excellent list of TA weapons tags, is the smoke dispersal interval expressed in seconds.
Why did you double every tag with an *Map ?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Thought the same, alpha and color map don't need to be split since the color map is RGBA. It would have to be split if additive blending was used, though.

I hope I understood what you are on about, spreading various alpha values over TTL.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The first segment texture is defined by the Texture2 tag in the weapon def, IIRC. Theoretically Texture2 should be valid for the ENTIRE trail but in practice it's not.

A *Map tag would work like the ColorMap tag in the explo gen, cycling through the listed values throughout the lifetime of the trail. So if you have ColorMap= 1 0 0 1, 0 1 0 1, 0 0 1 1; (ignore the colons, they're for readability and I think I just remembered that AlphaMap would be unnecessary) the trail would be red when emitted, green half way through its TTL and blue just before disappearing. Freespace had a startalpha and endalpha tag, I figured the maps Spring uses these days would be more useful. BTW, ColorMap will work for some projectile types in 75b1 AFAIK. RAVE GUN!!
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

It will work for 'Cannon' type weapons, at any rate.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

A *Map tag would work like the ColorMap tag in the explo gen, cycling through the listed values throughout the lifetime of the trail. So if you have ColorMap= 1 0 0 1, 0 1 0 1, 0 0 1 1; (ignore the colons, they're for readability and I think I just remembered that AlphaMap would be unnecessary) the trail would be red when emitted, green half way through its TTL and blue just before disappearing.
Thanks for the clarification. Well, I still think textured smoke trail is more awesome that color shifting trail.


KDR_11k wrote:The first segment texture is defined by the Texture2 tag in the weapon def, IIRC.
You know how to change the texture for the first segment, but not any other. I know how to change the texture for all segments but the first. By the power of our combined knowneldge, tada, we can texture the whole trail!

As an added benefit, we can use a special "start smoke" texture.

Just tested: Works!

Make two textures:
- smoketrail.tga
- startsmoketrail.tga
On these textures, you can have any color, lots of details, and alpha channel for semi transparency.

In the gamedata/resources.tdf, use:
.....
[projectiletextures]
{
smoketrail=dozerz/smoketrail.tga;
firsttrailtex=dozerz/startsmoketrail.tga;
...
}

Please note that the name firsttrailtex is an arbitrary name made up on the spot.

In the weapons TDF, use:

[Geometric]
{
.....
Texture2=firsttrailtex;
.....
}

And this is how I did:

Image

It starts with a purple trail, then it becomes a red trail. Both using semi transparent textures.

Yes, it's not perfect, since:
- You can only have two trail textures: 1st bit, all other bit.
- All smoke trails must use the same "other bit" texture.

Also, it still lacks, or I don't know how to:
- Make the trail larger
- Control how long the trail last
- Control how long are each segment. I tried smokedelay, didn't seem to work.


But still, much of what you asked was already possible in Spring 74b3.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

zwzsg wrote:You know how to change the texture for the first segment, but not any other. I know how to change the texture for all segments but the first. By the power of our combined knowneldge, tada, we can texture the whole trail!
I knew how to texture the whole trail (as evident by the fact that I changed it in the resources.tdf) but what I want is multiple different trails since there are many weapons that would benefit from a nonstandard trail (e.g. railgun) but leave you with no missile weapons if you change the trail.

Also you can only have your color change on the first segment of the trail, not over the whole thing.
User avatar
Comp1337
Posts: 2434
Joined: 12 Oct 2005, 17:32

Post by Comp1337 »

Holy moly zizzywizzy, that shot looks k-rad!
Post Reply

Return to “Feature Requests”