I've been banned?
Hey guys, was my original alias badhomaks1 banned? I couldn't post anything or rather, I posted but the posts were hidden. I don't remember doing anything but asking a few questions in this forums so I don't see why there was the shadow ban. I couldn't even make a new topic so no way to ask anyone anything. Eh, I like my new alias better but this was still some bs. Anyway until things get resolved here were my original questions: (the many dashes represent separate posts) [quote="mike_ar69"] If you want a head start, look here: VS 3.0 Registers: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172963(v=vs.85).aspx[/url] VS 3.0 instructions: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172938(v=vs.85).aspx[/url] PS 3.0 Registers: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172920(v=vs.85).aspx[/url] PS 3.0 Instructions: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb219854(v=vs.85).aspx[/url] The langauage is "asm" - you can Google for examples on how to do simple things. If you learn "add", "mul", "mad", "rcp" and "dp4" you are 90% of the way there, everything else being somewhat similar in structure.[/quote] Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]). ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [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. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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.
Hey guys, was my original alias badhomaks1 banned? I couldn't post anything or rather, I posted but the posts were hidden. I don't remember doing anything but asking a few questions in this forums so I don't see why there was the shadow ban.

I couldn't even make a new topic so no way to ask anyone anything.

Eh, I like my new alias better but this was still some bs.


Anyway until things get resolved here were my original questions: (the many dashes represent separate posts)


mike_ar69 said:
If you want a head start, look here:

VS 3.0 Registers: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172963(v=vs.85).aspx
VS 3.0 instructions: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172938(v=vs.85).aspx

PS 3.0 Registers: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172920(v=vs.85).aspx
PS 3.0 Instructions: http://msdn.microsoft.com/en-us/library/windows/desktop/bb219854(v=vs.85).aspx

The langauage is "asm" - you can Google for examples on how to do simple things. If you learn "add", "mul", "mad", "rcp" and "dp4" you are 90% of the way there, everything else being somewhat similar in structure.

Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]).



-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

bo3b said:@badhomaks1: A good place to start will be the list of links I made on HelixMod: http://helixmod.blogspot.com/2014/01/learning-how-to-fix-games.html

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.

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
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.
float4 r10;

All reasonable so far. Now why do you assign?:
float4 stereoParams = StereoParams.Load(0);


--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------

Next up you just change up this part that was removed:
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);


with this:
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);


But then you later make them equal to each other
o0.xyzw = r10.xyzw;


right after you add this to the r10:
r10.x +=  stereoParams.x * (stereoParams.y);

So why not just edit the original o0.(xyzw)?

--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------



And can you explain what does this line exactly do?:
r10.x +=  stereoParams.x * (stereoParams.y);



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



-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------











Now regarding HUD in the game, I see you add
Texture1D<float4> IniParams : register(t120);

under
Texture2D<float4> StereoParams : register(t125);

Why is that?

--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------


Then everything is the same as previous post and you assign a new variable for the piece of code added above.
float4 iniParams = IniParams.Load(0);


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:
// if(r10.w == 1)
if(r10.w == 1 && r10.z < 1)
{
r10.x += stereoParams.x * iniParams.x;
}
o0.xyzw = r10.xyzw;


But for another fix
http://www.diffchecker.com/ljo6jgd

the line with the && gets replaced with:
if(r10.w == 1 || r10.z == 0)


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.

#1
Posted 08/13/2014 05:14 AM   
I've removed your suspension; looks like some of the content in your post upset the spam filter.
I've removed your suspension; looks like some of the content in your post upset the spam filter.

Official GeForce Forums Benchmarking Leaderboards

Minima: Corsair Obsidian 350D mATX, Asus Maximus VI GENE Z87, Intel Core i7-4790k @ 4.60GHz, Corsair H110, Corsair Dominator Platinum 16GB (4x4GB) @ 2400MHz, 1x Intel 730k 480GB, 1x WD Scorpio Black 750GB, 2x WD Caviar Black 1TB, 1x GTX Titan X, 1x GTX 750 Ti, Enermax 1250W Evolution, Windows 10 64bit.

Asus ROG Swift PG278Q monitor, Logitech G9X mouse, Corsair Vengeance keyboard.

Feel free to PM me if I don't follow-up on a thread that I have responded to.

Community Moderator - not employed by NVIDIA.

#2
Posted 08/13/2014 08:32 AM   
All very good questions, and I'll be happy to answer them. When I answer stuff like this I like to add it to known good spots so that other people can find it later though, and I fear this thread will get sort of lost. Would you do me a favor and post your questions in the 3Dmigoto thread, and break up the large block into a few smaller pieces so I can quote them? This can become part of the documentation for 3Dmigoto. [url]https://forums.geforce.com/default/topic/685657/3dmigoto-now-open-source-/[/url] [quote]Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]).[/quote]The ASM is not really useful for 3Dmigoto. I now add the ASM file to the bottom of every HLSL file that is decompiled as a reference, but in general you don't need to use it or look at it. There are occasions where we suspect there are bugs in the Decompiler that is generating bad HLSL code, and on those occasions it's helpful to have the master ASM source available. The generated HLSL looks a lot like the ASM because of the way that the Decompiler works. If you look at a smallish example you can see how an ASM "Add x, y, z" gets turned into a HLSL "x = y + z", and a "Mov x, y" gets turned into a "x = y". In general we've found the HLSL to be pretty good, and substantially easier to read. For 3Dmigoto, definitely focus on the generated HLSL instead.
All very good questions, and I'll be happy to answer them.

When I answer stuff like this I like to add it to known good spots so that other people can find it later though, and I fear this thread will get sort of lost.

Would you do me a favor and post your questions in the 3Dmigoto thread, and break up the large block into a few smaller pieces so I can quote them? This can become part of the documentation for 3Dmigoto.

https://forums.geforce.com/default/topic/685657/3dmigoto-now-open-source-/


Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]).
The ASM is not really useful for 3Dmigoto. I now add the ASM file to the bottom of every HLSL file that is decompiled as a reference, but in general you don't need to use it or look at it.

There are occasions where we suspect there are bugs in the Decompiler that is generating bad HLSL code, and on those occasions it's helpful to have the master ASM source available.

The generated HLSL looks a lot like the ASM because of the way that the Decompiler works. If you look at a smallish example you can see how an ASM "Add x, y, z" gets turned into a HLSL "x = y + z", and a "Mov x, y" gets turned into a "x = y".

In general we've found the HLSL to be pretty good, and substantially easier to read. For 3Dmigoto, definitely focus on the generated HLSL instead.

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

#3
Posted 08/13/2014 09:48 AM   
[quote="ForgottenProdigy"]Hey guys, was my original alias badhomaks1 banned? I couldn't post anything or rather, I posted but the posts were hidden. I don't remember doing anything but asking a few questions in this forums so I don't see why there was the shadow ban. I couldn't even make a new topic so no way to ask anyone anything. Eh, I like my new alias better but this was still some bs. Anyway until things get resolved here were my original questions: (the many dashes represent separate posts) [quote="mike_ar69"] If you want a head start, look here: VS 3.0 Registers: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172963(v=vs.85).aspx[/url] VS 3.0 instructions: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172938(v=vs.85).aspx[/url] PS 3.0 Registers: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb172920(v=vs.85).aspx[/url] PS 3.0 Instructions: [url]http://msdn.microsoft.com/en-us/library/windows/desktop/bb219854(v=vs.85).aspx[/url] The langauage is "asm" - you can Google for examples on how to do simple things. If you learn "add", "mul", "mad", "rcp" and "dp4" you are 90% of the way there, everything else being somewhat similar in structure.[/quote] Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]). ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [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. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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] 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.
ForgottenProdigy said:Hey guys, was my original alias badhomaks1 banned? I couldn't post anything or rather, I posted but the posts were hidden. I don't remember doing anything but asking a few questions in this forums so I don't see why there was the shadow ban.

I couldn't even make a new topic so no way to ask anyone anything.

Eh, I like my new alias better but this was still some bs.


Anyway until things get resolved here were my original questions: (the many dashes represent separate posts)


mike_ar69 said:
If you want a head start, look here:

VS 3.0 Registers: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172963(v=vs.85).aspx
VS 3.0 instructions: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172938(v=vs.85).aspx

PS 3.0 Registers: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172920(v=vs.85).aspx
PS 3.0 Instructions: http://msdn.microsoft.com/en-us/library/windows/desktop/bb219854(v=vs.85).aspx

The langauage is "asm" - you can Google for examples on how to do simple things. If you learn "add", "mul", "mad", "rcp" and "dp4" you are 90% of the way there, everything else being somewhat similar in structure.

Is asm of any use with 3dmigoto? Cause from what I can see from the extracted vertex shaders from watch dogs, they have a lot of floats then a bunch of lines starting with r.x then the add,mov,mad functions (or registers not sure what to call them [perhaps instructions?]).



-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

bo3b said:@badhomaks1: A good place to start will be the list of links I made on HelixMod: http://helixmod.blogspot.com/2014/01/learning-how-to-fix-games.html

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.

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
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.
float4 r10;

All reasonable so far. Now why do you assign?:
float4 stereoParams = StereoParams.Load(0);


--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------

Next up you just change up this part that was removed:
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);


with this:
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);


But then you later make them equal to each other
o0.xyzw = r10.xyzw;


right after you add this to the r10:
r10.x +=  stereoParams.x * (stereoParams.y);

So why not just edit the original o0.(xyzw)?

--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------



And can you explain what does this line exactly do?:
r10.x +=  stereoParams.x * (stereoParams.y);



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




-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------











Now regarding HUD in the game, I see you add
Texture1D<float4> IniParams : register(t120);

under
Texture2D<float4> StereoParams : register(t125);

Why is that?

--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------


Then everything is the same as previous post and you assign a new variable for the piece of code added above.
float4 iniParams = IniParams.Load(0);


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:
// if(r10.w == 1)
if(r10.w == 1 && r10.z < 1)
{
r10.x += stereoParams.x * iniParams.x;
}
o0.xyzw = r10.xyzw;


But for another fix

http://www.diffchecker.com/ljo6jgd


the line with the && gets replaced with:
if(r10.w == 1 || r10.z == 0)


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.











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

#4
Posted 08/13/2014 11:17 AM   
Scroll To Top