Wednesday, May 29, 2013

Left 4 Dead 2 - 3D Vision Fix

3D Vision Fix by mike_ar69

Fixed
1. Water haloing, reflections
2. Green slime
3. Name Tags placed at depth

**UPDATE 9/27/13  Name tags apparently stopped working.  Fixed.  Download v2.

Screenshot



Video

A video is available here: L4D2 Video.

Outstanding Issues
1. Skybox and distant objects render too close, and are using some technique that means they can't be fixed.  This is not too bad actually, and has not distracted me in any way at all.
2. As a result of the above there are some of these distant objects that display a double imaging against the sky.  There are not many of these though, and I went through most levels.
3. The identifiers for textures appear to change over time, presumably when a patch or update is released.  This is one reason I decided not to invest loads of effort in fixing skybox and distant objects.  I did use texture separation for the Name Tags, and it is possible that in the future this might stop working due to the texture name changing.  If it does, ping me and I'll find the name of the new one and update it.

Update 6/1/2013 - I created the fix for 1080p resolution with all settings on maximum.  I noticed that, for some reason I do not understand, changing resolution in game makes (some of) the fixes stop working.  If anyone encounters this, let me know.  If anyone knows why this might be happening, please let me know also.

Summary
This game looks fantastic in 3D, even without the fixes the sense of atmosphere and ambiance is great.  The water fix I think does polish this game off to be somewhere between "good" and "excellent" - everything else renders great.

Installation
Extract this zip file to the games exe directory.  In my case this is D:\Steam\steamapps\common\left 4 dead 2\left4dead2.exe.

Acknowledgements and Thanks
DHR looked at L4D2 a while back and provided the first shaderoverride shaders for hud and skybox.  I used his Hud shader as a basis for my Name Tag fix.
Bo3b for advice on skybox issues.

53 comments:

  1. Some more info on the skybox and distant objects issue, for anyone that might want to have another crack at it (though DHR and myself have had a good go already):
    - Most VS and PS are Shader 2.0, so they need converting first. Some of the shaders, upon conversion, immediately crash the game to desktop with a 20Mb dump file. This occurred when I did it myself and when I used Mana84's VS2-VS3 converter. The problem always occurred when there was 12 output registers (which I think might be the maximum). The only way round this was to arbitrarily remove one of the output registers (I always picked the 'fog' variable) but this is kind of nasty and potentially unpredictable.
    - Without fail, every time a shader was modified to correct a distant object, some random unrelated object would be affected. Example, a skybox was fixed in one level - great. Then at some later point in the level, I am inside going up a staircase and I notice that the lights and shadows on the staircase are all wrong... It may be possible to separate the textures for this, but the effort and trial and error involved would enormous tracking down what caused what, because the effect is not co-located. This was the case with pretty much every single skybox like shader.
    - On one level there is a big bridge over an estuary, and you are able to get on the bridge on one side. The whole bridge appears as one structure, except that the 'distant' part of the bridge (on the other side of the estuary) is rendered too close. Fixing the shader to make it nor render close affects the whole bridge structure and makes the part of the bridge you can walk up to, touch (figuratively) and climb onto also appear now at the wrong depth i.e. way too far in depth. There is no way to make that bridge work. This scenario is also common throughout the game levels.
    - The 'rendering too close' problem is not too distracting for me if I am honest, its a fast moving game with lots going on and you just don't look at the horizon that much. The bigger issue that I tried to solve, but couldn't because I believe it is related to the same problem described above, is that some of these 'distant objects' (even if they are only a few feet away from you in game) generate an edge halo against the sky. This does look a bit crap, and is a more noticeable flaw. I will have another crack at it, but I had all the same issues of trying to fix one thing then finding some random object entirely unrelated to it being affected elsewhere in the level.

    ReplyDelete
    Replies
    1. This is dramatically improved, thanks for the effort!

      To do those fixes without affecting other things later in the game, I would recommend that you use the texture fixes. This allows you to fix a shader in general, but use the if_eq to decide whether the texture is the right one or not. Fixes only the one you care about, leaves all others alone. This is safer way to apply those fixes, to avoid side effects. Also this technique avoids you having to find all the weird one off breaks.

      Hate to be a broken record, but there should be a pretty good example of doing this in Psychonauts, where I had the same problem. Fixed the moon in camp, then the lamps would be weird in Coach's Brain. (Ignore my giant lists of textures in there, it's not necessary, I was just playing with the code to learn.) You can do surgical fixes using shader+texture combo.

      Delete
  2. thank you for all the hard work...
    all the best!

    ReplyDelete
  3. Vac cheat Ban in online mod with this ? btw thx

    ReplyDelete
    Replies
    1. With all of these helix fixes there is a possibility that the d3d9.dll will be identified as some sort of cheat, but we have not heard yet of anyone actually ever being banned. I have played a few games online with no problems, including Secret World. The helix dll is no different from any of the ''post process injectors' like ENB or sweetfx etc, and no one gets banned using those either - basically because idirectx 9 and not part of the game. No part if the game is actually modified with any if these mods.

      Delete
    2. Guild Wars 2, secret world, the old republic, tera are mmo's I tried/others with no issue.

      We leave warning up just in case but its doubtful.

      Delete
  4. Really appreciate this fix! Swamp and Hard Rain will be like first play throughs!

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. I play L4D2 exclusively in 3D (I can't aim in 2D any more). These fixes made it look perfect. BUT - it disabled my mouse movement. The buttons worked but the mouse view is stuck in one place. I use a Logitech G700 gaming mouse with the Logitech SetPoint. I upgraded SetPoint to the new Logitech Gaming Software and that didn't help.

    ReplyDelete
    Replies
    1. May have to wait for author to reply, he has a function that I am not sure if is in use [getcurdir] which relies on new dll. But I dont think this game "needs" it

      https://s3.amazonaws.com/-HeliX-/DLLS/Release.zip
      Extract into games main folder and a /BIN/ folder if game folder as well. Override existing if asked. It may not work but could go either way.

      Delete
    2. OK, back from vacation. I think eqzitara is correct, the DLL I use is not essential in that I don't think I need its advanced features, and it is known to sometimes have issues with the mouse. I will look to create a package with an older DLL and repost it, hopefully in next 12 hrs or so.

      Delete
    3. I have checked and the DLL that eqzitara linked too does work fine. I do not know, however, if it will fix your mouse problem :-(

      I used the newest dll for this game since the 'previous version' I had was a little bit older than the one eqzitara linked too and using that older one made the HUD correction not work. This game was a bit difficult to get right like that - different features of the dll worked for different aspects. Another difference is that using the latest dll I must have the SetSkipScissorRect=true statement in else it gives cut off of the torch light, but earlier DLLs don't; I could only find one DLL that would dump the correct textures to separate the hud elements; and so on.

      Delete
    4. Old ones had SetSkipScissorRect=false as default

      The mouse issue will be fixed. I dunno why but it happens with newest dll.

      Delete
    5. The older dll eqzitara pointed to works fine. I can move around now! I could even jump and spin for joy! Thanks.

      Delete
  7. Didn't tryed it yet. But fuck man, I LOVE YOU. I play this game in 3D since the first time I bought 3D vision set and couldn't play 2D again, even without the annoyance. But if they're gone now, thanks to you, I'll get a boner next time I'll play.

    ReplyDelete
    Replies
    1. Glad to hear it :-) Load up the "Swamp" levels and have a blast :-)

      The water fixes do look really good, but bear in mind I did not put much effort into fixing the 'distant objects look too close' problem, because on the whole it's a minor issue in this game, but a major league pain to fix.

      Delete
  8. Name tags stopped working like you mentioned they would :( So I'm pinging you now: PING!

    ReplyDelete
    Replies
    1. I posted an update. Worked for me (name tags also were not working for me, now they are). Let me know if it works for you.

      Delete
  9. Game wont start anymore with this fix for me?

    ReplyDelete
    Replies
    1. Just the latest update or any of them? If it does not work with any of them, have a look in he 'installation issues' link at the top of the page.

      Delete
    2. Previous version worked. I resently reinstalled the game and got your updated fix and now it doesent work anymore.
      Tried the tips in the installation issues - no luck..

      Delete
  10. Hey Mike, thanks for all your hard work! I do have an issue, though. I am trying to run this at 2560 x 1440 resolution and am having no luck. No issues at all at 1920 x 1080, but if I try to launch it at 2560 x 1440 I get the "failed to create d3d device" error. If I try switching in game, the screen just keeps flickering between my desktop and a black screen until I end the task. Any ideas?

    ReplyDelete
  11. thanks for your hard work..this made a huge improvement for me

    ReplyDelete
  12. It's much improved with this fix (using v2 now). The name tags are at depth but a constant depth. They move back and forth with you. Is there any way to get the name tags to use the depth information from the characters they represent? Just asking. I expect the answer is no and there is no way to assign different values to different tags.

    ReplyDelete
    Replies
    1. Don't think anyone has been able to work out the nameplate depths properly.
      Removing them altogether would be easy, would that improve the game play? When I played I didn't really feel like I needed them.

      Delete
    2. Its probably tied to all text.

      Delete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Hi ! is there a way to change the depth of the player's name?
    Names are placed in front of players but it will probably be better if they were on top or at the back.

    Is there a file where we can change that?

    ReplyDelete
    Replies
    1. You can change the depth, but not the x-y placement. To change the depth:
      1. in ShaderOverride/Vertex Shaders, in this file AB210035.txt...
      2. find the line "def c220, 0.8, 0, 0.0625, 0"
      3. change the "0.8" to be larger, say "0.9" for increased depth (max value = 1.0), of a lower value for less depth.
      4. Save the file

      Delete
    2. I tried and it's much better with 0.95 or 0.9 as 1.0 is too much depth.

      Delete
  15. wow ! oO

    Impossible to find by hitself lol

    Thank you for the answer. :)

    ReplyDelete
  16. Hi!
    i think the name's tags are broken again cos i did the setting of this file AB210035.txt.

    And whatever i changed the names stay at the same depth and i see it in double.

    Do you know if it's possible to fix it (or remove it)?

    ReplyDelete
    Replies
    1. Removing effects is pretty easy, so if you are motivated, you could do this.

      Delete
    2. I wish i could but i'm not very sure of what to do! lol

      :)

      Delete
    3. If you go through the School for ShaderHackers you'll be able to do this easily. Disabling effects is covered in detail.

      Delete
    4. I'll try but I'm french and when things start to be technical it's hard for me to understand english every time.

      :)

      Delete
  17. I found what was the problem.
    I was thinking first that it was caused by sweetFx (i can't use reshade cos it totaly broke the image).
    But i found that it was caused by the resolution i set.
    I use DSR to have 4K resolution on a 1920x1080 monitor.
    It give a very good result in term of quality and my graphic card can handle it easily (GTX 980Ti).
    But at the moment i change the resolution, the name are at very bad depth.
    And once i set a higher resolution, the only way to make the name be at the right place again is to set the native resolution, quit the game and reinstall sxeetFx.
    Is it possible to make the fix work to higher resolution like: 2560x1440 or 3840x2160?

    ReplyDelete
    Replies
    1. DSR should not effect it but you can always try.
      Could try gedosato. I have no idea if it does work with enb helixmod at same time but you can try.

      Or just force AA
      http://pcgamingwiki.com/wiki/Left_4_Dead_2

      Delete
  18. Red text on right top. How turn it off?

    ReplyDelete
    Replies
    1. Sounds like the debug version of HelixMod. There are non-debug versions available.

      However, try the game with no fix installed. I just tried it, and it seems like it's working pretty well with no fix installed.

      Delete
  19. Name tags stopped working. I tried to look at AB210035.txt but I have no idea what this thing works... Can anyone provide a fix or how to fix?

    ReplyDelete
    Replies
    1. Probably the shader hash number has changed on an update. If you hunt the shader in question, and compare with the AB210035, you can possibly fix this by applying that fix to the new shader.

      If you are interested, a good place to start is Bo3b's School for ShaderHackers

      Delete
  20. I think shader hash hasn't changed after all. I read that "I did use texture separation for the Name Tags, and it is possible that in the future this might stop working due to the texture name changing." - do you have any guide about how can I get the changed texture name?

    ReplyDelete
  21. If anyone is reading this:
    Did Valve change anything about the game? Because I wanted to play again in 3D and the fix seems to be working properly so far with one exception: The crosshair is in 2D and thus you can't really aim nor play because it hurts on your eyes to see this "double crosshair" all the time when you look into the depth of the picture.

    ReplyDelete
    Replies
    1. Bo3b: Just tested this again, and it seems to be working well with the latest update.

      For the crosshair, you want to enable the NVidia LaserSight with Ctrl-F12. Advanced options need to be enabled, and the LaserSight enabled in the control panel. With it set to LaserSight, I get full 3D crosshair.

      Delete
    2. Works! Thanks man. This feature wasn't needed much in the games I played in 3D so I didn't even think about it when trying L4D again. D'oh!

      Delete
  22. I can change name tag depth following the comment about AB210035.txt, it works but only works for english names - if the name contains non-english characters (i.e. displays in non-default font) those characters would be rendered at different depth (if theres any english characters in the name tag, those would be put at desired depth)

    I tried to look at the content of AB210035.txt but didn't get a clue how it works, I guess it has something to do with the if ... endif block but no idea what those condition means. Any help?

    ReplyDelete
  23. I typed everything, and after I clicked "Publish", the page reloads without my post, so now I have to type it again.

    It's been a few years so I don't know if any updates to L4D2 occur that could affect the 3D fix. Currently, player name tags and the game UI uses the same VS AB210035.

    Depths of player name tags can be pushed back by changing the "ValNotDefined" value to 0.8 (or higher to further push it back) in DX9Settings.ini file. This unfortunately pushes the 3D crosshair further back in depth, so I had to disable the Nvidia LaserScope/3D crosshair as a compromise.

    Any further advice appreciated.

    ReplyDelete
  24. Alright, I finally got some time to poke around and made name tags work for even non-english characters.

    First, you'll need to follow the comment by mike_ar69, basically you:
    1) Open ShaderOverride\VertexShaders\AB210035.txt
    2) Edit line starting with "def c220", increse the first parameter 0.8 to make the name tags appear deeper. In my case I found 0.95 works pretty well, so the edited line is now: "def c220, 0.95, 0, 0.0625, 0"

    Now, the name tags should work. If they doesn't, switch your game language to English and play in full-screen mode (not borderless mode)

    However there's one problem left. When playing online, you may encouter a player which has non-english characters in their names. You can clearly see those characters are using a different font and are not put into depth.

    I'll now tell you how I fixed it:

    1) Open DX9Settings.ini
    2) Find the line starting with "DefinedTexturesVS = B099C659;"
    3) Add "B7F5097E;" to the end of the line, so the edited line is now: "DefinedTexturesVS = B099C659;B7F5097E;"

    You can go into the game and check if it works.

    The process which I finally find the solution is kinda complicated, if you're intrested you can read this post: http://helixmod.blogspot.com/2012/03/dlls-update.html

    ReplyDelete
    Replies
    1. Today I found that non-English characters in name tags stopped working again. At first I thought it has something to do with the new update, but it turns out to be something else.

      The CRC value (of the texture used on non-English characters) isn't fixed! I've tried to run the game multiple times, got many different CRC values recorded:

      B7F5097E;52AFF3BD;94D3315F;B7BAAA0C;8E9543B;

      The first one seems to be the one I got more often, that's why I didn't catch the issue when I first write the comment, but I don't think I've caught all the possible values though... is there a better way to fix this?

      Delete
    2. You are on the right track there. It's kind of tedious to catch all of the textures, but that's how it's done. Once you've got them, they don't tend to change except for game updates like the recent Last Stand.

      Delete