How to fix/disable shaders in games(DLL,guide and fixes).
154 / 167
[quote="4everAwake"]It's still very incomplete and disorganized, but here's what I have so far: https://www.dropbox.com/s/fuk03wk4si3dyyv/dx9settings%20NOTES%201.rtf[/quote] Great start! If you can, please make a new HelixMod page with this information. The reason to have you create the page is so that you will be able to edit it and add new info as you find out about it. (I'll be able to edit as well.)
I think a great structure would be to make a table form, with versions on the horizontal, and features/commands on the vertical. Since it's HTML markup, a table should be doable, but might take some fiddling.
Let's use TsaebehT's date format since we don't have version numbers.
[code]
Faked up example:
120305 130305 130731 ...
[General]
GameProfile=Aion X OK
InitMouse=False OK X
...
[/code]
OK or Check or something for where it's known to work, X for tested but known to fail, blank if unknown.
The 'title' for each feature can be a link to the same page for a description of the feature.
If you don't have time to do all that, no worries, but having this all in one spot would be super helpful.
The goal of this documentation would be to make it more clear which versions work, and do what, and avoid wasting so much time trying all these random dlls.
Great start! If you can, please make a new HelixMod page with this information. The reason to have you create the page is so that you will be able to edit it and add new info as you find out about it. (I'll be able to edit as well.)
I think a great structure would be to make a table form, with versions on the horizontal, and features/commands on the vertical. Since it's HTML markup, a table should be doable, but might take some fiddling.
Let's use TsaebehT's date format since we don't have version numbers.
Faked up example:
120305 130305 130731 ...
[General]
GameProfile=Aion X OK
InitMouse=False OK X
...
OK or Check or something for where it's known to work, X for tested but known to fail, blank if unknown.
The 'title' for each feature can be a link to the same page for a description of the feature.
If you don't have time to do all that, no worries, but having this all in one spot would be super helpful.
The goal of this documentation would be to make it more clear which versions work, and do what, and avoid wasting so much time trying all these random dlls.
Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607 Latest 3Dmigoto Release Bo3b's School for ShaderHackers
Where can I start to learn how to fix shaders? Any basic tutorials or will I need to read over the whole thread to learn it?
I've discovered the microsoft official centre with some info about HLSL. Now if I dabble into it, will it work for dx11 too? I also see different shader models, I hope the latest one covers everything from before.
@bo3b can you post some before - after text files of various shaders? Like first example could be a vertex shader that needs only 1 thing changed with explanation why. Then more and more lines. I feel that looking at examples is a pretty efficient way to learn.
Where can I start to learn how to fix shaders? Any basic tutorials or will I need to read over the whole thread to learn it?
I've discovered the microsoft official centre with some info about HLSL. Now if I dabble into it, will it work for dx11 too? I also see different shader models, I hope the latest one covers everything from before.
@bo3b can you post some before - after text files of various shaders? Like first example could be a vertex shader that needs only 1 thing changed with explanation why. Then more and more lines. I feel that looking at examples is a pretty efficient way to learn.
[quote="badhomaks1"]Where can I start to learn how to fix shaders? Any basic tutorials or will I need to read over the whole thread to learn it?[/quote]
I don't have any experience with the dx11 wrapper (3dmigoto) yet. But check out this site for more info: https://github.com/bo3b/3Dmigoto/wiki/Using-3Dmigoto-to-find-and-fix-shaders
Bo3b may be preparing a more concise explanation of the wrapper.
[quote]I've discovered the microsoft official centre with some info about HLSL. Now if I dabble into it, will it work for dx11 too? I also see different shader models, I hope the latest one covers everything from before.[/quote]
Yes, the shaders for the dx11 wrapper (3Dmigoto) are written & edited using HLSL, Shader Model 5. Dx9 is Shader Model 3.
I've discovered the microsoft official centre with some info about HLSL. Now if I dabble into it, will it work for dx11 too? I also see different shader models, I hope the latest one covers everything from before.
Yes, the shaders for the dx11 wrapper (3Dmigoto) are written & edited using HLSL, Shader Model 5. Dx9 is Shader Model 3.
@badhomaks1: A good place to start will be the list of links I made on HelixMod: [url]http://helixmod.blogspot.com/2014/01/learning-how-to-fix-games.html[/url]
That's pretty much a summary of the important pieces to be found through the thread and in comments. And includes some background reading on how DirectX works, and the primary directive for how we add stereo effects.
You can also look at eqzitara's guide for removing effects, but you might already be past that point.
[url]http://helixmod.blogspot.com/2012/04/how-to-guide-remove-effects-from-game.html[/url]
The goal of the class will be to do pretty much what you are suggesting, with a before/after tweak to shaders. It's going to be a bit before we get to that point though. I'm already sort of triple-booked here, so I won't be able to make any specific examples until it gets to the class.
If you are hungry for info quicker, a good place to look for this type of stuff is in any of Mike_ar69's fixes. Find a game you've got, and take a look at his fix files. In general he will outdent the lines that he has added so you can see what the exact changed lines are.
You can also look at my Psychonauts fix, as I always heavily document stuff that I'm doing.
For HLSL, if you learn about the input and output parameters, that will be universally helpful. The actual instructions not as much. If you learn this part, then you definitely can take on DX11 fixes using 3Dmigoto. The same principles apply.
If you get to doing these, ask for help here and I can help with syntax and 3Dmigoto weirdness.
That's pretty much a summary of the important pieces to be found through the thread and in comments. And includes some background reading on how DirectX works, and the primary directive for how we add stereo effects.
The goal of the class will be to do pretty much what you are suggesting, with a before/after tweak to shaders. It's going to be a bit before we get to that point though. I'm already sort of triple-booked here, so I won't be able to make any specific examples until it gets to the class.
If you are hungry for info quicker, a good place to look for this type of stuff is in any of Mike_ar69's fixes. Find a game you've got, and take a look at his fix files. In general he will outdent the lines that he has added so you can see what the exact changed lines are.
You can also look at my Psychonauts fix, as I always heavily document stuff that I'm doing.
For HLSL, if you learn about the input and output parameters, that will be universally helpful. The actual instructions not as much. If you learn this part, then you definitely can take on DX11 fixes using 3Dmigoto. The same principles apply.
If you get to doing these, ask for help here and I can help with syntax and 3Dmigoto weirdness.
Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607 Latest 3Dmigoto Release Bo3b's School for ShaderHackers
I'd suggest taking a look at both bo3b's Psychonauts fix and mike_ar69's Fable fix, both were well documented fixes. There's probably more but those are the only two I know of off the top of my head that are really in depth about the fixes done.
I'd suggest taking a look at both bo3b's Psychonauts fix and mike_ar69's Fable fix, both were well documented fixes. There's probably more but those are the only two I know of off the top of my head that are really in depth about the fixes done.
I'm still having issues trying to get a constant value to a pixel shader from the dx9settings file (or, basically I want to use a button to toggle between two depth settings). I did a search but I was unable to find any examples for the usage of "DefPSConst1". I suspect that the term "Const1" under [Pres#] may be incorrect. Here's what I have:
dx9settings.ini:
[code][General]
DefPSConst1 = 248
PresetsKeysList = 0;
..
[KEY0]
Key = 79
Presets = 3;4;
Type = 1
[PRES3]
Const1 = 0x00000000
[PRES4]
Const1 = 0x3f800000[/code]
And the pixelshader:
[code]ps_3_0
def c219, 6, 0, 0, 0
def c220, 0.644, 0.824, 0.0625, 0.5 //0.824 for town
dcl_2d s13
..
..
texldl r24, c220.z, s13
add r24.y, r2.w, -r24.y
mul r24.x, r24.x, r24.y
if_eq c248.x, c219.y //if const1 = 0
mul r24.x, r24.x, c220.y
else
mul r24.x, r24.x, c220.x
endif
add r2.x, r2.x, -r24.x
..[/code]
I'm still having issues trying to get a constant value to a pixel shader from the dx9settings file (or, basically I want to use a button to toggle between two depth settings). I did a search but I was unable to find any examples for the usage of "DefPSConst1". I suspect that the term "Const1" under [Pres#] may be incorrect. Here's what I have:
[quote="4everAwake"]I'm still having issues trying to get a constant value to a pixel shader from the dx9settings file (or, basically I want to use a button to toggle between two depth settings). I did a search but I was unable to find any examples for the usage of "DefPSConst1". I suspect that the term "Const1" under [Pres#] may be incorrect. Here's what I have:
dx9settings.ini:
[code][General]
DefPSConst1 = 248
PresetsKeysList = 0;
..
[KEY0]
Key = 79
Presets = 3;4;
Type = 1
[PRES3]
Const1 = 0x00000000
[PRES4]
Const1 = 0x3f800000[/code]
And the pixelshader:
[code]ps_3_0
def c219, 6, 0, 0, 0
def c220, 0.644, 0.824, 0.0625, 0.5 //0.824 for town
dcl_2d s13
..
..
texldl r24, c220.z, s13
add r24.y, r2.w, -r24.y
mul r24.x, r24.x, r24.y
if_eq c248.x, c219.y //if const1 = 0
mul r24.x, r24.x, c220.y
else
mul r24.x, r24.x, c220.x
endif
add r2.x, r2.x, -r24.x
..[/code][/quote]
I have used DefPSConst once before, I'll try to find where. For Vertex Shaders the way these constants are (supposed) to work is something like:
DefVSConst1 = 240
Const1 = 240.x
Const2 = 240.y
Const3 = 240.z
Const4 = 240.w
DefVSConst2 = 241
Const5 = 241.x
Const6 = 241.y
Const7 = 241.z
Const8 = 241.w
I might be wrong about the details, so you could test it out.
**EDIT
I had a couple of other thoughts:
1. Try using Const2 and accessing 248.y. I've had this issue before where Const1 did not work. I remembered where I use DefPSConst before and it was SplinterCell, but I did not use the feature in the end and took it out. Eqzitara used it in CLOS2 though. He also did the Const2 thing, though I am not sure if that was because there was originally a Const1 that was removed or if he run into the same problem.
2. Check the LOG.txt to see if there is any issue trying to use c248. Sometimes games have an upper limit (that I don't always understand) so you might need to use a lower number
3. Check that c248 is not being used elsewhere in the other shader files, it might be being "corrupted" or something. Use notepad++ to search in files for c248. I usually do this for all constants I set up (including DefPSViewSizeConst) just to make sure.
4everAwake said:I'm still having issues trying to get a constant value to a pixel shader from the dx9settings file (or, basically I want to use a button to toggle between two depth settings). I did a search but I was unable to find any examples for the usage of "DefPSConst1". I suspect that the term "Const1" under [Pres#] may be incorrect. Here's what I have:
I might be wrong about the details, so you could test it out.
**EDIT
I had a couple of other thoughts:
1. Try using Const2 and accessing 248.y. I've had this issue before where Const1 did not work. I remembered where I use DefPSConst before and it was SplinterCell, but I did not use the feature in the end and took it out. Eqzitara used it in CLOS2 though. He also did the Const2 thing, though I am not sure if that was because there was originally a Const1 that was removed or if he run into the same problem.
2. Check the LOG.txt to see if there is any issue trying to use c248. Sometimes games have an upper limit (that I don't always understand) so you might need to use a lower number
3. Check that c248 is not being used elsewhere in the other shader files, it might be being "corrupted" or something. Use notepad++ to search in files for c248. I usually do this for all constants I set up (including DefPSViewSizeConst) just to make sure.
[quote="bo3b"]@badhomaks1: A good place to start will be the list of links I made on HelixMod: [url]http://helixmod.blogspot.com/2014/01/learning-how-to-fix-games.html[/url]
That's pretty much a summary of the important pieces to be found through the thread and in comments. And includes some background reading on how DirectX works, and the primary directive for how we add stereo effects.
You can also look at eqzitara's guide for removing effects, but you might already be past that point.
[url]http://helixmod.blogspot.com/2012/04/how-to-guide-remove-effects-from-game.html[/url]
The goal of the class will be to do pretty much what you are suggesting, with a before/after tweak to shaders. It's going to be a bit before we get to that point though. I'm already sort of triple-booked here, so I won't be able to make any specific examples until it gets to the class.
If you are hungry for info quicker, a good place to look for this type of stuff is in any of Mike_ar69's fixes. Find a game you've got, and take a look at his fix files. In general he will outdent the lines that he has added so you can see what the exact changed lines are.
You can also look at my Psychonauts fix, as I always heavily document stuff that I'm doing.
For HLSL, if you learn about the input and output parameters, that will be universally helpful. The actual instructions not as much. If you learn this part, then you definitely can take on DX11 fixes using 3Dmigoto. The same principles apply.
If you get to doing these, ask for help here and I can help with syntax and 3Dmigoto weirdness.[/quote]
Thanks for the info, I'm currently looking into the tutorials and such. I have 2 questions however:
1. How do you skip a vertex shader in something like watch dogs? I have 3 vertex and 1 pixel shader that I want to skip (they're all related to shadows if that changes anything).
You said to make o2=0 and I have absolutely no idea what that means.
2. What do you mean by input and output parameters? Can you link to a webpage that shows them? So far I've found "http://msdn.microsoft.com/en-us/library/windows/desktop/bb509606(v=vs.85).aspx" but it doesn't make much sense to me. I feel like I need to learn the whole language to get it.
That's pretty much a summary of the important pieces to be found through the thread and in comments. And includes some background reading on how DirectX works, and the primary directive for how we add stereo effects.
The goal of the class will be to do pretty much what you are suggesting, with a before/after tweak to shaders. It's going to be a bit before we get to that point though. I'm already sort of triple-booked here, so I won't be able to make any specific examples until it gets to the class.
If you are hungry for info quicker, a good place to look for this type of stuff is in any of Mike_ar69's fixes. Find a game you've got, and take a look at his fix files. In general he will outdent the lines that he has added so you can see what the exact changed lines are.
You can also look at my Psychonauts fix, as I always heavily document stuff that I'm doing.
For HLSL, if you learn about the input and output parameters, that will be universally helpful. The actual instructions not as much. If you learn this part, then you definitely can take on DX11 fixes using 3Dmigoto. The same principles apply.
If you get to doing these, ask for help here and I can help with syntax and 3Dmigoto weirdness.
Thanks for the info, I'm currently looking into the tutorials and such. I have 2 questions however:
1. How do you skip a vertex shader in something like watch dogs? I have 3 vertex and 1 pixel shader that I want to skip (they're all related to shadows if that changes anything).
You said to make o2=0 and I have absolutely no idea what that means.
2. What do you mean by input and output parameters? Can you link to a webpage that shows them? So far I've found "http://msdn.microsoft.com/en-us/library/windows/desktop/bb509606(v=vs.85).aspx" but it doesn't make much sense to me. I feel like I need to learn the whole language to get it.
I've been looking through the assasin's creed 4 fix posted and my own cached untouched shaders. I am now seeing some patterns in the fixing process. Although I do find it interesting that for that specific game, no vertex shaders are bigger than 6kb which left me with around 15 or so examples to look at.
Now I've noticed that you always target the o.x variable. Which, according to this [code] out float4 o0 : SV_Position0[/code] represents the position of the object/vertices. Makes sense so far.
The 4 in float 4 denotes 4 variables (all of which are flotation point variables) assigned to that specific variable. Which are o.(x,y,z,w). Now is there any reason as to why it's not wxyz?
So you replace that part with a new variable r10 that has 4 float variables assigned to it.
[code]float4 r10;[/code]
All reasonable so far. Now why do you assign?:
[code]float4 stereoParams = StereoParams.Load(0); [/code]
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
Next up you just change up this part that was removed:
[code]
o0.x = dot(r0.xyzw, g_WorldViewProj._m00_m10_m20_m30);
o0.y = dot(r0.xyzw, g_WorldViewProj._m01_m11_m21_m31);
o0.z = dot(r0.xyzw, g_WorldViewProj._m02_m12_m22_m32);
o0.w = dot(r0.xyzw, g_WorldViewProj._m03_m13_m23_m33);[/code]
with this:
[code]r10.x = dot(r0.xyzw, g_WorldViewProj._m00_m10_m20_m30);
r10.y = dot(r0.xyzw, g_WorldViewProj._m01_m11_m21_m31);
r10.z = dot(r0.xyzw, g_WorldViewProj._m02_m12_m22_m32);
r10.w = dot(r0.xyzw, g_WorldViewProj._m03_m13_m23_m33);[/code]
But then you later make them equal to each other
[code]o0.xyzw = r10.xyzw; [/code]
right after you add this to the r10:
[code] r10.x += stereoParams.x * (stereoParams.y); [/code]
So why not just edit the original o0.(xyzw)?
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
And can you explain what does this line exactly do?:
[code]r10.x += stereoParams.x * (stereoParams.y); [/code]
I used these pieces of code to understand this part:
http://www.diffchecker.com/f7dnmywi
http://www.diffchecker.com/e5z7qjzg
http://www.diffchecker.com/8tdo1zcx
http://www.diffchecker.com/alrh8sm3
I've been looking through the assasin's creed 4 fix posted and my own cached untouched shaders. I am now seeing some patterns in the fixing process. Although I do find it interesting that for that specific game, no vertex shaders are bigger than 6kb which left me with around 15 or so examples to look at.
Now I've noticed that you always target the o.x variable. Which, according to this
out float4 o0 : SV_Position0
represents the position of the object/vertices. Makes sense so far.
The 4 in float 4 denotes 4 variables (all of which are flotation point variables) assigned to that specific variable. Which are o.(x,y,z,w). Now is there any reason as to why it's not wxyz?
So you replace that part with a new variable r10 that has 4 float variables assigned to it.
Now regarding HUD in the game, I see you add
[code]Texture1D<float4> IniParams : register(t120); [/code]
under
[code] Texture2D<float4> StereoParams : register(t125); [/code]
Why is that?
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
Then everything is the same as previous post and you assign a new variable for the piece of code added above.
[code]float4 iniParams = IniParams.Load(0); [/code]
Now this is where it gets tricky. In 2 of the fixes
http://www.diffchecker.com/k3002qbn
http://www.diffchecker.com/0wnty5qg
you add this:
[code]
// if(r10.w == 1)
if(r10.w == 1 && r10.z < 1)
{
r10.x += stereoParams.x * iniParams.x;
}
o0.xyzw = r10.xyzw;[/code]
But for another fix
http://www.diffchecker.com/ljo6jgd
the line with the && gets replaced with:
[code] if(r10.w == 1 || r10.z == 0)[/code]
And then there's this one which changes everything once again:
http://www.diffchecker.com/0xm6ngki
I'd love an explanation to everything happening after assigning the r10.w variable.
[quote="ksyon"]God sake.. Thanks God 3D comunity have you, guys!
I understand nothing you are talking about here >_<[/quote]Come on over to Bo3b's School for Shaderhackers, and you can learn too! First class starting this week. :->
[quote="mike_ar69"]2. Check the LOG.txt to see if there is any issue trying to use c248. Sometimes games have an upper limit (that I don't always understand) so you might need to use a lower number[/quote]
Yup.. this fixed it. My log file was giving an error message for c248. So I lowered it to c101 and it's now working. Much appreciated, Mike!
[quote]3. Check that c248 is not being used elsewhere in the other shader files, it might be being "corrupted" or something. Use notepad++ to search in files for c248. I usually do this for all constants I set up (including DefPSViewSizeConst) just to make sure.[/quote]
Good tip. I'll do this from now on. Thanks!
mike_ar69 said:2. Check the LOG.txt to see if there is any issue trying to use c248. Sometimes games have an upper limit (that I don't always understand) so you might need to use a lower number
Yup.. this fixed it. My log file was giving an error message for c248. So I lowered it to c101 and it's now working. Much appreciated, Mike!
3. Check that c248 is not being used elsewhere in the other shader files, it might be being "corrupted" or something. Use notepad++ to search in files for c248. I usually do this for all constants I set up (including DefPSViewSizeConst) just to make sure.
[quote="badhomaks1"]Now regarding HUD in the game, I see you add
[code]Texture1D<float4> IniParams : register(t120); [/code]
under
[code] Texture2D<float4> StereoParams : register(t125); [/code]
Why is that?
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
Then everything is the same as previous post and you assign a new variable for the piece of code added above.
[code]float4 iniParams = IniParams.Load(0); [/code]
Now this is where it gets tricky. In 2 of the fixes
http://www.diffchecker.com/k3002qbn
http://www.diffchecker.com/0wnty5qg
you add this:
[code]
// if(r10.w == 1)
if(r10.w == 1 && r10.z < 1)
{
r10.x += stereoParams.x * iniParams.x;
}
o0.xyzw = r10.xyzw;[/code]
But for another fix
http://www.diffchecker.com/ljo6jgd
the line with the && gets replaced with:
[code] if(r10.w == 1 || r10.z == 0)[/code]
And then there's this one which changes everything once again:
http://www.diffchecker.com/0xm6ngki
I'd love an explanation to everything happening after assigning the r10.w variable.[/quote]
Hi - I gave some response to these questions in your other thread "Have I been banned?":
[url]https://forums.geforce.com/default/topic/767662/3d-vision/i-ve-been-banned-/post/4284810/#4284810[/url]
Reproduced here:
Regarding the AC4 fix, which is one I did, you have unfortunately picked one of the more unusual ones for a first analysis, though you have done a great job parsing it all out. Bo3b said he will explain it all, so I won't step on his toes, but a couple of quick comments:
- The o0, r10 thing: I did not know when I did this fix that it was possible to work directly with o0 in DX11 HLSL, having been working on the DX9 asm up to that point. So in that case there's no reason to use r10, that just how it has to be done in DX9
- The various shaders with "If (r10.w == 1....)" etc. Some shaders are used to render quite different parts of the game, one example being a shader that affects *some parts* of the hud but also bloom on lights (I might be remembering AC3 here, but the principle is the same for AC4). So if you just change the shader to fix one effect, it screws up something else. The trick is to find a way to distinguish between these different things so you only correct the ones you want. With the helix DX9 wrapper, there are extensive features to do this by texture separation (as it's called), but the 3DMigoto wrapper does not have this capability (yet...). So we need other ways to do this separation. The value of "w" is used in different ways in the shaders, sometimes as a legitimate output from a VPM transformation, but sometimes it is set to "0" or "1", particularly for HUD elements where there is no legitimate "world z-coord" from which a meaningful w-coord can be derived. Also, "w" is used differently depending on what coordinate system you are in, though that is not necessarily applicable in this context. For example, in World (or View) Coords, a value of w=1 is used to define a Point in space, but a value of w=0 (for the exact same x, y, z) is used to define a Vector pointing from (0,0,0) to (x,y,z), but which is not specifiying it's origin (i.e that vector can be scaled and "added" to another point to derive a second point). In the fixes where I separate by w value, I do not always understand why w is either 0 or 1 for any given situation, so I try both of them and see what works. It's not all science, it's lots of black art... Another way to distinguish is by the z-coord, and one of the examples you list uses this approach (r10.z < 1). I can't quite remember why I picked "1" but it is mostly because it worked (though I think it is because I guessed that the normalized skybox depth would be 1, and that shader (I think) was separating the sun from some HUD element, but I'm not quite sure).
Hope some of this help you and bo3b work through this.
Regarding the AC4 fix, which is one I did, you have unfortunately picked one of the more unusual ones for a first analysis, though you have done a great job parsing it all out. Bo3b said he will explain it all, so I won't step on his toes, but a couple of quick comments:
- The o0, r10 thing: I did not know when I did this fix that it was possible to work directly with o0 in DX11 HLSL, having been working on the DX9 asm up to that point. So in that case there's no reason to use r10, that just how it has to be done in DX9
- The various shaders with "If (r10.w == 1....)" etc. Some shaders are used to render quite different parts of the game, one example being a shader that affects *some parts* of the hud but also bloom on lights (I might be remembering AC3 here, but the principle is the same for AC4). So if you just change the shader to fix one effect, it screws up something else. The trick is to find a way to distinguish between these different things so you only correct the ones you want. With the helix DX9 wrapper, there are extensive features to do this by texture separation (as it's called), but the 3DMigoto wrapper does not have this capability (yet...). So we need other ways to do this separation. The value of "w" is used in different ways in the shaders, sometimes as a legitimate output from a VPM transformation, but sometimes it is set to "0" or "1", particularly for HUD elements where there is no legitimate "world z-coord" from which a meaningful w-coord can be derived. Also, "w" is used differently depending on what coordinate system you are in, though that is not necessarily applicable in this context. For example, in World (or View) Coords, a value of w=1 is used to define a Point in space, but a value of w=0 (for the exact same x, y, z) is used to define a Vector pointing from (0,0,0) to (x,y,z), but which is not specifiying it's origin (i.e that vector can be scaled and "added" to another point to derive a second point). In the fixes where I separate by w value, I do not always understand why w is either 0 or 1 for any given situation, so I try both of them and see what works. It's not all science, it's lots of black art... Another way to distinguish is by the z-coord, and one of the examples you list uses this approach (r10.z < 1). I can't quite remember why I picked "1" but it is mostly because it worked (though I think it is because I guessed that the normalized skybox depth would be 1, and that shader (I think) was separating the sun from some HUD element, but I'm not quite sure).
Hope some of this help you and bo3b work through this.
I think a great structure would be to make a table form, with versions on the horizontal, and features/commands on the vertical. Since it's HTML markup, a table should be doable, but might take some fiddling.
Let's use TsaebehT's date format since we don't have version numbers.
OK or Check or something for where it's known to work, X for tested but known to fail, blank if unknown.
The 'title' for each feature can be a link to the same page for a description of the feature.
If you don't have time to do all that, no worries, but having this all in one spot would be super helpful.
The goal of this documentation would be to make it more clear which versions work, and do what, and avoid wasting so much time trying all these random dlls.
Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers
I've discovered the microsoft official centre with some info about HLSL. Now if I dabble into it, will it work for dx11 too? I also see different shader models, I hope the latest one covers everything from before.
@bo3b can you post some before - after text files of various shaders? Like first example could be a vertex shader that needs only 1 thing changed with explanation why. Then more and more lines. I feel that looking at examples is a pretty efficient way to learn.
I don't have any experience with the dx11 wrapper (3dmigoto) yet. But check out this site for more info: https://github.com/bo3b/3Dmigoto/wiki/Using-3Dmigoto-to-find-and-fix-shaders
Bo3b may be preparing a more concise explanation of the wrapper.
Yes, the shaders for the dx11 wrapper (3Dmigoto) are written & edited using HLSL, Shader Model 5. Dx9 is Shader Model 3.
Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35
That's pretty much a summary of the important pieces to be found through the thread and in comments. And includes some background reading on how DirectX works, and the primary directive for how we add stereo effects.
You can also look at eqzitara's guide for removing effects, but you might already be past that point.
http://helixmod.blogspot.com/2012/04/how-to-guide-remove-effects-from-game.html
The goal of the class will be to do pretty much what you are suggesting, with a before/after tweak to shaders. It's going to be a bit before we get to that point though. I'm already sort of triple-booked here, so I won't be able to make any specific examples until it gets to the class.
If you are hungry for info quicker, a good place to look for this type of stuff is in any of Mike_ar69's fixes. Find a game you've got, and take a look at his fix files. In general he will outdent the lines that he has added so you can see what the exact changed lines are.
You can also look at my Psychonauts fix, as I always heavily document stuff that I'm doing.
For HLSL, if you learn about the input and output parameters, that will be universally helpful. The actual instructions not as much. If you learn this part, then you definitely can take on DX11 fixes using 3Dmigoto. The same principles apply.
If you get to doing these, ask for help here and I can help with syntax and 3Dmigoto weirdness.
Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers
[MonitorSizeOverride][Global/Base Profile Tweaks][Depth=IPD]
dx9settings.ini:
And the pixelshader:
Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35
I have used DefPSConst once before, I'll try to find where. For Vertex Shaders the way these constants are (supposed) to work is something like:
DefVSConst1 = 240
Const1 = 240.x
Const2 = 240.y
Const3 = 240.z
Const4 = 240.w
DefVSConst2 = 241
Const5 = 241.x
Const6 = 241.y
Const7 = 241.z
Const8 = 241.w
I might be wrong about the details, so you could test it out.
**EDIT
I had a couple of other thoughts:
1. Try using Const2 and accessing 248.y. I've had this issue before where Const1 did not work. I remembered where I use DefPSConst before and it was SplinterCell, but I did not use the feature in the end and took it out. Eqzitara used it in CLOS2 though. He also did the Const2 thing, though I am not sure if that was because there was originally a Const1 that was removed or if he run into the same problem.
2. Check the LOG.txt to see if there is any issue trying to use c248. Sometimes games have an upper limit (that I don't always understand) so you might need to use a lower number
3. Check that c248 is not being used elsewhere in the other shader files, it might be being "corrupted" or something. Use notepad++ to search in files for c248. I usually do this for all constants I set up (including DefPSViewSizeConst) just to make sure.
Rig: Intel i7-8700K @4.7GHz, 16Gb Ram, SSD, GTX 1080Ti, Win10x64, Asus VG278
I understand nothing you are talking about here >_<
Thanks for the info, I'm currently looking into the tutorials and such. I have 2 questions however:
1. How do you skip a vertex shader in something like watch dogs? I have 3 vertex and 1 pixel shader that I want to skip (they're all related to shadows if that changes anything).
You said to make o2=0 and I have absolutely no idea what that means.
2. What do you mean by input and output parameters? Can you link to a webpage that shows them? So far I've found "http://msdn.microsoft.com/en-us/library/windows/desktop/bb509606(v=vs.85).aspx" but it doesn't make much sense to me. I feel like I need to learn the whole language to get it.
Now I've noticed that you always target the o.x variable. Which, according to this represents the position of the object/vertices. Makes sense so far.
The 4 in float 4 denotes 4 variables (all of which are flotation point variables) assigned to that specific variable. Which are o.(x,y,z,w). Now is there any reason as to why it's not wxyz?
So you replace that part with a new variable r10 that has 4 float variables assigned to it.
All reasonable so far. Now why do you assign?:
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
Next up you just change up this part that was removed:
with this:
But then you later make them equal to each other
right after you add this to the r10:
So why not just edit the original o0.(xyzw)?
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
And can you explain what does this line exactly do?:
I used these pieces of code to understand this part:
http://www.diffchecker.com/f7dnmywi
http://www.diffchecker.com/e5z7qjzg
http://www.diffchecker.com/8tdo1zcx
http://www.diffchecker.com/alrh8sm3
under
Why is that?
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
Then everything is the same as previous post and you assign a new variable for the piece of code added above.
Now this is where it gets tricky. In 2 of the fixes
http://www.diffchecker.com/k3002qbn
http://www.diffchecker.com/0wnty5qg
you add this:
But for another fix
http://www.diffchecker.com/ljo6jgd
the line with the && gets replaced with:
And then there's this one which changes everything once again:
http://www.diffchecker.com/0xm6ngki
I'd love an explanation to everything happening after assigning the r10.w variable.
Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers
Yup.. this fixed it. My log file was giving an error message for c248. So I lowered it to c101 and it's now working. Much appreciated, Mike!
Good tip. I'll do this from now on. Thanks!
Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35
Hi - I gave some response to these questions in your other thread "Have I been banned?":
https://forums.geforce.com/default/topic/767662/3d-vision/i-ve-been-banned-/post/4284810/#4284810
Reproduced here:
Regarding the AC4 fix, which is one I did, you have unfortunately picked one of the more unusual ones for a first analysis, though you have done a great job parsing it all out. Bo3b said he will explain it all, so I won't step on his toes, but a couple of quick comments:
- The o0, r10 thing: I did not know when I did this fix that it was possible to work directly with o0 in DX11 HLSL, having been working on the DX9 asm up to that point. So in that case there's no reason to use r10, that just how it has to be done in DX9
- The various shaders with "If (r10.w == 1....)" etc. Some shaders are used to render quite different parts of the game, one example being a shader that affects *some parts* of the hud but also bloom on lights (I might be remembering AC3 here, but the principle is the same for AC4). So if you just change the shader to fix one effect, it screws up something else. The trick is to find a way to distinguish between these different things so you only correct the ones you want. With the helix DX9 wrapper, there are extensive features to do this by texture separation (as it's called), but the 3DMigoto wrapper does not have this capability (yet...). So we need other ways to do this separation. The value of "w" is used in different ways in the shaders, sometimes as a legitimate output from a VPM transformation, but sometimes it is set to "0" or "1", particularly for HUD elements where there is no legitimate "world z-coord" from which a meaningful w-coord can be derived. Also, "w" is used differently depending on what coordinate system you are in, though that is not necessarily applicable in this context. For example, in World (or View) Coords, a value of w=1 is used to define a Point in space, but a value of w=0 (for the exact same x, y, z) is used to define a Vector pointing from (0,0,0) to (x,y,z), but which is not specifiying it's origin (i.e that vector can be scaled and "added" to another point to derive a second point). In the fixes where I separate by w value, I do not always understand why w is either 0 or 1 for any given situation, so I try both of them and see what works. It's not all science, it's lots of black art... Another way to distinguish is by the z-coord, and one of the examples you list uses this approach (r10.z < 1). I can't quite remember why I picked "1" but it is mostly because it worked (though I think it is because I guessed that the normalized skybox depth would be 1, and that shader (I think) was separating the sun from some HUD element, but I'm not quite sure).
Hope some of this help you and bo3b work through this.
Rig: Intel i7-8700K @4.7GHz, 16Gb Ram, SSD, GTX 1080Ti, Win10x64, Asus VG278
I want to convert this line:
Mathf.Atan( 1f / camera.projectionMatrix[1, 1] ) * 2 * Mathf.Rad2Deg
Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35