[Linux] Alien vision shader is broken (patch included)

rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
tl;dr — patch is here

It seems that HLSL is translated to GLSL which uses the "mix" function instead of "lerp" (it does the same, interpolates between two values) but it doesn't automatically cast the parameters hence in the original shader it receives float4, float, float and it results in this vague message:
[ 45.275] Worker 10: Error: Compilation errors in shaders/DarkVision.hlsl
0(97): error C1115: unable to find compatible overloaded function "mix(vec4, float, vec4)"

Yes, GLSL sometimes thinks that float is a vector, it's not very clever. Help him by casting to the proper type then. Alien vision shaders aren't hash-checked so this hotfix might be applied right now by the user.

BTW, if you insert a colon with spaces around it in the forum message (like this : ), you'll get an annoying "smiles" popup everywhere AFTER that colon that won't go away. Please, fix it (I had to slightly edit the log message by sticking the colons to the text).

Comments

  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited May 2016
    Thanks for reporting this and even contributing a patch.

    For code use
    [code] [ /code]<--without the space
    
    ;)
  • rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
    I tried this before posting to pastebin and it looks really ugly and loses some data as well:
    --- ns2/shaders/DarkVision.hlsl 2016-05-20 19:12:27.591588650 +0300
    +++ ns2/shaders/DarkVision.hlsl.fixed   2016-05-20 19:10:41.548793508 +0300
    @@ -96,6 +96,6 @@
         else // world geometry
         {
             float edge = abs(depth5 - depth1.r );
    -        return lerp(inputPixel, edge, 0.01);
    +        return lerp(inputPixel, (float4) edge, 0.01);
         }
     }
    \ No newline at end of file
    
  • rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
    Well, not that ugly now but when I tried it all was light gray on white, barely visible. And several lines of the patch header were eaten just like they are now.
  • remiremi remedy [blu.knight] Join Date: 2003-11-18 Member: 23112Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester
    Thanks. We can't hotfix this without breaking AV workshop mods unfortunately, but the fix will be in the next patch (and in the meantime, that file can be changed manually since it is skipped by the consistency checks).
  • rkfgrkfg Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
    No problem. Though NS2+'s alien vision alternatives are also broken when this shader fails. I suspect any AV mod would also be broken on Linux without the fix.
Sign In or Register to comment.