Tuesday, October 15, 2013

Divinity Dragon Commander: 3D Vision Fix

3D Vision Fix by mike_ar69

** Update 10/15/2013: Updated the installer.

Fixed
- 2D Shadows
- Lights (specular and diffuse)
- Skybox and sunlight
- 2D Fog
- Water reflections

Adds:
- Dynamic cross-hair
- Presets:
-- "L" toggles between two convergence settings (2 and 140) useful for the ship scenes, flying around etc
-- "J" toggles to a high convergence setting for real time battle overhead view
-- "K" toggles dynamic crosshair on and off

Notes:
- Cross-hair: this is dynamic but also a bit 'empirical' since the depth map I used was not a 'scene depth map' and did not change depth when moving about over the maps. It works well for the two "L" key convergence presets, but not for the high convergence "J" preset. I could fix this but in this particular view the reticule is just not that useful.

- HUD: I made no changes to the HUD specifically, since I was unable to separate textures from the crosshair, hence I provide the ability to toggle the crosshair off "K". I do also use a bounding box around the cross hair so any anomalies are minimal.

Known Issues:
- I noticed late in the day that the Skirmish map "Golem Caves" has some lighting issue - as you fly towards the robot statue things they suddenly become a uniform yellow kind of colour.  This may also happen in other levels, but I did not see it.  I know where to look to solve this and will do so in time.  Please put a comment in the blog if you see anything else.

Acknowledgements
Thanks to eqzitara for (a) identifying the original installation issue (b) spending significant time subsequently to help me test the installation solution.
Thanks to PirateguyBrush for feedback on the installation, leading to the updated installer.
 
Summary
Real Time Strategy meets Dragons.  I've not yet played it that much, but it does look nice and runs relatively well, though on Ultra settings it gives my 2x GTX 570 SLI a beating down to about 40 FPS.  I did notice that the SLI did not work in 2D mode, though both cards were definitely working in 3D mode.  When I manualy added the game to the Control Panel 3D Settings tab to make some adjustments to AA and AF I noticed an improved performance in game.

Screenshots







BEFORE
AFTER


Installation
Installation of this fix is a bit more involved than normal, since the game generates shaders with different crc's depending on where the game is installed.  So I provide an "installer" to build the correct shaders and DX9Settings file on the fly.  I have tested this and it has worked on several test installations, but the script is pretty basic with no error handling (at this point) - please ping me if you have problems.

I provide three batch scripts to make this relatively easy.  The installation is in two steps:
1. Run the game once in debug mode to generate your version of the games shader dump.
2. Run main install script to generate your fixed shaders.  When you start the game next it will be in release mode and should be fixed.

Steps:

1. Extract this zip file to the games exe directory.  In my case this is D:\Steam\steamapps\common\Divinity Dragon Commader\Shipping.
2. This will install into a subdirectory called "HelixModInstall_DDC_V3", so rename that to "HelixModInstall".

3. In the directory HelixModInstall open up the following 3 files in notepad or whatever you use:
- CopyDebugFiles.bat
- RemoveDebugFiles.bat
- DDC_3DFix.ini
4. You will see that these all reference files and directories in a Steam directory that has been installed on drive D:\Steam\SteamApps...etc.
5. EDIT AND CHANGE all these links to point to wherever your installation is.  Then SAVE all three.
6. If your installation is the same as this default, then leave them as is.

7. Go back into the HelixModInstall subdirectory and double click the batch file "CopyDebugFiles.bat"
8. This will copy a debug dll and a basic DX9Settings.ini file to the games exe directory.
9. Start the game.  You should see red text at the top (that's the debugger dll).  Select Single Player -> Skirmish, and pick the first map in the list.  Start the map.  Have a look at how bad things are: sky, fog, shadows, water reflections, 2D cross hair.
10. Quit out of the game.  Check that a subdirectory called "dumps" has been created.
11. Go back into the HelixModInstall subdirectory and double click the "Remove DebugFiles.bat" batch file, to remove the temporary debug files.

12. Now the main fix: double click the file "ShaderReplaceV2.vbs".  Wait about 10s until a file called "DDC_3DFix_LOG.txt" appears and a dialog box pops up.  This file will summarise the shaders that were updated by showing the mapping from my CRCs to your CRCs.
13. If there were no errors, you should be able to start the game.

If you have errors, post a note in the blog comments below, I have watch on this game and will pick it up quickly.

15 comments:

  1. Thanks for keeping 3D vision alive !!!!!!!!!!!!!

    ReplyDelete
  2. Thanks for your hard work on this - looks great in 3D! FYI, I had to rename the folder to HelixModInstall for it to work according to your instructions but otherwise no problems.

    ReplyDelete
    Replies
    1. Thanks for the feedback, especially about the directory naming... Bad QA on my part, I'll update the instructions. I'm quite relieved the installer works, it was almost as complicated as the fix itself lol ;-) The game really does look nice in 3D, I've been playing on a projector with 100" screen and it's great flying round ad the dragon. I am completely crap at strategy games though, so not sure how far I will get with it - I am playing Divinity 2 with my other 3D fix, and that's keeping me busy :-) Have fun with it an don't hesitate to report any graphical anomalies, as I am sure there a few lurking in there.

      Delete
  3. I can't get it to work on my PC. on last step I get runtime error. and 3d is still completely borked. HELP. atm the game is unplayable in 3d!

    ReplyDelete
    Replies
    1. Hi thanks for the feedback. What is the exact run time error you get? I also realize I did not update the instructions, the directory that files get unpacked too needs renaming to helixmodinstall. Where is your steam directory located? If need be send me your entire dumps/all shaders folder and I will create your files for you, but will be best if we can understand (and then me fix) the install error. Mike

      Delete
    2. Also can you paste here the ini file? Ta

      Delete
  4. Hi there,

    I followed the procedure you mentioned and I could run both the patch and the game afterwards. Nevertheless I still have a major problem : the shadows are very different for the two eyes, making a 3D game experience very annoying, as if the patch did not fix anything, or much. It is not at all what I can see on your screenshot.

    Any clue of what I could possibly be doing wrong ?

    thanks, and thank you for your great work for 3Dvision.

    ReplyDelete
    Replies
    1. Hi - thanks for the feedback. I've not looked at this game for a while now, but I know Larian have made a few updates so the shader CRCs may have changed. Can you just confirm:
      (a) is it only the shadows, or is it everything (all the haloing etc). If its everything, then the install did not work. If its just shadows, it will be changes in shader CRCs (this keeps happening with Divinity Original Sin, which uses the same game engine)
      (b) did you change the folder name to "HelixModInstall"?
      (c) can you paste in here the contents of the "DDC_3DFix_LOG.txt" file?
      Thanks,
      Mike

      Delete
    2. Hello,

      thanks for the answer !

      To your questions :

      a) I am not sure. It seems to me that it is mainly the shadows but I am not sure to understand what "haloing" means. I tried the V2 and V3 version of the patch : no difference.
      b) yes
      c) at the end of this message
      d) I have an quite ageing video card (Nvidia GeForce 550 TI). Could it be that it does not support some of the changes ?

      copy of DDC_3DFix_LOG.txt : This has more than 4096 caracters. Here is the beginning

      READ DIRECTORY INI FILE
      =======================
      Game exe dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\
      Game Shader VS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\Dumps\AllShaders\VertexShader
      Game Shader PS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\Dumps\AllShaders\PixelShader
      Helix Fix VS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\ShaderOverride\VertexShaders
      Helix Fix PS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\ShaderOverride\PixelShaders
      Helix Fix Ini Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\INI
      Helix Fix Ini VS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\INI\VS
      Helix Fix Ini PS Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\INI\PS
      Game Ini folder = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping
      Helix DLL Folder = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\RELEASE
      VPM SHaders Dir = D:\jeux\Steam games\steamApps\common\Divinity Dragon Commander\Shipping\HelixModInstall\VPMShaders

      PROCESS VERTEX SHADERS
      ======================
      VS 0AF6CDDC 0AF6CDDC
      VS 7CD3CF1F 7CD3CF1F

      PROCESS PIXEL SHADERS
      =====================

      Delete
    3. PROCESS VPM SHADERS
      ========================
      VS 010A1CCB 010A1CCB
      VS 04E6C138 04E6C138
      VS 069E1AD3 069E1AD3
      VS 074F74A6 074F74A6
      VS 08F4BC6A 08F4BC6A
      VS 14A1C741 14A1C741
      VS 20D9826A 20D9826A
      VS 30FF3AE1 30FF3AE1
      VS 31A7DD3E 31A7DD3E
      VS 39D03C0C 39D03C0C
      VS 3BEF5B3C 3BEF5B3C
      VS 3D0C623A 3D0C623A
      VS 44EFE500 44EFE500
      VS 4DC54F3A 4DC54F3A
      VS 55E4CA44 55E4CA44
      VS 6E06D306 6E06D306
      VS 7A6521CF 7A6521CF
      VS 7AF7D8A9 7AF7D8A9
      VS 8F705F5A 8F705F5A
      VS 8F78188A 8F78188A
      VS 8F88952A 8F88952A
      VS 9A0E00C8 9A0E00C8
      VS 9DA1639E 9DA1639E
      VS 9F1EF8AB 9F1EF8AB
      VS 9F3B59BE 9F3B59BE

      PROCESS DX9SETTINGS FILE
      ========================
      PS 10A9EF2D 9F3B59BE
      PS 157961E2 9F3B59BE
      PS ADCCFCA7 9F3B59BE
      PS 299DDDF4 9F3B59BE
      PS 333CEBE9 9F3B59BE
      VS 7CD3CF1F 7CD3CF1F
      VS 00EF3241 00EF3241
      VS 010A1CCB 010A1CCB
      VS 01A5BFC8 01A5BFC8
      VS 04E6C138 04E6C138
      VS 05BE72D6 05BE72D6
      VS 069E1AD3 069E1AD3
      VS 074F74A6 074F74A6
      VS 08F4BC6A 08F4BC6A
      VS 09914D8F 09914D8F
      VS 0AF6CDDC 0AF6CDDC
      VS 0D163DCB 0D163DCB
      VS 0E6FC7A0 0E6FC7A0
      VS 127FE16C 127FE16C
      VS 12841951 12841951
      VS 14A1C741 14A1C741

      .... and this is quite long until ...

      VS F4F0E4B3 F4F0E4B3
      VS F6F21563 F4F0E4B3
      VS F9C559A3 F4F0E4B3
      VS FC08327A FC08327A
      VS FC3F719A FC3F719A
      VS FC9B4736 FC9B4736
      VS FF10841C FF10841C

      COPY DLL
      ========
      DONE

      Delete
  5. Thank you sooo much. I can't begin to tell you how much I appreciate all the work you guys put into this. I really wanted to play this game but just can't play games in 2d anymore.

    ReplyDelete
  6. Does not work, get runtime error when executing "ShaderReplaceV2.vbs", says file already exists. line 107, char 1, error 800A003A. Also there is no subdirectory called HelixModInstall in Shipping folder when you extract zip to it. Had to create myself.

    ReplyDelete
  7. See instructions step 2.
    Delete all earlier installations especially the shaderoverride folder, thats where the error message comes from.

    ReplyDelete
    Replies
    1. "This will install into a subdirectory called "HelixModInstall_DDC_V3", so rename that to "HelixModInstall"."

      I extracted the zip file into the Shipping folder. The zip file itself is named HelixModInstall_DDCV3, and there is no folder inside the zip with that name, so I'm not sure what exactly I'm renaming, so I created a folder inside the shipping folder called "HelixModInstall" and unzipped into that folder(since you say it install into that folder), then proceeded with all steps. This instruction confuses me, sorry. Can you explain a little better?

      Delete
    2. Okay, I got it to work, but Step 1 & 2 are confusing and incorrect in my case. Also there is an extra step that needed to be done for me. I'll update the instructions to reflect what I did in case anyone having my issue needs it. Every other step past 1 and 2 work perfect.

      1. Create a folder in the Shipping directory (where your game exe is located). Name it "HelixModInstall" In my case the location is D:\Steam\steamapps\common\Divinity Dragon Commader\Shipping.
      2. Extract the "d3d9.dll" and "DX9Settings.ini" files from the zip into the Shipping folder where you game's .exe is located.
      2.5. Extract the rest of the zip file into the HelixModInstall folder than you created.

      3. In the directory HelixModInstall that you created open up the following 3 files in notepad or whatever you use:
      - CopyDebugFiles.bat
      - RemoveDebugFiles.bat
      - DDC_3DFix.ini
      4. You will see that these all reference files and directories in a Steam directory that has been installed on drive D:\Steam\SteamApps...etc.
      5. EDIT AND CHANGE all these links to point to wherever your installation is. Then SAVE all three.
      6. If your installation is the same as this default, then leave them as is.

      7. Go back into the HelixModInstall subdirectory and double click the batch file "CopyDebugFiles.bat"
      8. This will copy a debug dll and a basic DX9Settings.ini file to the games exe directory.
      9. Start the game. You should see red text at the top (that's the debugger dll). Select Single Player -> Skirmish, and pick the first map in the list. Start the map. Have a look at how bad things are: sky, fog, shadows, water reflections, 2D cross hair.
      10. Quit out of the game. Check that a subdirectory called "dumps" has been created.
      11. Go back into the HelixModInstall subdirectory and double click the "Remove DebugFiles.bat" batch file, to remove the temporary debug files.

      12. Now the main fix: double click the file "ShaderReplaceV2.vbs". Wait about 10s until a file called "DDC_3DFix_LOG.txt" appears and a dialog box pops up. This file will summarise the shaders that were updated by showing the mapping from my CRCs to your CRCs.
      13. If there were no errors, you should be able to start the game.

      Thanks for this fantastic mod, I'll enjoy this. :)

      Delete