Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Experiment with adding a second tracer smoke  (Read 345 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Experiment with adding a second tracer smoke
« on: February 13, 2024, 05:03:05 PM »

As we all know, only one tracer smoke can be drawn for a bullet at any one time time. From the early days the effect was the simple '2D' trail type. Then later on someone got the ball rolling by creating a particle-based '3D' effect.

But are we stuck with just the single effect only? No!

I just had a brainwave and tried an experiment in adding a second effect for one of the gun classes (in this case, the Browning .303). This involved creating an additional weapon property for guns, which involves 3 base classes:

BulletProperties.class
BulletGeneric.class
Gun.class

This does not require to add the new property to all guns; if the property is absent nothing additional happens and the single tracer smoke is drawn as per normal. One could choose to implement this feature for only the weapons desired.

Here's the first result, where I have both the old school trail and the 3D particle effects being generated at the same time. The advantage? The trail can 'fill in' to some extent the gaps between the 3D smoke puffs. And one can likely reduce the number of 3D particles for further resource savings. Whether the two effects together, with fewer 3D particles, is actually less computationally intensive than a many-particle 3D effect by itself is not known yet. I suspect it can be, given how few trail type elements make up a full trail.

Thoughts?

Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

shardana

  • member
  • Offline Offline
  • Posts: 862
Re: Experiment with adding a second tracer smoke
« Reply #1 on: February 13, 2024, 05:26:31 PM »

Yesss! I love smoketrail so much I wouldn’t mind a setting in conf.ini that allows personalization of the thikness.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #2 on: February 14, 2024, 09:38:27 AM »

To tweak thickness one can easily edit the relevant parameters in the .eff files. If by "thickness" you mean the density, or opacity, The 4th number on line "Color0" controls this (permissible range 0.0 to 1.0). If you want to adjust the width/size, the two numbers on line "Size" set the start and finish size (in meters).

Using a setting in conf.ini would either:
- require to make a set of effects having the desired range of variations, or
- globally adjust the scale for ALL effects at the time of their generation.

Either approach is not ideal, from my point of view.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #3 on: February 14, 2024, 09:55:11 AM »

I'm re-working Gun.class, which sets and generates the tracer effects. It includes PAL's mod that already allows to disable tracers and tracer smokes. Furthermore, my default is to use a low visibility 2D tracer smoke for ALL ground weapons, in all instances.

I have found that mixing the 3D with 2D does permit to reduce the particle count for the 3D version. My current test has the particle generation rate (and total count drawn at any one time) set to 80% of that when the 3D version is used alone. This should give room for the inclusion of the 2D trail with no resource or performance hit--I hope.  ;)

My thinking right now is to offer:
- The usual 2D tracer smokes for all weapons.
- 3D smokes for the player only, substituting the 2D versions.
- A mix of 2D and 3D smokes for the player only (as illustrated in the OP).

When 2D and 3D smokes are enabled to be generated simultaneously, the effects selected may be different to those for the effects when used individually. The idea being that adding the two effects will increase the density, and so versions having a somewhat smaller opacity would be more appropriate. I'm still experimenting with this; if possible it's better to not have lots of variations.

I'm not so keen on having 3D smokes for non-player guns. The potential for extreme particle counts, which will cause disappearance of all kinds of effects, is not pleasant to contemplate.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #4 on: February 14, 2024, 10:32:42 AM »

In line with my previous post, here's the code in Gun.class:

Code: [Select]
String stringN = ".eff";
if (World.Sun().ToSun.z < nightSmoke)  // nightSmoke converted from deg to radians
stringN = "_Night.eff";
int TrailType = 0;
String TraceTrail = super.prop.bullet[i].traceTrail;
String TraceTrail2 = super.prop.bullet[i].traceTrail2;
if(actor != World.getPlayerAircraft())  //all actors except player
{
if(actor instanceof Aircraft)
TrailType = 1;  //AI planes (and player when 2D smoke used)
else
TrailType = 4;  //ground weapons
}
else  //if player
{
if (Config.cur.ini.get("Mods", "TracerSmokePlayer3D", 0F) == 1F)  //3D smokes substitutuion enabled
TrailType = 2;  //PLAYER plane 3D SUBSTITUTION
else
if (Config.cur.ini.get("Mods", "TracerSmokePlayer3D", 0F) == 2F)  //2D/3D smokes mix enabled
TrailType = 3;  //PLAYER plane 2D/3D MIX
else
TrailType = 1;  //PLAYER plane 2D
}
switch(TrailType)
{
case 1: // '\001'  //2D effects for all AI planes, and PLAYER if 3D smokes not selected
default:
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail.eff"))  //larger calibres, generally 20mm+
TraceTrail = "Effects/Smokes/SmokeBlack_BuletteTrail" + stringN;
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail2.eff"))  //smaller calibres, generally <20mm
TraceTrail = "Effects/Smokes/SmokeBlack_BuletteTrail2" + stringN;
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailCurved.eff"))  //generally the more strongly spiralling smoke
TraceTrail = "3DO/Effects/Tracers/TrailCurved" + stringN;
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailThin.eff"))  //used by AI only?, mostly surface weapons; in ORIGINAL FOLDER -              perhaps this can be deleted...
TraceTrail = "3DO/Effects/Tracers/TrailThin" + stringN;
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/TEXTURES/fumeefine.eff"))  //used by only 1 class: MGunBrowningnew50k
TraceTrail = "3DO/Effects/TEXTURES/fumeefine" + stringN;
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/Thirties_BulletTrail.eff"))  //used by only 2 classes: MGunBrowning303kwpzl, MGunBrowning303scpzl
TraceTrail = "Effects/Smokes/Thirties_BulletTrail" + stringN;
bullet.effTrail = Eff3DActor.NewPosMove(super.pos.getAbs(), 1.0F, TraceTrail, -1F);
break;

case 2: // '\002'  //3D effects SUBSTITUTING 2D for PLAYER ONLY (does not use new property TraceTrail2)
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail.eff"))  //larger calibres, generally 20mm+
TraceTrail = "3DO/Effects/Tracer_Smokes_3D/SmokeBlack_BuletteTrail_3D.eff";
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail2.eff"))  //smaller calibres, generally <20mm
TraceTrail = "3DO/Effects/Tracer_Smokes_3D/SmokeBlack_BuletteTrail2_3D.eff";
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailCurved.eff"))  //generally the more strongly spiralling smoke
TraceTrail = "3DO/Effects/Tracer_Smokes_3D/TrailCurved_3D.eff";
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailThin.eff"))  //used by AI only?, mostly surface weapons; in ORIGINAL FOLDER -               perhaps this can be deleted...
TraceTrail = "3DO/Effects/Tracers/TrailThin" + stringN;
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/TEXTURES/fumeefine.eff"))  //used by only 1 class: MGunBrowningnew50k
TraceTrail = "3DO/Effects/Tracer_Smokes_3D/fumeefine_3D.eff";
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/Thirties_BulletTrail.eff"))  //used by only 2 classes: MGunBrowning303kwpzl, MGunBrowning303scpzl
TraceTrail = "3DO/Effects/Tracer_Smokes_3D/Thirties_BulletTrail_3D.eff";
bullet.effTrail = Eff3DActor.NewPosMove(super.pos.getAbs(), 1.0F, TraceTrail, -1F);
break;

case 3: // '\002'  //3D effects MIXED with 2D for PLAYER ONLY (uses new property TraceTrail2)
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail.eff"))  //larger calibres, generally 20mm+
{
TraceTrail = "3DO/Effects/Tracer_Smokes_2D_3D/SmokeBlack_BuletteTrail" + stringN;
TraceTrail2 = "3DO/Effects/Tracer_Smokes_2D_3D/SmokeBlack_BuletteTrail_3D.eff";
}
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/SmokeBlack_BuletteTrail2.eff"))  //smaller calibres, generally <20mm
{
TraceTrail = "3DO/Effects/Tracer_Smokes_2D_3D/SmokeBlack_BuletteTrail2" + stringN;
TraceTrail2 = "3DO/Effects/Tracer_Smokes_2D_3D/SmokeBlack_BuletteTrail2_3D.eff";
}
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailCurved.eff"))  //generally the more strongly spiralling smoke
{
TraceTrail = "3DO/Effects/Tracer_Smokes_2D_3D/Tracers/TrailCurved" + stringN;
TraceTrail2 = "3DO/Effects/Tracer_Smokes_2D_3D/Tracers/TrailCurved_3D.eff";
}
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/Tracers/TrailThin.eff"))  //used by AI only?, mostly surface weapons; in ORIGINAL FOLDER -                perhaps this can be deleted...
TraceTrail = "3DO/Effects/Tracers/TrailThin" + stringN;
else
if(TraceTrail.equalsIgnoreCase("3DO/Effects/TEXTURES/fumeefine.eff"))  //used by only 1 class: MGunBrowningnew50k
{
TraceTrail = "3DO/Effects/Tracer_Smokes_2D_3D/fumeefine" + stringN;
TraceTrail2 = "3DO/Effects/Tracer_Smokes_2D_3D/fumeefine_3D.eff";
}
else
if(TraceTrail.equalsIgnoreCase("Effects/Smokes/Thirties_BulletTrail.eff"))  //used by only 2 classes: MGunBrowning303kwpzl, MGunBrowning303scpzl
{
TraceTrail = "3DO/Effects/Tracer_Smokes_2D_3D/Thirties_BulletTrail" + stringN;
TraceTrail2 = "3DO/Effects/Tracer_Smokes_2D_3D/Thirties_BulletTrail_3D.eff";
}
bullet.effTrail = Eff3DActor.NewPosMove(super.pos.getAbs(), 1.0F, TraceTrail, -1F);
if(super.prop.bullet[i].traceTrail2 != null)  //needed when a class does not have the new TraceTrail2 property included!
bullet.effTrail2 = Eff3DActor.NewPosMove(super.pos.getAbs(), 1.0F, TraceTrail2, -1F);
break;

case 4: // '\0043'  //ground weapons
TraceTrail = "3DO/Effects/Tracers/TrailThinLow" + stringN;  //to make ALL surface weapon trails this low-visibility smoke; in ORIGINAL FOLDER
bullet.effTrail = Eff3DActor.NewPosMove(super.pos.getAbs(), 1.0F, TraceTrail, -1F);
break;
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #5 on: February 14, 2024, 11:06:14 AM »

In my current implementation of the 2D/3D mix scheme I have specified in Gun.class a 3D effect to be used with the 2D smoke. This means that in the weapon class any effect provided for the new TraceTrail2 property will be ignored, the Gun.class entry being used instead. My notion is that any 2D smoke will always be paired with a corresponding 3D smoke, without fail. Why do this?

As I mentioned previously, I may end up using a different 3D effect when used in combination with a 2D effect, as opposed to a 3D effect used by itself. Whether the different effect has a different name, or has the same name but resides in a different folder, is functionally the same. Instead of reading the effect name string ans supplying a substitute (as is done for the night versions of the 2D smokes), I simply supply the desired path/effect name.

In a gun class we might have:
Code: [Select]
gunproperties.bullet[0].traceTrail = "Effects/Smokes/SmokeBlack_BuletteTrail2.eff";
gunproperties.bullet[0].traceTrail2 = "Effects/Smokes/SmokeBlack_BuletteTrail2.eff";

The new TraceTrail property needs only have a valid path/file name. Here they are identical. No matter, because Gun.class supplies the actual effect to use. The advantage here is that any subsequent changes in the approach to handling the effects can be taken care of in Gun.class. There is no need to make changes to the scores of weapon classes. A very attractive scenario to me.

Now, I just have to add the new property entries to all those gun classes...

Note again that the addition of the new property has no impact on earlier versions of Gun.class. One could use the updated gun classes in an older or otherwise 'stock' game version. The code there will simply not read the new property; it functionally does not exist.

If anyone has any other ideas on this, please pipe up!
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #6 on: February 14, 2024, 11:27:54 AM »

Another matter of note.

My approach, for simplicity, is to always pair the two weapon properties. That is, when a 2D/3D tracer smoke pairing is enabled the 2D smoke is always generated along with its 3D sibling. Never are there bullets having a 2D smoke only or a 3D smoke only. They always go hand in hand.

To me, in this scheme there would be no real advantage to having some bullets make a 2D trail only and others make a 3D trail only. After all, the idea is to combine both so as to overcome the disadvantages of each when used alone.

Another agreeable consequence of this approach is the lack of a need to ever supply the new TraceTrail2 property for bullets not already having a TraceTrail effect specified. That is, if TraceTrail = null, there is no need to pair it with TraceTrail2 = null. A check on whether or not TraceTrail = null suffices to know that TraceTrail2 will also be treated accordingly. This eases the workload in the editing of the weapon classes when adding the many new entries.  ;)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Re: Experiment with adding a second tracer smoke
« Reply #7 on: February 15, 2024, 02:09:37 PM »

Last night I added to all MGun classes having the TraceTrail property my new TraceTrail2 property. Now all aircraft guns making tracer smoke can have this new mixed 2D/3D tracer smoke as a selectable option. I'm now fine-tuning and balancing the trail and particle texture pairs for each smoke effect.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

shardana

  • member
  • Offline Offline
  • Posts: 862
Re: Experiment with adding a second tracer smoke
« Reply #8 on: February 15, 2024, 02:12:16 PM »

Thank you WxTech! I've done as told and managed to get the right tracer smokes! thank's!
Logged
Pages: [1]   Go Up
 

Page created in 0.037 seconds with 27 queries.