Page 1 of 2

New effect PR: Missile smoketrails!

Posted: 25 Apr 2020, 15:02
by aliswe
Hello!

Here's a new effect that I've developed in cooperation with AlexTheDacian.

Image

If you have any feedback, drop them here or (if it's relevant to the development) in the PR:

https://github.com/Warzone2100/warzone2100/pull/770

Re: New effect PR: Missile smoketrails!

Posted: 25 Apr 2020, 22:36
by MaNGusT
looks good ! hope it doesn't drop fps to 10 in 4vs4 games)

Re: New effect PR: Missile smoketrails!

Posted: 26 Apr 2020, 03:06
by Catilina
Yay ! Nice work ! :)

Re: New effect PR: Missile smoketrails!

Posted: 26 Apr 2020, 11:08
by Jorzi
Good stuff :)
So the evenly spaced billboards are changed into a strip of quads plotting the trail?
Some comments/suggestions:
-I can see some alpha blending artifacts. I think the original fx fix this by using additive blending, which avoids drawing order issues.
-The start of the trail looks a bit abrupt, maybe add a smoke cloud to cover the sharp cut.
-Maybe make it possible to tweak the fade speed, i.e. mortar rounds would have much shorter smoke trails than missiles.

Re: New effect PR: Missile smoketrails!

Posted: 28 Apr 2020, 01:28
by aliswe
Thanks guys :)

Yes, please read the PR, it's full of yummy info about what I want this to become. Lots of good feedback and design direction (both graphical and gamewise) have been given by AlexTheDacian.

I believe we need some gradual fading in the first segment, sadly I don't know how to do this just yet in the shader logic. But I definitely think that some additional effect to show the actual fire is needed. As well as a muzzle flash ... this is a first step.

WRT the blending artifacts, I totally agree with your observation, but unfortunately I believe this is as good as we can do right now. We actually use additive blending, but the issue here isn't the lack of additive colors (the colors get added correctly!), it's got to do with additive ALPHA rendering which is not supported in OpenGL OOTB if I understand it correctly. To do better than this requires significantly more complex coding which is not my level of ambition right now. Not on this particular detail anyway.

Here is the text of the PR, cited for reference. Note, "we" here meant me and AlexTheDacian with whom I collaborated on this PR.
We are thinking of three trail types, Mega (for super large ICBM type stuff), Mini (for Mini-Rockets etc) and Micro (for cannons etc, not in table).

Image

Note: "Existing" in the table refers to the Mega trail.

The Mega trail is pretty much what we have in the Gif. The Mini trail is "shorter" (fading more quickly) and thinner. The Micro trail should be even more discrete, barely noticeable to give more effect to the shot.

I'm thinking this configuration goes into weapons.json? A new property "smokeTrail" perhaps? Or does it fit in any existing properties.

We would also like to disable the "smoke puffs" for at least some of the projectiles that will have the new smoke trail.

Some work remains:

The trail should "look at the camera" to prevent being rendered as a thin line when looking right at it, or straight from behind. (https://twitter.com/i/status/1241438137668247552) I'm afraid this kind of calculation is beyond me and my non-existent matrix multiplication skills
The trail vertices should be somewhat rotated to match the trajectory angle. Right now the seams are vertical.
The segment frequence shouldn't be constant, but instead depending on the angle of the new tracked position. Long segments should repeat the smoke texture, and following segments should tile seamlessly (ie. begin at non-0)
We can include more of the rendering logic into the shader, namely the dispersion (named expansion in the code) and the whole trail can be rendered in one API call.
The shaders are hard-coded bco my inability to understand how they should be properly included in the existing framework.
Perhaps we should think of a fallback for low-end computers? Or is the effect not considered taxing on performance?
This PR depends on #769
I've temporarily disabled all smoke puffs, in projectile.cpp

Re: New effect PR: Missile smoketrails!

Posted: 28 Apr 2020, 23:29
by Jorzi
I think the fix you could make is to simply disable writing to the z buffer when drawing the smoke trails. I'm not an expert on the current drawing code but I think it should be possible. If I remember correctly there was a draw mode where you do z testing without writing to it.

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 00:18
by aliswe
do you mean the depth buffer? I presume it would be needed though ... I'm not an expert and you're getting dangerously close to my area of incompetence :lol2:

I believe even with this annoyance, the effect is in a releasable state. PRs are more than welcome though!

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 00:26
by Black Project
I would really love if there was an modding option to choose whenever a weapon has a smoketrail attached to it's projectile, rather than being attached to specific weapon classes.

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 07:32
by Jorzi
aliswe wrote: 29 Apr 2020, 00:18 do you mean the depth buffer? I presume it would be needed though ... I'm not an expert and you're getting dangerously close to my area of incompetence :lol2:

I believe even with this annoyance, the effect is in a releasable state. PRs are more than welcome though!
Looked a bit at the openGL documentation, apparently you have to set glDepthMask to false when drawing the effects.
https://www.khronos.org/registry/OpenGL ... thMask.xml

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 08:24
by aliswe
That was it! Thank you Jorzi!!!

Black Project, yes! The graphical table is only an action plan. (Feedback please!) The actual applying of the effect would be in weapons.js, ie. it will be fully moddable.

But, I am not hearing any feedback from developers WRT the implementation approach.

I need more feedback as I cannot implement this in the dark.

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 08:24
by aliswe
Forgot some new screenshots:

Image

Image

Re: New effect PR: Missile smoketrails!

Posted: 29 Apr 2020, 10:36
by aliswe
Also: Plugging the new Discord chat, please join to chat: https://discord.gg/uyvp8f

Re: New effect PR: Missile smoketrails!

Posted: 04 May 2020, 13:10
by aliswe
Update, mortars have thinner trails now as they lack propellants. Perhaps they should be even shorter.

Image

Re: New effect PR: Missile smoketrails!

Posted: 08 May 2020, 19:45
by aliswe
Update, machine guns now have smoke trails and their projectiles hidden:

Image

Re: New effect PR: Missile smoketrails!

Posted: 10 May 2020, 21:47
by Jorzi
I like that one, actually. It's a bit like tracer fire