Sunday, March 15, 2020

Black Mesa (2020)







3D Vision fix for Black Mesa, the 2020 release. Tested with the March 2020 version, the first complete release.
Special thanks to bo3b for helping me test the fix in the early phases, and teaching me how to make a Lua script and convert shaders to Shader Model 3 properly.


Fixed
- Shadows and dynamic shadows.
- Lighting.
- Haloing problems.
- Completely stereoized water reflections and refraction.
- All kinds of fog, smoke and fire.
- Sun position.
- Light shafts.
- Fixed distant geometry that was too close to the camera. There are some exceptions due to conflicts with other effects. Multiplayer maps are fixed too. Check the known issues section.
- Stereoized specular reflections for a more realistic look. Use the "8" key to disable this.
- HUD and lens flares at depth (3 presets).


Known issues
- Sometimes (rarely, but enough times for me after heavy testing), when loading a save graphics will be broken, looking like there are transparency issues. Reload the save again or a few times and the problem will disappear.
- Some distant geometry is still close to the camera. This is because that same shader is used for other things. Important example: "DF97175D.txt.ps" in "shaderoverride\vertexshaders". If you uncomment the "//mad r11.x, r10.x, r10.w, r11.x" line, a big texture of a mountain you descend in chapter 12 will be perfect, but it will break some fire attacks of the final boss in chapter 18.
- There is one type of lens flares that scale badly with convergence. It's the same shader (VS and PS) as the HUD and some grass, so I can't modify it without breaking something else.
- The stereoization of specular reflections stops receiving camera position information (it's essential) when there are no dynamic lights in the scene. This doesn't happen too much. Only in some parts of some missions with too simple graphics. Workaround: turning on your flashlight.


Installation
- Open the "Black Mesa" profile (or make a new one for "bms.exe" if it doesn't exist) with Nvidia Profile Inspector and set "StereoProfile" to "Yes" and "StereoTextureEnable" to "0x00000027" as shown in this image.



- Download this file and extract its contents in the "Black Mesa" folder, where "bms.exe" is.
- Run the game.
- Preferably set "Dynamic lights quality" to "High" or higher. Maximum settings is what I tested the most.


Hotkeys (not the numpad)
- 7: distant geometry fix toggle. Fix enabled by default. IMPORTANT: this toggle exists because if your "Dynamic lights quality" setting is lower than "High", the geometry fix will break the graphics pretty badly (maybe not in Xen levels).
- 8: realistic specular reflections stereoization toggle. By default they are stereoized, which is what I recommend.
- 9: HUD and lens flares depth presets (0%, 94%, 100%). 94% by default.
- 0: three convergence presets. You can save the value of your current preset by pressing F7 (in this game that's the quick load key, so I recommend pausing before saving the preset).


Notes
- I have tested multiple resolutions and a lot of graphics settings in multiple maps. Apparently everything is fixed, but I can't ensure that stereoized specular reflections will always be there with graphics lower than High.
- If you set graphics so low that you never get dynamic lights, then specular reflections will never be stereoized.
- HUD and lens flares share the same shader pair, so if you enable the lens flares option, I recommend using the 94% or 100% HUD depth presets.


Dynamic crosshair (the Nvidia one)
- Open the game profile with Nvidia Profile Inspector.
- Depending on your NPI version, search the "Rhwscr" option or  "0x70A4995C" (after pressing the "Show unknown settings from Nvidia predefined profiles").
- Set it to the existing "0x3E19999A (TitanFall)" option.
- Save the changes.
- Open the game, open the console and write this command (so you don't see two crosshairs) without the quotes: "hud_crosshair_enable 0"
- Press ctrl+F12 or whatever is your Nvidia crosshair hotkey if you changed it.


If you liked the fix and want to contribute for more future fixes, you can donate to this PayPal account: masterotakusuko@gmail.com

23 comments:

  1. Some distant geometry is still close to the camera. This is because that same shader is used for other things. Important example: "DF97175D.txt.ps" in "shaderoverride\vertexshaders". If you uncomment the "//mad r11.x, r10.x, r10.w, r11.x" line, a big texture of a mountain you descend in chapter 12 will be perfect, but it will break some fire attacks of the final boss in chapter 18

    - When I made fix for the Half Life 2 I had the same problem but I used texture filtering for that. You can add to DX9Settings.ini something like this and fix will be execute only for mentioned texture hashes:
    [VS67AEE090]
    CheckTexCRC = true
    DefinedTexturesVS = 5D29A985;708C8A2F;74D491CF;7C27571A;7E99EAAB;8161EFE5;96D74394;A6046D1F;AD2EE6FD;C437ADE2;C50B0D92;D5A974E6;E1716BB9;EFF3A87B;D3E93987;

    ReplyDelete
    Replies
    1. When I enable texture hunting with "bCalcTexCRCatStart = true", the game crashes right when it tries to start. That's why I couldn't do anything related to textures in this fix, like separating lens flares from the HUD.

      Delete
  2. Thanks for the fix. Any possibility to launch the game in 1080p (chekerboard mode) on 3D TV without 3D migoto fix ?

    ReplyDelete
    Replies
    1. This is a DX9 game, so HelixMod instead of 3Dmigoto.

      If you setup your 3D Vision to checkerboard, I would expect this to work.

      Delete
    2. Sorry but i can not understand how. 3DMigoto allows to choose Top and Bottom mode for my passive 3D TV. There is no such thing in this fix.

      Delete
    3. Right, HelixMod/DX9 does not support the SBS shader used for T&B or SBS modes. Only 3Dmigoto/DX11 supports that. This is a DX9 game.

      If you can use checkerboard, you can typically set that directly in the 3D Vision control panel. Might require an EDID mod for the TV, I'm not sure. But I know the control panel had a direct UI for checkerboard.

      Delete
  3. Oh man...don't know when I'm gonna play it, but thanks a lot for this masterotaku!!!

    ReplyDelete
  4. Anybody have an SLI profile for this game? There was one for the older SDK version but it no longer seems to work.

    ReplyDelete
    Replies
    1. Skip the SLI profile unless you need something outrageous. The game runs super well and is well optimized. 120fps at 1440p with everything maxed including water and god rays- uses roughly half a 1080ti.

      Delete
    2. That is until you reach the Xen levels, which have a lot more effects and more complex graphics. With a 2080Ti and playing at 1440p in 3D with max settings (advanced ones included), I could barely hold 60fps in some parts, and over 70% GPU usage in many parts. I think I got some fps drops at some points (not counting CPU limitations).

      By reducing settings you can get a lot of performance back, though.

      Delete
  5. Thank you very much! Greetings from Austria

    ReplyDelete
  6. thank alot master! it such a blessing to have you on this planet.

    ReplyDelete
  7. Much thanks Master Otaku. You are the Master of the 3D Universe!

    ReplyDelete
  8. Perhaps the BEST demonstration of why 3D is awesome is when you are on the mountainside and the jets scream over your head and bomb the facility miles away.

    Thank you for getting the fix together in short order!

    ReplyDelete
  9. Hi guys. Anyone have any idea if Reshade 4.6.1 will work with this? I can get Reshade to work ok (it has to install into the Black Mesa Bin file). I cannot add the 3d vision fix into this once Reshade is working ... Any thoughts? Thanks for the fix, its awesome. Thanks for all you guys do in general. G.

    ReplyDelete
  10. Can someone explain why this game has so many freezes, followed by severe stuttering. Usually happens every 3 minutes or so. It is horribly annoying. It happens even when you are in the menu, also.

    ReplyDelete
    Replies
    1. Must be something specific to your machine. I've played all the way through and did not see any freezes or stuttering. Start by doing a DDU clean reinstall of your driver.

      Delete
    2. I'm running EVGA GTX 1070 on a Core i7 system built 11 yrs ago. I checked around various boards and my problem is not uncommon. Also, it happens whether or not 3D is on or off. I can play the game but need lots of patience. 3D is gorgeous in this one - all these years later.

      Delete
  11. Good morning,
    Great fix masterotaku. I find the games you choose to fix and the fixes themselves exceptional. Could you or someone else please explain how to uncomment the //mad r11.x, r10.x, r10.w, r11.x line in DF97175D.txt.ps? I ve tried removing the // in the beginning of the line and a couple of other stuff but without success apparently. Thanks in advance.

    ReplyDelete
  12. Hey many thanks for this great fix!
    Is it possible to get dynamic crosshair (circle) for shotgun working? Did I miss something in options or when installing the fix?

    ReplyDelete
    Replies
    1. Edit: I installed the fix with 3DFM what somehow lead to that behavior (ingame crosshair dynamic and working but shotgun circle static at wrong depth). I reinstalled driver and fix manually and now it's working as it should (ingame crosshair static at correct depth or dynamic Nvidia crosshair).
      Thanks again to the masterotaku for his support!

      Delete