Skip to content

Using 3Dmigoto to find and fix shaders

Bo3b Johnson edited this page Jan 25, 2019 · 18 revisions
This is a work in progress, and there are probably better ways to use the tool. It will also change as we figure out more and tune the tool for easier use. This is just to get started. This was only tested using Bioshock Infinite.

There are a lot of options, this is a guide using the most obvious d3dx.ini settings as found in the default download. This currently outputs the hlsl version of the shaders instead of asm version, because asm version cannot presently be reassembled.

  1. Run the game once, clean, with no patching, no overrides.
  2. Make sure the target game is already setup at preferred resolution. Changing resolutions can cause problems.
  3. Use the latest version from the Releases page here, it is already tuned for shader hunting as opposed to playing.
  4. Unzip the files into the game executable directory. (Yes, there are a lot of files, we'll work on that.)
  5. Run game with 3Dmigoto installed.
  6. With no caching it can take a couple of minutes to launch.

Check to be sure that it is working, by using the shader hunting mechanism.
  • Launches will be slow because we are not using the caching. We aren't using caching because .bin files override .txt fixes and can add confusion.
  • Default input is with keyboard. You can change to an XBox controller in the d3dx.ini file.
  • Numpad 2 steps up through active Pixel Shaders. Numpad 1 steps down.
  • Numpad 5 steps up through active Vertex Shaders. Numpad 4 steps down.
  • You should see a shader disappear, as they are skipped.
  • When you see a target shader, press Numpad 3 to mark a Pixel Shader, or Numpad 6 to mark a Vertex Shader.
  • Exit game.

Fix the marked shader
  • In the game executable directory find the d3d11_log.txt. Search in the log to find 'marked', and copy the shader hash number.
  • Find the shader in question in the ShaderCache folder. Pasting hash into the Find box is easiest.
  • Copy the version that ends with _replace.txt to the ShaderFixes folder. That version will now supersede the cache version.
  • Edit the file to fix the shader. This is where you apply your superpower.1
  • Not a fix, but for a quick disable, you can set the output location to zero in a vertex shader. Like: o2 = 0; Remember, this is HLSL not asm. Alternatively, you can add a ShaderOverride in the d3dx.ini file for the shader, and specify Handling=skip
  • Relaunch game. Your patched shader should be automatically picked up from ShaderFixes.

Some options
  • The automatic techniques are turned off by default. You might experiment with automatically adding stereo correction to all vertex shaders with fix_sv_position=1
  • If you want to enable caching to speed up launches, you can set cache_shaders=1. Be careful of the .bin, be sure to delete .bin whenever you make changes to .txt.
  • If you make syntax errors, you will get a ---------BEGIN------- block around the error.
  • The game might grab the xbox controller too, in which case shader hunting might induce shooting. Change to a second controller by setting XInputDevice=1
  • If you want to see every shader for the game instead of just the ones loaded while playing, set export_shaders=1


1 Superpowers available to all after study of how 3D works.