Thursday, January 23, 2014

Learning how to fix games

You want to fix some games, and help out. But where do you start?  It seems impossibly complex and there are so many discussions.

This is a list of bookmarks that I compiled while I went down this path.  This list is to help anybody just starting to try to understand how to fix games. This cuts through the miles and miles of text and discussion to hit most of the important pieces for learning. These are sorted in a rough order of importance, but there is some overlap.

I think I've read nearly everything posted publicly about fixes, but if I've missed something, please let me know in the comments and I'll update the list.  If you just can't work something out, you should ask for help in the main Helix thread.



NVidia whitepapers on how 3D works and underlying principles


NVidia whitepaper on how 3D works, and how they create 3D.  Really need to understand this to make any fixes. Slide 49 gives the fundamental formula for how things become 3D.

http://www.nvidia.com/content/GTC-2010/pdfs/2010_GTC2010.pdf


NVidia whitepaper on 3D Vision Automatic, with background on how the driver automatically creates 3D, and some things that can go wrong.

http://developer.download.nvidia.com/whitepapers/2010/3D_Vision_Best_Practices_Guide.pdf


NVidia whitepaper talking about the stereo unprojection problem, and how to fix it.  This is typically what goes wrong with shadows.

http://developer.download.nvidia.com/whitepapers/2011/StereoUnproject.pdf




Starting point for learning to use Helix debugger and create basic fixes


Where it all began, first link with details on how to use HelixMod. Includes details on how to use the debugger to find shaders, and how to change the keys used.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/


eqzitara's guide for how to remove broken effects. Removing effects is easier than fixing them, and is often all that is necessary.

http://helixmod.blogspot.com/2012/04/how-to-guide-remove-effects-from-game.html


Helix tutorial on how to apply a fix using the stereo texture to get separation and convergence.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3653617/#3653617


Helix's extensive update to the dlls, to add the ability to separate textures out, and thus be able to fix shaders without impacting other pieces like the HUD. Also details how to save Presets that can then be used in shaders with if statements.

http://helixmod.blogspot.it/2012/03/dlls-update.html


Mana84 tying together the details into how we are applying the NVidia formula using the code that Helix provided. Explains how the separation and convergence come from the stereo sampler as a 'trick' by the driver.

http://helixmod.blogspot.com/2012/12/darksiders-2010.html?showComment=1356789781459#c4261038469296882737



Examples of how to do some basic fixes


eqzitara tutorial on how to convert from shader model 1.1 -> 3.0, and apply the texture fix.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3653984/#3653984


Chiz1 question about getting an error in the log, and Helix's answer for how to fix it.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3654049/#3654049


eqzitara comment for how to properly kill a shader.  Can't be empty or it will crash.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3774331/#3774331


3d4dd working through a fix for Miasmata with eqzitara and DHR to fix sky and push HUD into screen. Also set up for Helix presets to allow for aiming to change depth.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3716670/#3716670


eqzitara comment on how to use Helix Lua script to autofix a lot of UDK games:

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3797899/#3797899


mana84 description of how to make something more transparent. This is a good example of how UI can be tweaked without exactly being a fix.

http://helixmod.wikispot.org/tranexplantion


Helix comment on using the profile setting feature. Doesn't work well, but might be useful.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3802642/#3802642



DirectX Tutorials to understand underlying code


Good starting tutorial for DirectX. Really starts with the basics.

http://www.directxtutorial.com/LessonList.aspx?listid=9


One of the best tutorials because it's so extensive.  Goes into shadow mapping, and projective textures.

http://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series3/starting_point.php


Excellent HLSL tutorial.  You don't get any assembly here, but this is written like a text book and is much easier to understand than most.

http://rbwhitaker.wikidot.com/hlsl-tutorials


Nice HLSL tutorial, more clearly written than a lot.

http://www.neatware.com/lbstudio/web/hlsl.html


Good refresher on transformation matrices and the math involved.  You don't really need to know the math, but reviewing this makes it easier to spot transformations.

http://glprogramming.com/red/appendixf.html


Another excellent description of the projection matrix and how the transform math works to get an image on the screen.

http://robertokoci.com/world-view-projection-matrix-unveiled/


DirectX11 Tutorial, but still applies to DX9.  Good descriptions of different lighting effects and how textures work. The LightMaps was particularly helpful.

http://www.rastertek.com/tutdx11.html
http://www.rastertek.com/dx11tut44.html


Interesting mix of HighLevelShaderLanguage and the asm versions.

http://www.fairyengine.com/articles/hlsl2sided.htm



Examples and discussions of advanced fixes


Mana84 comment for setting up the InverseMatrix feature in the ini file.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/3774904/#3774904


mike_ar69 question and Helix response about how to use surface creation mode feature, to fix some shadow maps.

http://helixmod.blogspot.com/2013/04/mars-war-logs-3d-vision-fix.html


Helix adding some details on using the new feature to add presets to autofixed shaders. This can allow automatic preset changes when menus come up or for cutscenes.

http://helixmod.blogspot.com/2013/08/castlevania-lords-of-shadow-ultimate.html?showComment=1377998341883#c5984318752489853536


mike_ar69 giving some tips on how to fix shadows by using inverse matrix, and a little later an example fix using that technique.

https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/4069271/#4069271


DarkStarSword giving us some great detail on the different coordinate spaces, and how to apply a shadow fix.

https://forums.geforce.com/default/topic/766890/3d-vision/bo3bs-school-for-shaderhackers/post/4715553/#4715553



19 comments:

  1. Nice one bo3b! I have been meaning to write something up myself for ages. I wrote about 15 pages of top tips while I was off work sick last week, but there is no real structure to it, just stream of flu-like consciousness. I'll try and get it into a form that would be more presentable but it might take a couple of weeks.

    ReplyDelete
  2. Nice, wish I could sit down and focus and help, but anyway, want to say thanks for organizing! Amazing what you guys have accomplished over the past couple of years. I appreciate it.

    ReplyDelete
  3. Thank you, bo3b, for posting this. Also, the old Helixmod site has some examples of code fixes, before & after ( http://helixmod.wikispot.org/Coding_Fixed_Issues ).

    ReplyDelete
    Replies
    1. Thanks for reminding me of that link. Unfortunately most of the links there were broken by that big forum outage. But, I do have links of almost all the examples there.

      Delete
  4. Good deal, glad it was worth doing. I'd been meaning to make a list for a long time. I'll add the Coding Fixes to the list, and also a reference to a shader tutorial for background on how shaders work.

    ReplyDelete
  5. Thats great idea. HLSL is assembler like code and many programmers from other areas (VB and C# for example) could be learn how to fix shaders in short time

    ReplyDelete
  6. I have fix Assassin Creed (skybox and UI) - how I can add my fix to the list of games ?

    ReplyDelete
    Replies
    1. Fantastic! Glad to hear it. You should contact eqzitara via PM from the nvidia forums and let him know.

      Delete
  7. Hi there! Hey I ran across this page while running down any site that might still be hosting the content that was previously on

    "http://robertokoci.com/world-view-projection-matrix-unveiled/"

    Would you happen to know where I can find this article, if anywhere at all? I'm trying to locate it as part of the suggested prerequisite reading material for

    "http://blogs.msdn.com/b/davrous/archive/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript.aspx"

    which I'm reading as an intro to Babylon.js :) If you've read it yourself, can you tell me anything about the contents? Are there any core-concepts from there I can easily learn about in some other article? I'm just not sure what I would have discovered in there, and am loathe to miss anything. Thanks!

    ReplyDelete
    Replies
    1. Hi Albert,
      Not sure what happened to that website. It's not a lot of info, but has some good matrix background, presented well.
      You can find an archive here:
      http://web.archive.org/web/20130805154321/http://robertokoci.com/world-view-projection-matrix-unveiled/

      Delete
  8. 2010_GTC2010.pdf is linked to twice in the nVidia whitepapers section - was one of those links supposed to be http://developer.download.nvidia.com/whitepapers/2010/3D_Vision_Best_Practices_Guide.pdf ?

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

    ReplyDelete
    Replies
    1. Sorry about deleting your comment, please add text for your links (we get a lot of spam).

      JPG with alternate approach using dominant eye:

      http://i66.fastpic.ru/big/2014/1020/e1/b81d722b02e515581485de59ac2a08e1.jpg

      Delete
  10. Are somebody knows how to disable compute_shader via 3D Migoto not in hunting mode. Placing it hash to [ShaderOverride1] section of d3dx.ini is not disabling it. Which of two files hash-cs_reasm.bin or hash-cs_reasm.txt overrides it? How can I get hash-cs_reasm.bin from hash-cs_reasm.txt ?

    ReplyDelete
    Replies
    1. Neither. You want to use the hash for the HLSL CS itself. The ASM is only used if you want to change the code. The .bin file is just a cached version and should be ignored. The _reasm.txt indicates you are using an old and worse version of 3Dmigoto. Use the latest.

      Disabling a CS is generally a problem, and will sometimes crash the game. Usually you disable a specific texture instead.

      Best bet for learning how to do ShaderHacking is to start with my class, if you haven't already. Shader School Then, go to the NVidia 3D forums, and there a bunch of people there that can help. Look for the giant 3Dmigoto thread, and post there.

      Delete
    2. I've used 1.2.56. In HLSL section of hash-cs_replace was many "Known bad code for instruction (needs manual fix)". So how I should get name to file for overriding CS ? Which section HLSL or ASM should I change to disabling it? Is there enough adding "discard;" at the begin of "void main(){discard;" section of HLSL and "cs_5_0" as first stirng and "ret" as second string in ASM section to disable CS. This strange shader has neither input dcl_ strings nor outputs o0,o1,etc on my opinion

      Delete
    3. Could you give url link to "giant 3Dmigoto thread" ? I've found only 3Dmigoto

      Delete
    4. All, I understood. If 3dMigoto loads bugged_by_shaderhacker shader to override it ignores rest of shaders in ShaderFixes folder - so i can't neither to disable nor to fix any vertex shader because of loading bugged compute shader - so you should fix them step-by-step or in other words one-by-one

      Delete