Jump to content

Recommended Posts

Posted (edited)

Hello gang, both old familiar faces and the newer ones.

Haven't been much around recently (if 9 years modding hiatus can be described as such...) but to be frank meeting recently  again with the very passionate Enoc "Flogger23" -and being introduced by him to intriguing dlls-related work started by Eagle114th- made me somewhat nostalgic for the old days here, thus took few downer rainy days to have a look at the old pre Cat-lockdowns shaders -with the help of AI. Yes, I distrust the prevalence of AI as much as the odd smelly prepper dude everyone has on the edge of his circle but being someone who couldn't calculate own age if his life depended on it, here we are.
Man I still can't write a coherent short sentence, can I? 😄

As per title, I am attaching some tweaked shaders that my stubborn pal, Chad GPT, helped me refine.

SF2 shaders tweaks.zip

Given the limitations and bit of artistic license, it's all on a "take it or leave it" basis.
Those are focused on 2 key aspects of the SF2 quality of life upgrades that interest me:


Flight:
-gunsights/HUD rendering and investigations
-in-cockpit displays rendering
-clouds, stars rendering

ThatTerrainYouLoveBombing(tm):
-terrain tiles rendering hacks

1) Gunsights/HUD shaders:
Flight\FLTGUNSIGHT.FX -the usual gunsights
Flight\FLTHUD.FX -HUD with assorted imagery as per aircraft's avionis file setup
Flight\TWCOLOR1.FX -all the one-tint alpha-based letters and digits
Flight\TWCOLOR2.FX -added as test, have not found the examples but I have not tested all the stock all-in-one aircraft, the shader uses two separate texture slots
Flight\TWCOLOR8.FX -same as with TWCOLOR2.FX, expects 8 texture slots

Those have now added user-adjustable faint shimmering and jittering to simulate older style cathode ray tube projectors onto phosphorate screen displays
Please note: Gunsights use center of screen radial mask to clip the gunsight from the view if the gunsight image moves outside of the mask area;
due to the way TK implemented things the mask is a screen space overlay, I was so far (bar one crap example I might look at again) unable to make the mask render as a quad in world space thus stay at pre-set position in cockpit, so if you have your gunsight reticle depressed for example during CCIP mode when moving your viewpoint downwards the mask which is in the center of screen will make the gunsight visible again.

2) Radar displays, TV displays, moving map display:
Those are updated to a point engine allows: 
Flight\FLTCOCKPITMAP.FX -Map displas: fully configurable tint of the map image (the style of original map image -PLANNINGMAP3.xxx being of biggest importance, default style maps look better IMO) with additional noise and scanlines where you can control scanlines intensity, size and scroll speeds, noise dimming factor etc.
Flight\TWCOLOR1.FX -Same goes for RADARS/RWR BUT the radar/RWR returns are hard coded into being green, if we were able to hack the blending mode of those we might get better results.
Same noise and jittering as with TV/MAP/HUD digits.
We CAN decopule the material shaders in avionics inis so one can use different shaders/renamed copies of for on-HUD digits etc and something else with diffferent parameters for RADAR/RWR displays, but that was not the scope of my tests.
Flight\FLTDTVFILTER.FX -similar treatment, able to adjust tint and scanlines, flickering etc, but I saw sommunity already did some interesting thigns using various BlendOp= methods, might look intriguing when paired together with this shader (ie. amber LLLTV with negative/whitepoint etc)

every shader has a part at the top around constant buffers declarations that allows one to adjust, example from FLTGUNSIGHT.FX shader:

// Mask, jitter, flicker, and noise controls
cbuffer cbScreenMask
{
    float2 g_ScreenSize;       // resolution
    float  g_ScreenRadius;     // visible radius [0..1]
    int    g_DebugMode;        // 1 = debug overlay
    float  g_FadeWidth;        // 0.02 typical
    float  g_JitterAmount;     // UV shake amplitude
    float  g_JitterFrequency;  // jitter/flicker frequency (Hz)
    float  g_BrightnessAmp;    // brightness flicker amplitude (0–0.2)
    float  g_NoiseAmp;         // random sparkle intensity (0–0.05)
    float  g_NoiseFreq;        // random noise evolution speed (Hz)
    float  _pad;
};

// Defaults
#ifndef HUD_CONST_OVERRIDES
static const float2 HUD_DEFAULT_SCREENSIZE = float2(1920.0, 1080.0);
static const float  HUD_DEFAULT_RADIUS     = 0.25;
static const float  HUD_DEFAULT_FADEWIDTH  = 0.02;
static const float  HUD_DEFAULT_JITTER     = 0.005;
static const float  HUD_DEFAULT_FREQ       = 10.0;
static const float  HUD_DEFAULT_BAMP       = 0.2;
static const float  HUD_DEFAULT_NOISEAMP   = 0.02;
static const float  HUD_DEFAULT_NOISEFREQ  = 50.0;
static const int    HUD_DEFAULT_DEBUG      = 0;
#endif
 


3) Clouds, stars:
Flight\ENVSTAR.FX -now shimmer randomly with configurable parameters in the shader, simple thing
ENVCLOUDS.FX -AKA The Frustrating One. The one that I spent the most time on and achieved the least. The shading is somewhat improved but needs tons of additional tweaking, decoupled fade distance from fog distance etc but gave up in the end. Also no baked in altitude hacks though there is provision for those (Flight\ENVCLOUDS height offset.FX) as altitude hacks still rely on CPU-provided physical position in scene, so we can not really push them down, only the vertices

4) Terrain visuals shaders that go into desired terrain folder:
TERTERRAINEFFECT.FX, 
TERFARTERRAINEFFECT.FX, 
TERWATEREFFECT2.FX

Basically updated terrain mesh shaders that do 1 thing: take the tile texture and calculate luminosity-based fake normalmap on per-tile basis and applies it on top of the noise normals we all are used to. Blending and derived normal  value are adjustable. Just for best visually matching output set the parameter to your tiles resolution:

cbuffer cbPseudoNormal
{
    float g_PseudoNormalStrength = 5.0;   // bump contrast (default ~3.0)
    float g_PseudoNormalTexRes = 512.0;     // tile texture resolution (default 256)
    float g_PseudoNormalInvert = 1;     // 0 = normal, 1 = inverted height
};

Given the nature of TK's wang tiles terrains that means the TERWATEREFFECT2.FX for land-sea and rivers tiles had to be adjusted with the same methods but also then I worked on adding more bells and whistles and looked into adding bits from the SF2NA water mesh shader (not much luck there) to the water branch of the tiles, all parameters are described in the shaders:

    // Fresnel / reflection
    float  WT_Fresnel_R0          = 0.0204;    //0.0204; // water reflectance at normal incidence (~2%)
    float  WT_ReflStrength        = 1.0;    // overall reflection strength multiplier
    float  WT_ReflDistNear        = 0.10;    //0.10;   // reflection UV distortion near
    float  WT_ReflDistFar         = 0.01;    //0.010;  // reflection UV distortion far
    float  WT_ReflDistGeomScale   = 0.05;    //0.35;   // base geom/distance reflection factor

    // Water tint
    float3 WT_WaterTint           = float3(0.08, 0.11, 0.14);
    float  WT_WaterTintAmount     = 0.55;    //0.55;   // 0 = use terrain albedo, 1 = full tint

    // Wave band blend
    float  WT_SecondWaveWeight    = SecondWaveWeightD; // default from cbConstant
    float  WT_Unused_pad0; float WT_Unused_pad1; float WT_Unused_pad2;

    // Sparkle/spec
    float  WT_SparkleStrength     = 1.0;    // 0 = off, 1 = default
    float  WT_SpecStrength        = 1.0;    //1.0;    // extra gain on specular lobe

    // --- WHITE CAPS controls ---
    float  WT_WhitecapAmount      = 0.40;   // overall foam blend amount (default used to be 0.4 in code)
    float  WT_WhitecapExponent    = 8.0;    //8.0;    // how sharp angle-to-sun is before foaming
    float  WT_WhitecapNoiseScale  = 4.0;    // frequency of noise mask (was *4.0)
    float  WT_WhitecapMaxBlend    = 0.85;    //0.85;   // safety clamp for foam mix [0..1]

    // Wave strength scaling at shores
    float  WT_WaveAlphaStrength   = 1.0;    // multiply alpha weighting on wave strength (shore calming)
    float  WT_WaveDistStrength    = 0.5;    //1.0;    // multiply distance fade impact on wave strength
    float  WT_WaveOverallGain     = 1.0;    // overall normal strength gain (pre-Fresnel)
    float  WT_Unused_pad3;

Please note there are already very good mods for ingame environment and user-tweaked water shaders, shoutout to Menrva for his work in sky/water domains! But I decided to roll this one out too so people smarter and more artistically inclined than I am can have a go at those.

I mostly tested them with the beautiful new retextured Korea MiG-Alley by Gepard+Lacsap and the extended Desert 4 by PieceMeal.

Misc test shaders I included for giggles:
extra terrain objects shaders\TERALPHAOBJECT.FX -for TOD trees that are randomly swaying juust a bit, purely visual "can be done? oh" test
extra terrain objects shaders\TERSOLIDOBJECT.FX -added derived normalmaps

Feel free to do much smarter things with those than I was able to, use as you see fit.

Cheers, 
Stary

 

Edited by Stary
  • Like 5
  • Thanks 2
Posted

@Stary fantastic stuff! I look forward to trying your shaders and make the best use out of them! I experimented a lot with shaders during the development of Operation Desert Storm 30th Anniversary Edition, but never got this far. Thank you for your works on Strike Fighters, they are much appreciated 👏🤩

By the way, some years ago someone experimented with creating PBR shaders for Strike Fighters 2, they're available on GitHub. Their implementation is rather broken here and there, but they also introduced nice results under specific light conditions, so they may be of your interest: https://github.com/Zackin5/StrikeFighters2-PbrShaders

  • Like 3
Posted
21 minutes ago, Menrva said:

@Stary fantastic stuff! I look forward to trying your shaders and make the best use out of them! I experimented a lot with shaders during the development of Operation Desert Storm 30th Anniversary Edition, but never got this far. Thank you for your works on Strike Fighters, they are much appreciated 👏🤩

By the way, some years ago someone experimented with creating PBR shaders for Strike Fighters 2, they're available on GitHub. Their implementation is rather broken here and there, but they also introduced nice results under specific light conditions, so they may be of your interest: https://github.com/Zackin5/StrikeFighters2-PbrShaders

Yeah I am familiar with that guy's test but it seems abandoned and also I personally never got them to work wihtout artifacts.

That said I am curious what you will come up with using the shaders I uploaded if you ever want to do next real sky environment mod 🙂 did some tests with alpha-based normalmaps etc but so far nothing worth mentioning but here's the shaderENVCLOUDS rework works no inis exposed.FX

  • Like 2
  • Thanks 1
Posted
3 hours ago, Stary said:

Hello gang, both old familiar faces and the newer ones.

Haven't been much around recently (if 9 years modding hiatus can be described as such...) but to be frank meeting recently  again with the very passionate Enoc "Flogger23" -and being introduced by him to intriguing dlls-related work started by Eagle114th- made me somewhat nostalgic for the old days here, thus took few downer rainy days to have a look at the old pre Cat-lockdowns shaders -with the help of AI. Yes, I distrust the prevalence of AI as much as the odd smelly prepper dude everyone has on the edge of his circle but being someone who couldn't calculate own age if his life depended on it, here we are.
Man I still can't write a coherent short sentence, can I? 😄

Happy to see you here, Tio Mek! A week back, I was still enjoying the beautiful weather of Krakow, you know I am not lying, hehehe.

 

 

  • Like 2
  • Haha 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Privacy Policy, and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..