New effect PR: Missile smoketrails!

Discuss the future of Warzone 2100 with us.
aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

New effect PR: Missile smoketrails!

Post by aliswe » 25 Apr 2020, 15:02

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

User avatar
MaNGusT
Art contributor
Posts: 1106
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: New effect PR: Missile smoketrails!

Post by MaNGusT » 25 Apr 2020, 22:36

looks good ! hope it doesn't drop fps to 10 in 4vs4 games)
Image

Catilina
New user
Posts: 1
Joined: 19 Sep 2015, 23:13

Re: New effect PR: Missile smoketrails!

Post by Catilina » 26 Apr 2020, 03:06

Yay ! Nice work ! :)

Jorzi
Regular
Regular
Posts: 2053
Joined: 11 Apr 2010, 00:14

Re: New effect PR: Missile smoketrails!

Post by Jorzi » 26 Apr 2020, 11:08

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.
ImageImage
-insert deep philosophical statement here-

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 28 Apr 2020, 01:28

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

Jorzi
Regular
Regular
Posts: 2053
Joined: 11 Apr 2010, 00:14

Re: New effect PR: Missile smoketrails!

Post by Jorzi » 28 Apr 2020, 23:29

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.
ImageImage
-insert deep philosophical statement here-

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 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!

User avatar
Black Project
Regular
Regular
Posts: 745
Joined: 04 Apr 2008, 20:53

Re: New effect PR: Missile smoketrails!

Post by Black Project » 29 Apr 2020, 00:26

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.

Jorzi
Regular
Regular
Posts: 2053
Joined: 11 Apr 2010, 00:14

Re: New effect PR: Missile smoketrails!

Post by Jorzi » 29 Apr 2020, 07:32

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
ImageImage
-insert deep philosophical statement here-

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 29 Apr 2020, 08:24

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.

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 29 Apr 2020, 08:24

Forgot some new screenshots:

Image

Image

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 29 Apr 2020, 10:36

Also: Plugging the new Discord chat, please join to chat: https://discord.gg/uyvp8f

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 04 May 2020, 13:10

Update, mortars have thinner trails now as they lack propellants. Perhaps they should be even shorter.

Image

aliswe
Trained
Trained
Posts: 56
Joined: 01 Apr 2020, 22:11

Re: New effect PR: Missile smoketrails!

Post by aliswe » 08 May 2020, 19:45

Update, machine guns now have smoke trails and their projectiles hidden:

Image

Jorzi
Regular
Regular
Posts: 2053
Joined: 11 Apr 2010, 00:14

Re: New effect PR: Missile smoketrails!

Post by Jorzi » 10 May 2020, 21:47

I like that one, actually. It's a bit like tracer fire
ImageImage
-insert deep philosophical statement here-

Post Reply