Wednesday, May 1, 2013

Mars War Logs - 3D Vision fix

Mars War Logs - 3D Vision fix.

- Light;
- Shadows;
- HUD;

Remaining issues:
- minor diffuse lights issue in some places.

Download this archive. Unpack downloaded archive in to the folder where game .exe file (MarsWarLogs.exe) located (example : "SteamGames\SteamApps\common\Mars War Logs").

The fix does not require changing game profile to prototype, if you did that (via nvidia inspector or rename .exe), you should restore the original profile. If you want to use the fix with prototype profile , then remove "VSscript.lua" file after installing the fix.

Y - key switches(cycle) HUD depth (3 variants).
U - key  switches (cycle) depth presets (3 variants).

Holding H key key activate low separation preset (for good aiming from the gun)

If you want to save your custom convergence settings press "U" and select required preset, set custom separation/depth settings , then press F7 and your settings will be saved in the config file. You can set custom settings for both presets and for gun preset as well (when holding H key , set custom separation/depth  settings and press F7. Release  H key).


  1. Hello, thanks for this but when I use the DLL in the zip package, I have a big black diagonal line through the screen, even if I switch off 3D vision. If I remove d3d9.dll, everything goes back to normal.

  2. Wow. Awesome fix, thanks.
    I have a request though, because I was going to look at this myself and realized I never stood a chance in hell when I saw your own fix... I was doing the usual 'step through shaders, disable, find one that causes problems' etc. I have advanced to searching through the dumpall folder as well to search the headers for things. But your fix does not have any pixel shaders in the ShaderOverride folder, whereas the DX9Settings.ini file does. So my request is: *when you have time* could you write down how to use your new DLL and what it does? I am keen to learn how to do this stuff, and have managed one game so far. Thanks again.

    1. it uses script for fix shaders automatically.
      This game loads shaders for each level , so better way to fix them on the fly.
      You can fix the shaders manually as well, but for this i think you should to play through whole game.

    2. OK thanks, that's what I thought actually (Eqzitara I sent you a quick PM on this). So I need to learn LUA and create PScript.lua and VSScript.lua files. I looked through them and saw where you created the stereo offset code, I'll look at that to work out what you did.
      Could you please give a short description of these bits at some point, I've seen them before but aside from vaguely recognizing the words from my DX9 studies, I don't know what they are or when to use them:
      DefSquareSurfaceMode = 2
      DefDepthStencilSurfaceMode = 2
      //SkipSetScissorRect = true
      SurfaceCreationModeList = 0;

      DefMode = 1
      ExceptSquare = true
      Usage = 2

    3. This is surface creation mode.
      0 - default(profile settings);
      1 - force stereo;
      2 - force mono;

      DefSquareSurfaceMode = 2 - force all square surfaces to be mono(shadows maps).
      DefDepthStencilSurfaceMode = 2 - force depth surfaces to be mono (depth buffer).

      SurfaceCreationModeList = 0; - list of the other surfaces, for individual settings.

      non square surface with creation format 75 and usage 2 (depth surface) will be forced to stereo (player dummy in inventory menu surface).
      DefMode = 1
      ExceptSquare = true
      Usage = 2

    4. I know I am a pain just want to make sure I got it right because I thought I wouldnt understand it all but it makes a bit of sense to me. Like this will let you turn stereo objects to 2D. Like in Tomb Raider Underworld, 3D vision will stereolize the tv's/screens. When they should be 2D. So Id want to..
      DefMode = 2
      ExceptSquare = false
      Usage = 2

      And I am guessing I use new dll's F12 to find format?

    5. Aha
      GetCurDirAtLoad = true
      Thats the function you need for Telltale games like the walking dead. I am actually trying to fix the hud in poker night 2.

    6. All created render targets showed in the LOG.txt.
      example: D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 777 Width 911 Usage 1 Format 21 Pool 0 Levels 1 texptr 0 nIndex 0, Mode 0

      "Usage" also variable value and can be 1(render target) or 2(depth buffer), also you can bind to exact Width/Height of the surface.

    7. Ill give it a shot, you never know I guess.

      By the way your script works well with that game I was talking about before Zeno Clash 2. Just need to stop only a few shaders from injecting. Ill write it up in a couple of days as by you/me. I wrote a post about it but it seems to work on any UDK game[Not UE3], I still need to check alot of my old UE3 games. I tested it before debugger was available and forgot to check.

    8. I ran into something new in Zeno Clash 2, I cant quite figure it out. I have everything fixed besides these shaders as far as I know. I only ask because you did Xcom on same version and maybe you can tell. I know its hard since you cant try it out but I figured i'd just mention it in case. If you have time if you look at the shaders. I am including the vertex and its attached pixelshader

    9. How does it look like ?

      Did you try smth like this ?
      def c3, 0, 2, -0.5, -50
      def c4, 0.00100000005, 2, -1, -0
      def c5, 0.0133333337, 0.00066666666, 0.0500000007, 4
      def c6, 2, 1, -99, 0.00999999978
      def c7, 4, 1, 0, 0
      def c200, 0.0, 0.0, 0.0625, 0
      dcl_texcoord4 v0
      dcl_texcoord5 v2
      dcl_2d s0
      dcl_2d s1
      dcl_2d s2
      dcl_2d s3
      dcl_2d s4
      dcl_2d s5
      dcl_2d s13
      mul, c9.xyww, v2.y
      mad, c8.xyww, v2.x, r0
      mad, c10.xyww, v2.z, r0
      mad, c11.xyww, v2.w, r0

      texldl r11, c200.z, s13
      add r11.y, r0.z, -r11.y
      mul r11.x, r11.x, r11.y
      add r0.x, r0.x, -r11.x or maybe add r0.x, r0.x, r11.x , depends on what you see

    10. Ugh, I tried both before and after the viewprojection matrix. I must of miskeyed or forgot to write s14 or something though. Thanks it works. Will write helix fixed remaining issues.

    11. Err.. it works in both of those but not 7A84A7C8
      Its not a big deal if you cant tell at a glance. The other two were the huge ones. I actually think I had this issue in Singularity so water should now be fixed = ) which was my huge issue.

    12. I figured it out nm.

      Dedicated the day to learning pixelshaders and have been having good success. Not sure why you can fix it with Y's information though tbh. But I can tell X tell when I need to since X doesnt any matrix information.

  3. Fantastic, thanks! I can see this being extremely useful in some games where nvidias heuristics screw it up (like they did in Overlord 2). Many thanks again.

  4. Updated (same link)!
    Fixed fire heat effect.

  5. @Helix. I have a quick question about the DX9Settings.ini for this game fix. There are some PixelShaders in the DX9Settings.ini that look like this:

    UseMatrix = true
    MatrixReg = 100
    InverseMatrix = true
    DoubleInverseMatrix = true

    These PixelShaders do not have matrices in them, which is why I guess they don't have a 'getmatrixfromreg' entry. In the pixel shaders (from looking in the LOG.txt) I see that you are doing the trick of forward transforming from World to Proj, Stereo Shift, then transform back to World from Proj, and you are doing this using matrices 100-103 to get from W-->P and 104-107 to get from P-->W. So I am guessing, of course, that the matrix is the VPM. Is this the case and does it work with other games, or just this one? I tried it in Crysis in a shadows PixelShader and all that happens is the shadows disappear (it's like the shader gets disabled).

    1. You can get matrix from other shaders, but only with one condition.
      Shader from which you're trying to get matrix should be called every frame and before the shader where you're using it.

    2. Hi Helix, thanks for this information. So I am clear, lets say I have a vertex shader that I (could) use to pass a texcoord to a PixelShder, and that vertex shader has a VPM in c0. I can do the matrix definition thing for the vs to set c100=c0, and use inverse and double inverse. Then I can use c100-c107 in the Pixelshader? Are there other ways to know what shaders get called before others (e.g. is this in the LOG.txt file?). Thanks again,