So the problem is the "Texture2D<float4> MaterialParams_srv.Layer0Diffuse_0 : register(t70);" line... I don't know how to solve that now, but:
What if you do the toggle in the vertex shader instead of the pixel shader? You would also be able to make a transition animation like I do with my fixes. Instead of using an "if" condition to discard the pixel shader, use a variable as a multiplier in o0.x (the x axis of the output of SV_Position0 in your case). Make it 1 by default and make a toggle to 0 with some transition time. You may have to separate the axes if you only want to do an "x" collapse.
You are also using an old 3Dmigoto build. 1.2.67 has better CPU performance.
So the problem is the "Texture2D<float4> MaterialParams_srv.Layer0Diffuse_0 : register(t70);" line... I don't know how to solve that now, but:
What if you do the toggle in the vertex shader instead of the pixel shader? You would also be able to make a transition animation like I do with my fixes. Instead of using an "if" condition to discard the pixel shader, use a variable as a multiplier in o0.x (the x axis of the output of SV_Position0 in your case). Make it 1 by default and make a toggle to 0 with some transition time. You may have to separate the axes if you only want to do an "x" collapse.
You are also using an old 3Dmigoto build. 1.2.67 has better CPU performance.
masterotaku said:So the problem is the "Texture2D<float4> MaterialParams_srv.Layer0Diffuse_0 : register(t70);" line... I don't know how to solve that now, but:
What if you do the toggle in the vertex shader instead of the pixel shader? You would also be able to make a transition animation like I do with my fixes. Instead of using an "if" condition to discard the pixel shader, use a variable as a multiplier in o0.x (the x axis of the output of SV_Position0 in your case). Make it 1 by default and make a toggle to 0 with some transition time. You may have to separate the axes if you only want to do an "x" collapse.
You are also using an old 3Dmigoto build. 1.2.67 has better CPU performance.
Oh. That VS needs fixing. The ASM version should be fine to use, I think, if you know how to do it. I'm on my phone so I can't write examples.
About transition animations, what I mean is this:
No transition:
- HUD if on (1).
- Press hotkey.
- HUD is off (0).
With transition:
- HUD is on (1).
- Press hotkey.
- HUD starts to squish towards the centre (0.9).
- And more (0.7).
...
- And more (0.1).
- HUD is off (0).
I think it changes once per frame (someone correct me if I'm wrong). I use that because it funny to watch, in some way similar to turning off a CRT TV. It also helps for things like changing HUD depth, or convergence.
Oh. That VS needs fixing. The ASM version should be fine to use, I think, if you know how to do it. I'm on my phone so I can't write examples.
About transition animations, what I mean is this:
No transition:
- HUD if on (1).
- Press hotkey.
- HUD is off (0).
With transition:
- HUD is on (1).
- Press hotkey.
- HUD starts to squish towards the centre (0.9).
- And more (0.7).
...
- And more (0.1).
- HUD is off (0).
I think it changes once per frame (someone correct me if I'm wrong). I use that because it funny to watch, in some way similar to turning off a CRT TV. It also helps for things like changing HUD depth, or convergence.
So here is a question that I can't find an answer ^_^
I know that for VS: "dcl_constantbuffer cb12[0], immediateIndexed" is enough to make the shader MONO.
But, how do I do it for a PS? Putting this code in a PS still makes it stereo.
However, if I mark the shader as MONO, I get the intended result.
Am I looking at the wrong cbuffer?
^_^
So here is a question that I can't find an answer ^_^
I know that for VS: "dcl_constantbuffer cb12[0], immediateIndexed" is enough to make the shader MONO.
But, how do I do it for a PS? Putting this code in a PS still makes it stereo.
However, if I mark the shader as MONO, I get the intended result.
Am I looking at the wrong cbuffer?
^_^
1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc
@DetectiveJohnKimble: Here is a hand-fixed version of that VS. You can replace the text with this one, and it will compile and run. Check if it's broken in some other way using the F9 show-original command. But I expect this should work.
// ---- Created with 3Dmigoto v1.2.67 on Wed Nov 08 07:25:34 2017
[quote="bo3b"]@DetectiveJohnKimble: Here is a hand-fixed version of that VS. You can replace the text with this one, and it will compile and run. Check if it's broken in some other way using the F9 show-original command. But I expect this should work.[/quote]
Thanks for looking in to it. But this gave me another error:
[i]b9f391996aadaf7d-vs_replace.txt(240,7): error X3000: syntax error: unexpected token '&'[/i]
Maybe the pixel shader is easier to fix?
bo3b said:@DetectiveJohnKimble: Here is a hand-fixed version of that VS. You can replace the text with this one, and it will compile and run. Check if it's broken in some other way using the F9 show-original command. But I expect this should work.
Thanks for looking in to it. But this gave me another error:
[quote="DetectiveJohnKimble"][quote="bo3b"]@DetectiveJohnKimble: Here is a hand-fixed version of that VS. You can replace the text with this one, and it will compile and run. Check if it's broken in some other way using the F9 show-original command. But I expect this should work.[/quote]
Thanks for looking in to it. But this gave me another error:
[i]b9f391996aadaf7d-vs_replace.txt(240,7): error X3000: syntax error: unexpected token '&'[/i]
Maybe the pixel shader is easier to fix?[/quote]
Not sure how you copy/pasted the code, but that is wrong. There is no Ampersand in the original code I posted, and it compiles for me using fxc without error.
VS is easier to fix, and that seemed like a better match for your scenario based on masterotaku's suggestion.
Some of these are easy to hand fix. These are pretty simple, only about 10 minutes of effort. The one I did recently for DHR for TheEvilWithin2 was very hard, and took me 6 hours. But since it led to his breakthrough on how to fix the game, easily worth it.
bo3b said:@DetectiveJohnKimble: Here is a hand-fixed version of that VS. You can replace the text with this one, and it will compile and run. Check if it's broken in some other way using the F9 show-original command. But I expect this should work.
Thanks for looking in to it. But this gave me another error:
Not sure how you copy/pasted the code, but that is wrong. There is no Ampersand in the original code I posted, and it compiles for me using fxc without error.
VS is easier to fix, and that seemed like a better match for your scenario based on masterotaku's suggestion.
Some of these are easy to hand fix. These are pretty simple, only about 10 minutes of effort. The one I did recently for DHR for TheEvilWithin2 was very hard, and took me 6 hours. But since it led to his breakthrough on how to fix the game, easily worth it.
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
bo3b said:
Not sure how you copy/pasted the code, but that is wrong. There is no Ampersand in the original code I posted, and it compiles for me using fxc without error.
VS is easier to fix, and that seemed like a better match for your scenario based on masterotaku's suggestion.
Some of these are easy to hand fix. These are pretty simple, only about 10 minutes of effort. The one I did recently for DHR for TheEvilWithin2 was very hard, and took me 6 hours. But since it led to his breakthrough on how to fix the game, easily worth it.
Yeah I definitely copied it wrong the first time, sorry about that.
This time I don't get any error messages, but I can't get it to toggle correctly. The shader seems to be off when I start the game and I get some funky visual glitches.
This is the shader with the toggle code I added, can you see if I did something wrong?
(Toggle code starts at line 278)
// ---- Created with 3Dmigoto v1.2.67 on Wed Nov 08 07:25:34 2017
Hello,
I updated my mod for IL2 BoS : http://helixmod.blogspot.fr/2015/07/il2-battle-of-stalingrad-updated.html, it works for both 3Dvision and VR.
I made the label masking by
[list]
[.]creating a resource from a new output (o7) made in the airframe PS[/.]
[.]inject it as a texture 2D in the PS shader that draw the labels and use a texture.Load() instruction to check if the o7 output airframe has been drawn or not for the current pixel. If cockpit frame then I disable label drawing for the pixel [/.]
[/list]
I wonder if I could use a stencil buffer method to make the label masking, and so avoid the Load() call...It looks like it should be possible with the 3dmigoto function, but I have no idea of how to do it...
creating a resource from a new output (o7) made in the airframe PS
inject it as a texture 2D in the PS shader that draw the labels and use a texture.Load() instruction to check if the o7 output airframe has been drawn or not for the current pixel. If cockpit frame then I disable label drawing for the pixel
I wonder if I could use a stencil buffer method to make the label masking, and so avoid the Load() call...It looks like it should be possible with the 3dmigoto function, but I have no idea of how to do it...
You probably can, but I'm not sure it would buy you anything compared to the method you are already using. We have some support for manipulating the stencil buffer in 3DMigoto, though beware that this has only had limited testing so there could be bugs:
- If you are defining a new custom resource with a [Resource] section you can use format=D32_FLOAT_S8X24_UINT or format=D24_UNORM_S8_UINT to get a stencil buffer, choosing whichever is appropriate for the depth format the game uses.
You will of course also need to either copy or copy_desc it from an existing resource, or specify enough additional parameters to allow 3DMigoto to synthesise it (e.g. type=Texture2D, width=..., height=..., mips=1, msaa=1, array=1). For what you are doing you probably want to use "copy" or "copy_desc".
- You can override the format of a depth buffer that the game creates with a [TextureOverride] section to add a stencil buffer with either of the above format= options. This requires a game restart to take effect.
- You can use a [CustomShader] section to configure the output merger depth/stencil state to use the stencil buffer however you see fit. You can either use this with your own custom shaders if you intend to use the stencil buffer with new draw calls, or use "draw=from_caller" and "handling=skip" to transfer the draw call from the game to your modified environment if you intend to modify an existing draw call.
There are quite a few options for the output merger depth/stencil state:
depth_enable = 1
depth_write_mask = all/zero (literally one of these words)
depth_func = <comparison_func>
stencil_enable = 1
stencil_read_mask = 0xff (any hex value up to 0xff)
stencil_write_mask = 0xff
stencil_front = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_back = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_ref = 42
depth_stencil_state_merge = 1: If you specify *any* of the above options than they will *all* be set together. By default any you don't specify will get the default values from MSDN, but this option will tell 3DMigoto to use the values from the game instead (recommended to make things a little easier if you are transferring a draw call).
<comparison_func> is one of "never", "less", "equal", "less_equal", "greater", "not_equal", "greater_equal", "always"
The three pass/fail ops are one of "keep", "zero", "replace", "incr_sat", "decr_sat", "invert", "incr", "decr"
Refer to MSDN for the meanings of these settings.
- You can clear the stencil side of a depth/stencil buffer with "clear = stencil oD" to clear the currently bound stencil buffer or "clear = stencil ResourceFoo" to clear a custom resource. If you omit the "stencil" keyword 3DMigoto will clear both the depth and stencil sides of the buffer, or use the "depth" keyword to only clear the depth side. By default it will clear to 0, but you can specify an alternate value, e.g. "clear = oD stencil 255" to clear just the stencil side to 255 or "clear = oD 1.0 255" to also clear the depth side to 1.0. This is new in 3DMigoto 1.2.67.
Beware that if you never actually bind a custom resource to an oD slot 3DMigoto will not be able to clear the buffer as a depth/stencil buffer (and will either try other methods or fail). This should not really be a problem in practice, but if you were to comment out the line that binds the buffer for some reason than a seemingly unrelated clear line could start failing.
One thing that is missing from 3DMigoto at the moment is the ability to access the stencil side of the buffer when binding it as a render target or texture - in those cases 3DMigoto currently configures the view to access only the depth side of the buffer, but in the future we will have a "stencil" keyword to do the opposite (and it should be possible to bind depth and stencil views of the same buffer simultaneously in different slots).
You probably can, but I'm not sure it would buy you anything compared to the method you are already using. We have some support for manipulating the stencil buffer in 3DMigoto, though beware that this has only had limited testing so there could be bugs:
- If you are defining a new custom resource with a [Resource] section you can use format=D32_FLOAT_S8X24_UINT or format=D24_UNORM_S8_UINT to get a stencil buffer, choosing whichever is appropriate for the depth format the game uses.
You will of course also need to either copy or copy_desc it from an existing resource, or specify enough additional parameters to allow 3DMigoto to synthesise it (e.g. type=Texture2D, width=..., height=..., mips=1, msaa=1, array=1). For what you are doing you probably want to use "copy" or "copy_desc".
- You can override the format of a depth buffer that the game creates with a [TextureOverride] section to add a stencil buffer with either of the above format= options. This requires a game restart to take effect.
- You can use a [CustomShader] section to configure the output merger depth/stencil state to use the stencil buffer however you see fit. You can either use this with your own custom shaders if you intend to use the stencil buffer with new draw calls, or use "draw=from_caller" and "handling=skip" to transfer the draw call from the game to your modified environment if you intend to modify an existing draw call.
There are quite a few options for the output merger depth/stencil state:
depth_enable = 1
depth_write_mask = all/zero (literally one of these words)
depth_func = <comparison_func>
stencil_enable = 1
stencil_read_mask = 0xff (any hex value up to 0xff)
stencil_write_mask = 0xff
stencil_front = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_back = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_ref = 42
depth_stencil_state_merge = 1: If you specify *any* of the above options than they will *all* be set together. By default any you don't specify will get the default values from MSDN, but this option will tell 3DMigoto to use the values from the game instead (recommended to make things a little easier if you are transferring a draw call).
<comparison_func> is one of "never", "less", "equal", "less_equal", "greater", "not_equal", "greater_equal", "always"
The three pass/fail ops are one of "keep", "zero", "replace", "incr_sat", "decr_sat", "invert", "incr", "decr"
Refer to MSDN for the meanings of these settings.
- You can clear the stencil side of a depth/stencil buffer with "clear = stencil oD" to clear the currently bound stencil buffer or "clear = stencil ResourceFoo" to clear a custom resource. If you omit the "stencil" keyword 3DMigoto will clear both the depth and stencil sides of the buffer, or use the "depth" keyword to only clear the depth side. By default it will clear to 0, but you can specify an alternate value, e.g. "clear = oD stencil 255" to clear just the stencil side to 255 or "clear = oD 1.0 255" to also clear the depth side to 1.0. This is new in 3DMigoto 1.2.67.
Beware that if you never actually bind a custom resource to an oD slot 3DMigoto will not be able to clear the buffer as a depth/stencil buffer (and will either try other methods or fail). This should not really be a problem in practice, but if you were to comment out the line that binds the buffer for some reason than a seemingly unrelated clear line could start failing.
One thing that is missing from 3DMigoto at the moment is the ability to access the stencil side of the buffer when binding it as a render target or texture - in those cases 3DMigoto currently configures the view to access only the depth side of the buffer, but in the future we will have a "stencil" keyword to do the opposite (and it should be possible to bind depth and stencil views of the same buffer simultaneously in different slots).
2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit
@DetectiveJohnKimble: I'm not sure I understand exactly what you are wanting to do, but for this code, I would recommend not changing the other parameters. To disable, set the o0 to 0, not all of them.
The key part is that [i]out float4 o0 : SV_Position0,[/i]
which is o0. If you set position to zero, then the pixel shader has nothing to work with. This is explained in fair depth in my ShaderHacker class, so if you haven't looked at that, you need to. Even though the class talks about DX9, the principles are the same.
Not this:
[code] float4 params = IniParams.Load(0);
if (params.x == 0)
{
o0 = 0;
o1 = 0;
o2 = 0;
o3 = 0;
o4 = 0;
o5 = 0;
o6 = 0;
o7 = 0;
return;
} else {
[/code]
Just:
[code] float4 params = IniParams.Load(0);
if (params.x == 0)
{
o0 = 0;
return;
} else {
[/code]
@DetectiveJohnKimble: I'm not sure I understand exactly what you are wanting to do, but for this code, I would recommend not changing the other parameters. To disable, set the o0 to 0, not all of them.
The key part is that out float4 o0 : SV_Position0,
which is o0. If you set position to zero, then the pixel shader has nothing to work with. This is explained in fair depth in my ShaderHacker class, so if you haven't looked at that, you need to. Even though the class talks about DX9, the principles are the same.
[quote="bo3b"]@DetectiveJohnKimble: I'm not sure I understand exactly what you are wanting to do, but for this code, I would recommend not changing the other parameters. To disable, set the o0 to 0, not all of them.[/quote]
I'm trying to make the shader toggle on/off. It's the HUD in AC Origins so basically this is meant to be a hotkey for turning the HUD on and off.
[quote="bo3b"]The key part is that [i]out float4 o0 : SV_Position0,[/i]
which is o0. If you set position to zero, then the pixel shader has nothing to work with. This is explained in fair depth in my ShaderHacker class, so if you haven't looked at that, you need to. Even though the class talks about DX9, the principles are the same.
Just:
[code] float4 params = IniParams.Load(0);
if (params.x == 0)
{
o0 = 0;
return;
} else {
[/code][/quote]
Hmm, this gives me the same result as before.
bo3b said:@DetectiveJohnKimble: I'm not sure I understand exactly what you are wanting to do, but for this code, I would recommend not changing the other parameters. To disable, set the o0 to 0, not all of them.
I'm trying to make the shader toggle on/off. It's the HUD in AC Origins so basically this is meant to be a hotkey for turning the HUD on and off.
bo3b said:The key part is that out float4 o0 : SV_Position0,
which is o0. If you set position to zero, then the pixel shader has nothing to work with. This is explained in fair depth in my ShaderHacker class, so if you haven't looked at that, you need to. Even though the class talks about DX9, the principles are the same.
Try:
[code]
float4 params = IniParams.Load(0);
if (params.x == 0)
{
discard;
}
[/code]
Setting the output to zero may not be equivalent to skipping the shader depending on the output merger state, but the discard instruction should always be equivalent regardless of state.
Setting the output to zero may not be equivalent to skipping the shader depending on the output merger state, but the discard instruction should always be equivalent regardless of state.
2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit
Can you discard a vertex shader? I thought it wasn't possible, but it's something that I didn't actually try since 2015 when I was starting learning HLSL.
Unrelated to all if this, one of the strange things I learned while fixing Hitman 1 and 2 was that in Shader Model 4, in ASM, comparisons are done differently (compared to DX9 fixes) if they aren't just checking if something is zero or non zero. Storing comparisons in a register and then checking if they were zero or non zero (true/false) wasn't intuitive at first, but then it allowed a lot of quick and effortless changes in the code. Fun stuff.
Can you discard a vertex shader? I thought it wasn't possible, but it's something that I didn't actually try since 2015 when I was starting learning HLSL.
Unrelated to all if this, one of the strange things I learned while fixing Hitman 1 and 2 was that in Shader Model 4, in ASM, comparisons are done differently (compared to DX9 fixes) if they aren't just checking if something is zero or non zero. Storing comparisons in a register and then checking if they were zero or non zero (true/false) wasn't intuitive at first, but then it allowed a lot of quick and effortless changes in the code. Fun stuff.
What if you do the toggle in the vertex shader instead of the pixel shader? You would also be able to make a transition animation like I do with my fixes. Instead of using an "if" condition to discard the pixel shader, use a variable as a multiplier in o0.x (the x axis of the output of SV_Position0 in your case). Make it 1 by default and make a toggle to 0 with some transition time. You may have to separate the axes if you only want to do an "x" collapse.
You are also using an old 3Dmigoto build. 1.2.67 has better CPU performance.
CPU: Intel Core i7 7700K @ 4.9GHz
Motherboard: Gigabyte Aorus GA-Z270X-Gaming 5
RAM: GSKILL Ripjaws Z 16GB 3866MHz CL18
GPU: MSI GeForce RTX 2080Ti Gaming X Trio
Monitor: Asus PG278QR
Speakers: Logitech Z506
Donations account: masterotakusuko@gmail.com
I get a similar error with the vertex shader:
b9f391996aadaf7d-vs_replace.txt(241,18-66): error X3000: syntax error: unexpected token 'InstanceParams_instancing_ClusterVertexDataStatic'
I'm not sure what a transition animation is though.
1080 Ti - i7 5820k - 16Gb RAM - Win 10 version 1607 - ASUS VG236H (1920x1080@120Hz)
About transition animations, what I mean is this:
No transition:
- HUD if on (1).
- Press hotkey.
- HUD is off (0).
With transition:
- HUD is on (1).
- Press hotkey.
- HUD starts to squish towards the centre (0.9).
- And more (0.7).
...
- And more (0.1).
- HUD is off (0).
I think it changes once per frame (someone correct me if I'm wrong). I use that because it funny to watch, in some way similar to turning off a CRT TV. It also helps for things like changing HUD depth, or convergence.
CPU: Intel Core i7 7700K @ 4.9GHz
Motherboard: Gigabyte Aorus GA-Z270X-Gaming 5
RAM: GSKILL Ripjaws Z 16GB 3866MHz CL18
GPU: MSI GeForce RTX 2080Ti Gaming X Trio
Monitor: Asus PG278QR
Speakers: Logitech Z506
Donations account: masterotakusuko@gmail.com
I would rather do it the regular on/off way though.
1080 Ti - i7 5820k - 16Gb RAM - Win 10 version 1607 - ASUS VG236H (1920x1080@120Hz)
I know that for VS: "dcl_constantbuffer cb12[0], immediateIndexed" is enough to make the shader MONO.
But, how do I do it for a PS? Putting this code in a PS still makes it stereo.
However, if I mark the shader as MONO, I get the intended result.
Am I looking at the wrong cbuffer?
^_^
1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc
My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com
(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)
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
Thanks for looking in to it. But this gave me another error:
b9f391996aadaf7d-vs_replace.txt(240,7): error X3000: syntax error: unexpected token '&'
Maybe the pixel shader is easier to fix?
1080 Ti - i7 5820k - 16Gb RAM - Win 10 version 1607 - ASUS VG236H (1920x1080@120Hz)
Not sure how you copy/pasted the code, but that is wrong. There is no Ampersand in the original code I posted, and it compiles for me using fxc without error.
VS is easier to fix, and that seemed like a better match for your scenario based on masterotaku's suggestion.
Some of these are easy to hand fix. These are pretty simple, only about 10 minutes of effort. The one I did recently for DHR for TheEvilWithin2 was very hard, and took me 6 hours. But since it led to his breakthrough on how to fix the game, easily worth it.
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
Yeah I definitely copied it wrong the first time, sorry about that.
This time I don't get any error messages, but I can't get it to toggle correctly. The shader seems to be off when I start the game and I get some funky visual glitches.
This is the shader with the toggle code I added, can you see if I did something wrong?
(Toggle code starts at line 278)
1080 Ti - i7 5820k - 16Gb RAM - Win 10 version 1607 - ASUS VG236H (1920x1080@120Hz)
I updated my mod for IL2 BoS : http://helixmod.blogspot.fr/2015/07/il2-battle-of-stalingrad-updated.html, it works for both 3Dvision and VR.
I made the label masking by
I wonder if I could use a stencil buffer method to make the label masking, and so avoid the Load() call...It looks like it should be possible with the 3dmigoto function, but I have no idea of how to do it...
- If you are defining a new custom resource with a [Resource] section you can use format=D32_FLOAT_S8X24_UINT or format=D24_UNORM_S8_UINT to get a stencil buffer, choosing whichever is appropriate for the depth format the game uses.
You will of course also need to either copy or copy_desc it from an existing resource, or specify enough additional parameters to allow 3DMigoto to synthesise it (e.g. type=Texture2D, width=..., height=..., mips=1, msaa=1, array=1). For what you are doing you probably want to use "copy" or "copy_desc".
- You can override the format of a depth buffer that the game creates with a [TextureOverride] section to add a stencil buffer with either of the above format= options. This requires a game restart to take effect.
- You can use a [CustomShader] section to configure the output merger depth/stencil state to use the stencil buffer however you see fit. You can either use this with your own custom shaders if you intend to use the stencil buffer with new draw calls, or use "draw=from_caller" and "handling=skip" to transfer the draw call from the game to your modified environment if you intend to modify an existing draw call.
There are quite a few options for the output merger depth/stencil state:
depth_enable = 1
depth_write_mask = all/zero (literally one of these words)
depth_func = <comparison_func>
stencil_enable = 1
stencil_read_mask = 0xff (any hex value up to 0xff)
stencil_write_mask = 0xff
stencil_front = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_back = <comparison_func> <both_pass_op> <depth_fail_op> <stencil_fail_op>
stencil_ref = 42
depth_stencil_state_merge = 1: If you specify *any* of the above options than they will *all* be set together. By default any you don't specify will get the default values from MSDN, but this option will tell 3DMigoto to use the values from the game instead (recommended to make things a little easier if you are transferring a draw call).
<comparison_func> is one of "never", "less", "equal", "less_equal", "greater", "not_equal", "greater_equal", "always"
The three pass/fail ops are one of "keep", "zero", "replace", "incr_sat", "decr_sat", "invert", "incr", "decr"
Refer to MSDN for the meanings of these settings.
- You can clear the stencil side of a depth/stencil buffer with "clear = stencil oD" to clear the currently bound stencil buffer or "clear = stencil ResourceFoo" to clear a custom resource. If you omit the "stencil" keyword 3DMigoto will clear both the depth and stencil sides of the buffer, or use the "depth" keyword to only clear the depth side. By default it will clear to 0, but you can specify an alternate value, e.g. "clear = oD stencil 255" to clear just the stencil side to 255 or "clear = oD 1.0 255" to also clear the depth side to 1.0. This is new in 3DMigoto 1.2.67.
Beware that if you never actually bind a custom resource to an oD slot 3DMigoto will not be able to clear the buffer as a depth/stencil buffer (and will either try other methods or fail). This should not really be a problem in practice, but if you were to comment out the line that binds the buffer for some reason than a seemingly unrelated clear line could start failing.
One thing that is missing from 3DMigoto at the moment is the ability to access the stencil side of the buffer when binding it as a render target or texture - in those cases 3DMigoto currently configures the view to access only the depth side of the buffer, but in the future we will have a "stencil" keyword to do the opposite (and it should be possible to bind depth and stencil views of the same buffer simultaneously in different slots).
2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit
Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD
Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword
The key part is that out float4 o0 : SV_Position0,
which is o0. If you set position to zero, then the pixel shader has nothing to work with. This is explained in fair depth in my ShaderHacker class, so if you haven't looked at that, you need to. Even though the class talks about DX9, the principles are the same.
Not this:
Just:
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'm trying to make the shader toggle on/off. It's the HUD in AC Origins so basically this is meant to be a hotkey for turning the HUD on and off.
Hmm, this gives me the same result as before.
1080 Ti - i7 5820k - 16Gb RAM - Win 10 version 1607 - ASUS VG236H (1920x1080@120Hz)
Setting the output to zero may not be equivalent to skipping the shader depending on the output merger state, but the discard instruction should always be equivalent regardless of state.
2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit
Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD
Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword
Unrelated to all if this, one of the strange things I learned while fixing Hitman 1 and 2 was that in Shader Model 4, in ASM, comparisons are done differently (compared to DX9 fixes) if they aren't just checking if something is zero or non zero. Storing comparisons in a register and then checking if they were zero or non zero (true/false) wasn't intuitive at first, but then it allowed a lot of quick and effortless changes in the code. Fun stuff.
CPU: Intel Core i7 7700K @ 4.9GHz
Motherboard: Gigabyte Aorus GA-Z270X-Gaming 5
RAM: GSKILL Ripjaws Z 16GB 3866MHz CL18
GPU: MSI GeForce RTX 2080Ti Gaming X Trio
Monitor: Asus PG278QR
Speakers: Logitech Z506
Donations account: masterotakusuko@gmail.com