Author Topic: Trail system: fadeOutTime has no effect?  (Read 6853 times)

JP

  • Posts: 11
  • Turrets: +2/-0
Trail system: fadeOutTime has no effect?
« on: May 05, 2008, 04:03:25 am »
My project is based on ioquake3 but integrates the Tremulous particle and trail systems.  I've run into a problem recently regarding the "fadeOutTime" parameter of a trail system definition - specifically, it doesn't seem to do anything.  The wiki page states that it controls "how long this beam takes to fade away", but any value I provide has no effect and the trail system remains forever.

I can show any of my code that's involved with the trails if that helps.  The one caveat I've found and accounted for is that both ends (frontAttachment and backAttachment) of a trail need to be attached to something (a client entity, a point, etc) for the property to work.  I checked this (with the CG_Attached function) and indeed they both are.

I searched around in the Tremulous data files for an effect that actually uses fadeOutTime, but couldn't find any.  I tried creating a trail system in vanilla Tremulous that uses it, and it didn't seem to work.  So is this a feature that's in the codebase that doesn't actualy work?  Or are there simply some obscure gotchas to using it?

Thanks in advance for the help.

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: Trail system: fadeOutTime has no effect?
« Reply #1 on: May 05, 2008, 04:43:20 am »
looks like the fade out effect is dependent on trailSystem_t->destroyTime being greater than 0, but it never gets set except to -1. it should work if you set it to cg.time + fadeOutTime or something when you create it.
« Last Edit: May 05, 2008, 04:44:51 am by kevlarman »
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

JP

  • Posts: 11
  • Turrets: +2/-0
Re: Trail system: fadeOutTime has no effect?
« Reply #2 on: May 05, 2008, 05:39:31 am »
Thanks for the quick reply.  I tried setting destroyTime earlier, and the trail never shows up.  Looking at the code, it seems possible that destroyTime doesn't do anything either... my code is the only code in the project that sets it to any value besides -1 (on CG_SpawnNewTrailSystem) and cg.time (on CG_DestroyTrailSystem).

Any devs know if these features are half-finished / never used, or actually working and I'm just making a dumb mistake?

JP

  • Posts: 11
  • Turrets: +2/-0
Re: Trail system: fadeOutTime has no effect?
« Reply #3 on: May 09, 2008, 05:09:18 am »
After some quality time with a debugger (  :-\  ) I tracked down a combination of things.

First and simple, in the case of my specific trail system, the trail's shader needed "alphaGen vertex" in its stage parms, otherwise it always renders at full alpha.

Second and more complex, the trails code doesn't seem to account for any trail system with a destroyTime of greater than zero.  Such trails never get populated with nodes, thus never render.  So I fixed that.

Also, the alpha value determination doesn't use floating point math, so by the time a beam node's alpha gets sent to the renderer, it's either a 1 or a 0.

My changed version of cg_trails.c is here:

http://rafb.net/p/QLKJ7S62.html

It's got my comments in the appropriate section, I can create a proper diff file if people want, but I'm hesitant to say "here's a patch, fix your shiz Tremulous" because I don't yet consider myself much of a real programmer, and/or I haven't tested this extensively against all the Tremulous content.  If the devs think this fix is worthwhile, hooray.

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
Re: Trail system: fadeOutTime has no effect?
« Reply #4 on: May 10, 2008, 03:48:30 pm »
Link is a 404.

Although I won't pretend I have some special insight into Timbo's mind, enhancements to the system would probably be ignored (or de-prioritised at least) by official devs unless there was a specific benefit to be had. Some of what you describe, though, sounds like straightforward bug fixing, which is always appreciated.
Even if your work wasn't accepted into SVN, cgame modifications are valued by the modding community (you certainly have me interested ;) ) and providing a patch would make your work much easier to use in that case.

http://bugzilla.icculus.org/enter_bug.cgi?product=Tremulous
benmachine

JP

  • Posts: 11
  • Turrets: +2/-0
Re: Trail system: fadeOutTime has no effect?
« Reply #5 on: May 10, 2008, 06:13:42 pm »
Quote
Link is a 404.
Sorry, I was using some nopaste site because this forum doesn't seem to let you do attachments.

Quote
Even if your work wasn't accepted into SVN
I didn't actually submit anything, I was just curious as to if anyone else was interested in the fix I'd made.  Thanks for pointing out the bugzilla, I'll create an issue and submit a patch for stock Tremulous there.

JP

  • Posts: 11
  • Turrets: +2/-0
Re: Trail system: fadeOutTime has no effect?
« Reply #6 on: May 18, 2008, 03:35:08 am »
Bug has been filed, with patch attached:

http://bugzilla.icculus.org/show_bug.cgi?id=3642

jal

  • Posts: 249
  • Turrets: +8/-7
Re: Trail system: fadeOutTime has no effect?
« Reply #7 on: May 27, 2008, 01:09:24 am »
Hi,

I'm sorry that I didn't read the whole thread. It may have been solved already, but it's late and I'm tired, and I just want to post a simple idea that may pass unnoticed: Did you make sure the particle shader was using the correct rgbgen and alphagen? I don't even know how the fading is done in that code, if it modulates the rgb values the shader should have rgbgen vertex, if it modulates the alpha value it should have alphagen vertex. Both probably would be the safer test :)

I thought about this inmediately at reading the topic tittle cause each time I add a new particle shader I forget to use the proper gen myself ;)

JP

  • Posts: 11
  • Turrets: +2/-0
Re: Trail system: fadeOutTime has no effect?
« Reply #8 on: May 27, 2008, 02:56:03 am »
I'm sorry that I didn't read the whole thread. It may have been solved already, but it's late and I'm tired, and I just want to post a simple idea that may pass unnoticed: Did you make sure the particle shader was using the correct rgbgen and alphagen? I don't even know how the fading is done in that code, if it modulates the rgb values the shader should have rgbgen vertex, if it modulates the alpha value it should have alphagen vertex. Both probably would be the safer test :)

I thought about this inmediately at reading the topic tittle cause each time I add a new particle shader I forget to use the proper gen myself ;)

Yes, back when I was originally investigating this a few weeks ago, one of the first things I had to figure out was the right shader parms.  But that didn't fix everything.

Just today actually, I discovered a bug with my first patch from the bug report, and submitted a new patch.