3Dmigoto now open-source...
  54 / 141    
[quote="helifax"]I am trying to implement the auto-depth crosshair fix. But I am stuck at basically first step. How do I find out if the depth buffer is enabled during a shader execution?[/quote]There's a few ways - ShaderUsage.txt might list a depth target for the corresponding pixel shader shader, or you could use frame analysis' dump_depth option to dump it out for that shader (vertex or pixel). You could also use frame analysis logging to check if there was a depth buffer assigned in the previous OMSetRenderTargets call. [quote]Actually I want to copy it from a different shader like here: ... But I am at a total loss... First of all: - The hash can be of a vertex or pixel shader? or requires a special shader type?[/quote]Can be either. [quote]- I don't understand this: "ResourceDepthBuffer = ps-t0" who is t0? Is it texture target zero? Do I need to use the Frame Analysis for this?[/quote]Yes, t0 is texture target/slot 0. If the pixel shader has headers the best bet is to check it since it will have a name so you can check which t register it's in. ShaderUsage.txt will list these, but it might be hard to tell which is the depth buffer. Dumping out the textures with frame analysis will tell you this as well, but depth buffer formats are among those that DirectTK doesn't support for conversion to jpeg, so you will have to dump them out as dds. [quote]I have used the ShaderUsage file and I got this: ... This is the pixel shader used by the HUD vertex shader (that I want to correct). I looked at the vertex shader and don't see a <DepthTarget handle=0000000013F766D0>a98c980a</DepthTarget> bound there...[/quote]ShaderUsage.txt only lists depth targets on pixel shaders, but the depth target is bound separately from shaders, so if you see it in the pixel shader you can assume it also applies to the corresponding vertex shader. [quote]But for example I want to use a shader like this (that has the DepthTarget bound) to copy the Depth Buffer. How exactly do I go on about it? Do I need to go inside the shader and generate an output variable and then put the DepthTexture inside or??[/quote] No need to edit the shader (and unlike Helix Mod you don't even need to ship the shader), you can copy the depth buffer via an intermediate resource like: [code] [ResourceDepthBuffer] [ShaderOverrideLights] hash = foo ResourceDepthBuffer = oD [ShaderOverrideCrosshair] hash = bar vs-t110 = ResourceDepthBuffer [/code] Note that when copying a depth buffer from an oD slot you *must* have at least one full copy (which it will by default) - this is because the bind flags will be different, and so that 3DMigoto can convert the DXGI format into something that can be used in a texture slot). [quote] Edit: I was wondering if I can use a shader that defines this: [code] SamplerComparisonState SamplerGenericShadowCompare_s : register(s14); Texture2D<float4> DepthBufferTexture_texture : register(t1); Texture2D<float4> ShadowMapSampler_texture : register(t43); [/code] where register t1 is basically the DepthBuffer Texture. I could then say something like this: [code] [ResourceDepthBuffer] [ShaderOverrideShadow] Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture ResourceDepthBuffer = reference ps-t1 [ShaderOverrideCrosshair] Hash = 0xFFFFF //VS hash code of the HUD vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl [/code] It should work no?[/quote]Looks right to me :)
helifax said:I am trying to implement the auto-depth crosshair fix. But I am stuck at basically first step.
How do I find out if the depth buffer is enabled during a shader execution?
There's a few ways - ShaderUsage.txt might list a depth target for the corresponding pixel shader shader, or you could use frame analysis' dump_depth option to dump it out for that shader (vertex or pixel). You could also use frame analysis logging to check if there was a depth buffer assigned in the previous OMSetRenderTargets call.

Actually I want to copy it from a different shader like here:

...

But I am at a total loss... First of all:
- The hash can be of a vertex or pixel shader? or requires a special shader type?
Can be either.
- I don't understand this: "ResourceDepthBuffer = ps-t0" who is t0? Is it texture target zero? Do I need to use the Frame Analysis for this?
Yes, t0 is texture target/slot 0. If the pixel shader has headers the best bet is to check it since it will have a name so you can check which t register it's in. ShaderUsage.txt will list these, but it might be hard to tell which is the depth buffer. Dumping out the textures with frame analysis will tell you this as well, but depth buffer formats are among those that DirectTK doesn't support for conversion to jpeg, so you will have to dump them out as dds.

I have used the ShaderUsage file and I got this:

...

This is the pixel shader used by the HUD vertex shader (that I want to correct). I looked at the vertex shader and don't see a <DepthTarget handle=0000000013F766D0>a98c980a</DepthTarget> bound there...
ShaderUsage.txt only lists depth targets on pixel shaders, but the depth target is bound separately from shaders, so if you see it in the pixel shader you can assume it also applies to the corresponding vertex shader.

But for example I want to use a shader like this (that has the DepthTarget bound) to copy the Depth Buffer. How exactly do I go on about it?
Do I need to go inside the shader and generate an output variable and then put the DepthTexture inside or??

No need to edit the shader (and unlike Helix Mod you don't even need to ship the shader), you can copy the depth buffer via an intermediate resource like:
[ResourceDepthBuffer]

[ShaderOverrideLights]
hash = foo
ResourceDepthBuffer = oD

[ShaderOverrideCrosshair]
hash = bar
vs-t110 = ResourceDepthBuffer


Note that when copying a depth buffer from an oD slot you *must* have at least one full copy (which it will by default) - this is because the bind flags will be different, and so that 3DMigoto can convert the DXGI format into something that can be used in a texture slot).


Edit:

I was wondering if I can use a shader that defines this:
SamplerComparisonState SamplerGenericShadowCompare_s : register(s14);
Texture2D<float4> DepthBufferTexture_texture : register(t1);
Texture2D<float4> ShadowMapSampler_texture : register(t43);


where register t1 is basically the DepthBuffer Texture. I could then say something like this:
[ResourceDepthBuffer]
[ShaderOverrideShadow]

Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture
ResourceDepthBuffer = reference ps-t1

[ShaderOverrideCrosshair]
Hash = 0xFFFFF //VS hash code of the HUD
vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl


It should work no?
Looks right to me :)

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

Posted 02/03/2016 10:34 AM   
Big big thank you DarkStarSword! Damn this time difference is annoying;)) So, I am working on Rise of the Tomb Raider. I have added the above definitions in the d3dx.ini file (at the end) [code] [ResourceDepthBuffer] [ShaderOverrideShadow] Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture ResourceDepthBuffer = reference ps-t1 [ShaderOverrideCrosshair] Hash = 0xFFFFF //VS hash code of the HUD vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl [/code] and in the VS I have defined: [code] .... // Depth buffer copied to this input with 3Dmigoto: Texture2D<float> DepthBuffer : register(t110); .... [/code] I have copy-pasted the code of the function "adjust_from_depth_buffer()" inside the shader before "main()" ([url]https://forums.geforce.com/default/topic/685657/3d-vision/3dmigoto-now-open-source-/post/4694095/#4694095[/url]) At the end of the main() function, after o0 is calculated I do: [code] // HUD is 3D by default. // We want to make it 2D again o0.x -= separation * (o0.w - convergence); // Push the HUD in depth based on the depth buffer o0.x += adjust_from_depth_buffer(0, 0); [/code] Now the above code will push the crosshair at relative zero depth. If I do something like o0.x += adjust_from_depth_buffer(0, 0) * 100; I actually see that the hud is pushed into depth, so the result of the function is not zero but very very small... However, when I move the mouse around the depth of the HUD/crosshair never changes. Is always at the same fixed depth... The shader compiles and there aren't any issues in it, so is not like is skipped. So, I am wondering if either the Depth Buffer copy doesn't work or that I am doing something wrong... The depth buffer is not "resized to W". Could this be an issue? Can you see anything I might do wrong? Thank you in advance again!
Big big thank you DarkStarSword!

Damn this time difference is annoying;))

So, I am working on Rise of the Tomb Raider.
I have added the above definitions in the d3dx.ini file (at the end)

[ResourceDepthBuffer]
[ShaderOverrideShadow]

Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture
ResourceDepthBuffer = reference ps-t1

[ShaderOverrideCrosshair]
Hash = 0xFFFFF //VS hash code of the HUD
vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl


and in the VS I have defined:
....
// Depth buffer copied to this input with 3Dmigoto:
Texture2D<float> DepthBuffer : register(t110);
....


I have copy-pasted the code of the function "adjust_from_depth_buffer()" inside the shader before "main()"
(https://forums.geforce.com/default/topic/685657/3d-vision/3dmigoto-now-open-source-/post/4694095/#4694095)

At the end of the main() function, after o0 is calculated I do:
// HUD is 3D by default.
// We want to make it 2D again
o0.x -= separation * (o0.w - convergence);

// Push the HUD in depth based on the depth buffer
o0.x += adjust_from_depth_buffer(0, 0);


Now the above code will push the crosshair at relative zero depth. If I do something like
o0.x += adjust_from_depth_buffer(0, 0) * 100;
I actually see that the hud is pushed into depth, so the result of the function is not zero but very very small...

However, when I move the mouse around the depth of the HUD/crosshair never changes. Is always at the same fixed depth...
The shader compiles and there aren't any issues in it, so is not like is skipped.

So, I am wondering if either the Depth Buffer copy doesn't work or that I am doing something wrong...
The depth buffer is not "resized to W". Could this be an issue?

Can you see anything I might do wrong?

Thank you in advance again!

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)

Posted 02/03/2016 11:05 AM   
[quote="helifax"] At the end of the main() function, after o0 is calculated I do: [code] // HUD is 3D by default. // We want to make it 2D again o0.x -= separation * (o0.w - convergence); // Push the HUD in depth based on the depth buffer o0.x += adjust_from_depth_buffer(0, 0); [/code][/quote] Since you noted it was already 3D it's W value won't be 1, so you need to multiply the adjustment by o0.w to counter the perspective divide. [quote]However, when I move the mouse around the depth of the HUD/crosshair never changes. Is always at the same fixed depth... The shader compiles and there aren't any issues in it, so is not like is skipped. So, I am wondering if either the Depth Buffer copy doesn't work or that I am doing something wrong...[/quote] You should be able to use frame analysis to check that the depth buffer is in the slot you copied it to. Also check to see if there are any errors in the d3d11_log.txt (like failed to create a resource or view). [quote]The depth buffer is not "resized to W". Could this be an issue?[/quote]Definitely could be an issue - you need to adjust the code in the world_z_from_depth_buffer function to match the scaling that the specific game uses. Best to take a look at the lighting shaders to see what they do and replicate it (and if they use values from a constant buffer you may need to also copy in as well). For reference, here's FC4 (copied the CViewportShaderParameterProvider constant buffer from the same shader I copied the depth buffer from, which in this case was a dedicated shader that resolved the MSAA anti-aliased depth buffer into a non anti-aliased one): [code] float world_z_from_depth_buffer(float x, float y) { uint width, height; float z; ZBuffer.GetDimensions(width, height); x = min(max((x / 2 + 0.5) * width, 0), width - 1); y = min(max((-y / 2 + 0.5) * height, 0), height - 1); z = ZBuffer.Load(int3(x, y, 0)).x; // Z buffer scaling copied from the lighting shaders: float4 r0; r0.x = _DepthScale.y * z + _DepthScale.x; r0.x = 1.000000e+000 / r0.x; r0.y = _CameraDistances.x * _CameraDistances.y; r0.x = _CameraDistances.z * r0.x; return r0.x; } [/code] MGSV (copied the psScene constant buffer from the pixel shader. In this case the depth buffer was still assigned when the HUD was drawn so I copied it in directly): [code] float world_z_from_depth_buffer(float x, float y) { uint width, height; float z; ZBuffer.GetDimensions(width, height); x = min(max((x / 2 + 0.5) * width, 0), width - 1); y = min(max((-y / 2 + 0.5) * height, 0), height - 1); z = ZBuffer.Load(int3(x, y, 0)).x; // Z buffer scaling copied from the AO shader: return g_psScene.m_projectionParam.z / (-g_psScene.m_projectionParam.w + z); } [/code] Witcher 3 (I'm using the HBAO+ W-Buffer, so there is no scaling here): [code] float world_z_from_depth_buffer(float x, float y) { uint width, height; float w; WBuffer.GetDimensions(width, height); x = min(max((x / 2 + 0.5) * width, 0), width - 1); y = min(max((-y / 2 + 0.5) * height, 0), height - 1); w = WBuffer.Load(int3(x, y, 0)).x; return w; } [/code]
helifax said:
At the end of the main() function, after o0 is calculated I do:
// HUD is 3D by default.
// We want to make it 2D again
o0.x -= separation * (o0.w - convergence);

// Push the HUD in depth based on the depth buffer
o0.x += adjust_from_depth_buffer(0, 0);

Since you noted it was already 3D it's W value won't be 1, so you need to multiply the adjustment by o0.w to counter the perspective divide.

However, when I move the mouse around the depth of the HUD/crosshair never changes. Is always at the same fixed depth...
The shader compiles and there aren't any issues in it, so is not like is skipped.

So, I am wondering if either the Depth Buffer copy doesn't work or that I am doing something wrong...

You should be able to use frame analysis to check that the depth buffer is in the slot you copied it to. Also check to see if there are any errors in the d3d11_log.txt (like failed to create a resource or view).

The depth buffer is not "resized to W". Could this be an issue?
Definitely could be an issue - you need to adjust the code in the world_z_from_depth_buffer function to match the scaling that the specific game uses. Best to take a look at the lighting shaders to see what they do and replicate it (and if they use values from a constant buffer you may need to also copy in as well).

For reference, here's FC4 (copied the CViewportShaderParameterProvider constant buffer from the same shader I copied the depth buffer from, which in this case was a dedicated shader that resolved the MSAA anti-aliased depth buffer into a non anti-aliased one):
float world_z_from_depth_buffer(float x, float y)
{
uint width, height;
float z;

ZBuffer.GetDimensions(width, height);

x = min(max((x / 2 + 0.5) * width, 0), width - 1);
y = min(max((-y / 2 + 0.5) * height, 0), height - 1);
z = ZBuffer.Load(int3(x, y, 0)).x;

// Z buffer scaling copied from the lighting shaders:
float4 r0;
r0.x = _DepthScale.y * z + _DepthScale.x;
r0.x = 1.000000e+000 / r0.x;
r0.y = _CameraDistances.x * _CameraDistances.y;
r0.x = _CameraDistances.z * r0.x;
return r0.x;
}


MGSV (copied the psScene constant buffer from the pixel shader. In this case the depth buffer was still assigned when the HUD was drawn so I copied it in directly):
float world_z_from_depth_buffer(float x, float y)
{
uint width, height;
float z;

ZBuffer.GetDimensions(width, height);

x = min(max((x / 2 + 0.5) * width, 0), width - 1);
y = min(max((-y / 2 + 0.5) * height, 0), height - 1);
z = ZBuffer.Load(int3(x, y, 0)).x;

// Z buffer scaling copied from the AO shader:
return g_psScene.m_projectionParam.z / (-g_psScene.m_projectionParam.w + z);
}


Witcher 3 (I'm using the HBAO+ W-Buffer, so there is no scaling here):
float world_z_from_depth_buffer(float x, float y)
{
uint width, height;
float w;

WBuffer.GetDimensions(width, height);

x = min(max((x / 2 + 0.5) * width, 0), width - 1);
y = min(max((-y / 2 + 0.5) * height, 0), height - 1);
w = WBuffer.Load(int3(x, y, 0)).x;
return w;
}

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

Posted 02/03/2016 04:38 PM   
Hi DarkStarSword, Big thx for the information! Will have to test at home and see what and where it fails. Here is an idea that I have! In the pixel shader that I using to copy the depth buffer from I have the deptbuffer and the DepthToW vector. The code then Looks like this: [code] ...... SamplerComparisonState SamplerGenericShadowCompare_s : register(s14); Texture2D<float4> DepthBufferTexture_texture : register(t1); Texture2D<float4> ShadowMapSampler_texture : register(t43); ...... r0.xy = (int2)v0.xy; r0.zw = float2(0,0); r0.x = DepthBufferTexture_texture.Load(r0.xyz).x; r0.x = r0.x * DepthToW.x + DepthToW.y; r0.x = 1 / r0.x; [/code] Which basically scales it to W. I was wondering how can I export the result of r0.xy to a texture? (Obviously I will need to do the same for the r0.y as the above code): [code] r0.y = DepthBufferTexture_texture.Load(r0.xyz).y; r0.y = r0.y * DepthToW.x + DepthToW.y; r0.y = 1 / r0.y; [/code] Would defining [code] void main( float4 v0 : SV_POSITION0, out float o0 : SV_Target0, // define my own output out float2 o1: SV_Target1) { } [/code] and then in the ini file do: [code] [ResourceDepthBuffer] [ShaderOverrideShadow] Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture ResourceDepthBuffer = reference ps-o1 [ShaderOverrideCrosshair] Hash = 0xFFFFF //VS hash code of the HUD vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl [/code] Will this Work? Will it be enough? Or if The DepthToW is defined as: float4 DepthToW : packoffset(c20); can I export it somehow to my other shader? so I can scale the Depth buffer there? Big thanks in advance!
Hi DarkStarSword,

Big thx for the information! Will have to test at home and see what and where it fails.

Here is an idea that I have!
In the pixel shader that I using to copy the depth buffer from I have the deptbuffer and the DepthToW vector.
The code then Looks like this:

......
SamplerComparisonState SamplerGenericShadowCompare_s : register(s14);
Texture2D<float4> DepthBufferTexture_texture : register(t1);
Texture2D<float4> ShadowMapSampler_texture : register(t43);
......
r0.xy = (int2)v0.xy;
r0.zw = float2(0,0);
r0.x = DepthBufferTexture_texture.Load(r0.xyz).x;
r0.x = r0.x * DepthToW.x + DepthToW.y;
r0.x = 1 / r0.x;


Which basically scales it to W.
I was wondering how can I export the result of r0.xy to a texture? (Obviously I will need to do the same for the r0.y as the above code):
r0.y = DepthBufferTexture_texture.Load(r0.xyz).y;
r0.y = r0.y * DepthToW.x + DepthToW.y;
r0.y = 1 / r0.y;



Would defining
void main( 
float4 v0 : SV_POSITION0,
out float o0 : SV_Target0,
// define my own output
out float2 o1: SV_Target1)
{
}


and then in the ini file do:
[ResourceDepthBuffer]
[ShaderOverrideShadow]

Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture
ResourceDepthBuffer = reference ps-o1

[ShaderOverrideCrosshair]
Hash = 0xFFFFF //VS hash code of the HUD
vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl


Will this Work? Will it be enough?

Or if
The DepthToW is defined as:
float4 DepthToW : packoffset(c20);

can I export it somehow to my other shader? so I can scale the Depth buffer there?

Big thanks in advance!

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)

Posted 02/03/2016 05:19 PM   
Hi DarkStarSword, [quote] You should be able to use frame analysis to check that the depth buffer is in the slot you copied it to. Also check to see if there are any errors in the d3d11_log.txt (like failed to create a resource or view). [/quote] Can you please elaborate on what exactly I am loking for in the log? I looked a bit in it but I couldn't find any "failed" or "error" keywords;)) [s]I tried the Frame Analysis...but the game just freezes. It does generate a log and ShaderUsage but no screenshot files.[/s] Nevermind, I was able to actually get the Render Targets out as DDS files (needed another option in d3dx.ini)... Problem is, I didn't have Photoshop + Nvidia DDS plugin installed to actually see them ...sigh... In ShaderUsage I found my Pixel Shader from where I want to copy the Depth: [code] <PixelShader hash="352f8c90728029d0"> <ParentVertexShaders>d8e150f3404cd450 </ParentVertexShaders> <Register id=1 handle=000000001DA0A590>a98c980a</Register> <Register id=3 handle=000000003E721410>2bbdef47</Register> <Register id=3 handle=000000003E721890>2179cf54</Register> <Register id=3 handle=000000005D086850>86455955</Register> <Register id=4 handle=000000001DA0A590>a98c980a</Register> <Register id=5 handle=000000001B846450>94ba8024</Register> <Register id=5 handle=000000005D5D81D0>267e24af</Register> <Register id=6 handle=000000001BD3BD90>e3696c73</Register> <Register id=6 handle=000000022F61C0D0>57b20233</Register> <Register id=7 handle=000000001BBFE190>544e3e4a</Register> <Register id=7 handle=00000000429EFC10>d57e90e7</Register> <Register id=8 handle=0000000131018590>ff48067c</Register> <Register id=8 handle=000000022F61BC50>0e0c7f3a</Register> <Register id=9 handle=000000003E721650>4bcf8033</Register> <Register id=9 handle=000000005D086850>86455955</Register> <Register id=10 handle=000000003E7211D0>df56f506</Register> <Register id=10 handle=000000022F184B90>48f74480</Register> <Register id=11 handle=000000003E721410>2bbdef47</Register> <Register id=11 handle=000000022F61B5D0>664a45be</Register> <Register id=12 handle=00000001310189D0>4ab3f920</Register> <Register id=12 handle=000000022F61BA10>e479d2a9</Register> <Register id=13 handle=000000003E7211D0>df56f506</Register> <Register id=13 handle=00000001310189D0>4ab3f920</Register> <Register id=14 handle=000000001B845FD0>0ebed21f</Register> <Register id=14 handle=000000003E7211D0>df56f506</Register> <Register id=15 handle=00000000429EFC10>d57e90e7</Register> <Register id=15 handle=0000000225B34E90>b3e58c07</Register> <Register id=16 handle=000000001B845DD0>084688a2</Register> <Register id=16 handle=000000013F1036D0>596044c5</Register> <Register id=17 handle=000000001BD3BD90>e3696c73</Register> <Register id=18 handle=000000001BD3C210>94ba8024</Register> <Register id=19 handle=000000001BD3BFD0>9cde57de</Register> <Register id=20 handle=000000003E721410>2bbdef47</Register> <Register id=21 handle=000000013F10C2D0>8caae005</Register> <Register id=22 handle=000000013F0DEED0>94ba8024</Register> <Register id=23 handle=000000006BFDB910>300abbc8</Register> <Register id=24 handle=000000022F17ABD0>3b0077ad</Register> <Register id=25 handle=000000013F10C2D0>8caae005</Register> <Register id=26 handle=000000022F17A9D0>e621a83b</Register> <Register id=27 handle=000000013F10C2D0>8caae005</Register> <Register id=43 handle=000000006C1FFD50>2df04740</Register> <Register id=44 handle=0000000009E6CC10 hash_contaminated=true>dc7e5674</Register> <Register id=54 handle=0000000009E6C790>00000000</Register> <Register id=56 handle=0000000009CCD190>873be7b9</Register> <Register id=57 handle=0000000009CCD3D0 hash_contaminated=true>18911d61</Register> <Register id=120 handle=000000000646CB10>00000000</Register> <Register id=125 handle=000000000620A3D0>00000000</Register> <RenderTarget id=0 handle=000000001DB10550>588e2a7e</RenderTarget> <RenderTarget id=0 handle=00000001046346D0>588e2a7e</RenderTarget> <DepthTarget handle=000000001DA0A590>a98c980a</DepthTarget> </PixelShader> [/code] and the vertex shader where I want to copy the depth: [code] <VertexShader hash="b65139cd6130cd09"> <CalledPixelShaders>3020ae9d794bc65e </CalledPixelShaders> <Register id=0 handle=000000005D085290>b2231c41</Register> <Register id=41 handle=000000006C1FFD50>2df04740</Register> <Register id=42 handle=0000000009E6CC10 hash_contaminated=true>dc7e5674</Register> <Register id=43 handle=0000000009E6C790>00000000</Register> <Register id=44 handle=0000000009CCD3D0 hash_contaminated=true>18911d61</Register> <Register id=45 handle=0000000009CCD190>873be7b9</Register> <Register id=49 handle=0000000009D984D0>00000000</Register> <Register id=110 handle=00000001046344D0>00000000</Register> <Register id=120 handle=000000000646CB10>00000000</Register> <Register id=125 handle=000000000620A3D0>00000000</Register> </VertexShader> [/code] But I can't see under id=110 any value... Does this means the depth buffer is not copied? Thanks in advance! Cheers! I am not sure if I don't do anything wrong... I can send the full logs if you think they help!
Hi DarkStarSword,



You should be able to use frame analysis to check that the depth buffer is in the slot you copied it to. Also check to see if there are any errors in the d3d11_log.txt (like failed to create a resource or view).


Can you please elaborate on what exactly I am loking for in the log? I looked a bit in it but I couldn't find any "failed" or "error" keywords;))

I tried the Frame Analysis...but the game just freezes. It does generate a log and ShaderUsage but no screenshot files.
Nevermind, I was able to actually get the Render Targets out as DDS files (needed another option in d3dx.ini)... Problem is, I didn't have Photoshop + Nvidia DDS plugin installed to actually see them ...sigh...

In ShaderUsage I found my Pixel Shader from where I want to copy the Depth:
<PixelShader hash="352f8c90728029d0">
<ParentVertexShaders>d8e150f3404cd450 </ParentVertexShaders>
<Register id=1 handle=000000001DA0A590>a98c980a</Register>
<Register id=3 handle=000000003E721410>2bbdef47</Register>
<Register id=3 handle=000000003E721890>2179cf54</Register>
<Register id=3 handle=000000005D086850>86455955</Register>
<Register id=4 handle=000000001DA0A590>a98c980a</Register>
<Register id=5 handle=000000001B846450>94ba8024</Register>
<Register id=5 handle=000000005D5D81D0>267e24af</Register>
<Register id=6 handle=000000001BD3BD90>e3696c73</Register>
<Register id=6 handle=000000022F61C0D0>57b20233</Register>
<Register id=7 handle=000000001BBFE190>544e3e4a</Register>
<Register id=7 handle=00000000429EFC10>d57e90e7</Register>
<Register id=8 handle=0000000131018590>ff48067c</Register>
<Register id=8 handle=000000022F61BC50>0e0c7f3a</Register>
<Register id=9 handle=000000003E721650>4bcf8033</Register>
<Register id=9 handle=000000005D086850>86455955</Register>
<Register id=10 handle=000000003E7211D0>df56f506</Register>
<Register id=10 handle=000000022F184B90>48f74480</Register>
<Register id=11 handle=000000003E721410>2bbdef47</Register>
<Register id=11 handle=000000022F61B5D0>664a45be</Register>
<Register id=12 handle=00000001310189D0>4ab3f920</Register>
<Register id=12 handle=000000022F61BA10>e479d2a9</Register>
<Register id=13 handle=000000003E7211D0>df56f506</Register>
<Register id=13 handle=00000001310189D0>4ab3f920</Register>
<Register id=14 handle=000000001B845FD0>0ebed21f</Register>
<Register id=14 handle=000000003E7211D0>df56f506</Register>
<Register id=15 handle=00000000429EFC10>d57e90e7</Register>
<Register id=15 handle=0000000225B34E90>b3e58c07</Register>
<Register id=16 handle=000000001B845DD0>084688a2</Register>
<Register id=16 handle=000000013F1036D0>596044c5</Register>
<Register id=17 handle=000000001BD3BD90>e3696c73</Register>
<Register id=18 handle=000000001BD3C210>94ba8024</Register>
<Register id=19 handle=000000001BD3BFD0>9cde57de</Register>
<Register id=20 handle=000000003E721410>2bbdef47</Register>
<Register id=21 handle=000000013F10C2D0>8caae005</Register>
<Register id=22 handle=000000013F0DEED0>94ba8024</Register>
<Register id=23 handle=000000006BFDB910>300abbc8</Register>
<Register id=24 handle=000000022F17ABD0>3b0077ad</Register>
<Register id=25 handle=000000013F10C2D0>8caae005</Register>
<Register id=26 handle=000000022F17A9D0>e621a83b</Register>
<Register id=27 handle=000000013F10C2D0>8caae005</Register>
<Register id=43 handle=000000006C1FFD50>2df04740</Register>
<Register id=44 handle=0000000009E6CC10 hash_contaminated=true>dc7e5674</Register>
<Register id=54 handle=0000000009E6C790>00000000</Register>
<Register id=56 handle=0000000009CCD190>873be7b9</Register>
<Register id=57 handle=0000000009CCD3D0 hash_contaminated=true>18911d61</Register>
<Register id=120 handle=000000000646CB10>00000000</Register>
<Register id=125 handle=000000000620A3D0>00000000</Register>
<RenderTarget id=0 handle=000000001DB10550>588e2a7e</RenderTarget>
<RenderTarget id=0 handle=00000001046346D0>588e2a7e</RenderTarget>
<DepthTarget handle=000000001DA0A590>a98c980a</DepthTarget>
</PixelShader>


and the vertex shader where I want to copy the depth:
<VertexShader hash="b65139cd6130cd09">
<CalledPixelShaders>3020ae9d794bc65e </CalledPixelShaders>
<Register id=0 handle=000000005D085290>b2231c41</Register>
<Register id=41 handle=000000006C1FFD50>2df04740</Register>
<Register id=42 handle=0000000009E6CC10 hash_contaminated=true>dc7e5674</Register>
<Register id=43 handle=0000000009E6C790>00000000</Register>
<Register id=44 handle=0000000009CCD3D0 hash_contaminated=true>18911d61</Register>
<Register id=45 handle=0000000009CCD190>873be7b9</Register>
<Register id=49 handle=0000000009D984D0>00000000</Register>
<Register id=110 handle=00000001046344D0>00000000</Register>
<Register id=120 handle=000000000646CB10>00000000</Register>
<Register id=125 handle=000000000620A3D0>00000000</Register>
</VertexShader>


But I can't see under id=110 any value... Does this means the depth buffer is not copied?

Thanks in advance!
Cheers!

I am not sure if I don't do anything wrong... I can send the full logs if you think they help!

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)

Posted 02/03/2016 07:29 PM   
[quote="helifax"]and the vertex shader where I want to copy the depth: [code] <snip> <Register id=110 handle=00000001046344D0>00000000</Register> [/code] But I can't see under id=110 any value... Does this means the depth buffer is not copied?[/quote]That looks fine - just the fact that you are seeing something show up with id=110 means there is something there. The hash is 0 because 3DMigoto doesn't generate hashes for any resources it created itself at the moment (it used to, but had some problems - if anyone needs these to be hashed for whatever reason I can re-add it and try to solve those problems). [quote="helifax"]I was wondering how can I export the result of r0.xy to a texture? (Obviously I will need to do the same for the r0.y as the above code):[/quote]It is possible (Oomek has been trying this in his mod), but I wouldn't recommend attempting this yet because there are still some missing pieces (setting the OM blend state and arbitrary resource creation - currently you have to copy an existing resource and hope that the OM state the game has set will work). [quote]Would defining <snip> and then in the ini file do: [code] [ResourceDepthBuffer] [ShaderOverrideShadow] Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture ResourceDepthBuffer = reference ps-o1 [ShaderOverrideCrosshair] Hash = 0xFFFFF //VS hash code of the HUD vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl [/code] Will this Work? Will it be enough?[/quote]This is along the right lines, but the line in the shadow shader would need to be the other way around (o1 = reference ResourceDepthBuffer, because there is no resource in the o1 slot, so you have to assign the ResourceDepthBuffer to it), and you would then need to create the ResourceDepthBuffer separately and ensure that it is compatible with other simultaneous render targets (e.g. by making it a full copy of o0). If you went down this path you should also make sure you unbind it after the draw calls to make sure it won't be assigned as an input and output simultaneously (post o1 = null, post ps-t110 = null). But, because we can't currently set the OM blend state you would be at the mercy of the game setting it to something usable, and you would also have to make sure that you are writing that from a full screen shadow shader. [quote]Or if The DepthToW is defined as: float4 DepthToW : packoffset(c20); can I export it somehow to my other shader? so I can scale the Depth buffer there? Big thanks in advance! [/quote]Yes, this is what I do. You don't export that single value, instead look at what constant buffer it is in and find the register(b0) (or whatever b register it is in) and add something like this [code] [ResourceConstantBuffer] [ShaderOverrideShadow] Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture ResourceDepthBuffer = reference ps-t1 ResourceConstantBuffer = ps-cb0 // or whatever b register it was in [ShaderOverrideCrosshair] vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl vs-cb13 = ResourceConstantBuffer [/code] Then also copy the HLSL definition of the constant buffer into the shader and change it's register to b13. NOTE: Don't try to copy it into vs-cb12! I wasted hours trying to work out why it wasn't working when I used that, and it turns out that vs-cb12 is used by the 3D Vision driver to pass the separation and convergence settings in for any shader it is stereoising. btw are you using those // comments in the ini file, or is that just for posting here? The only correct way to comment an ini file is with the ; character at the very start of the line. If those comments work, it will only be because 3DMigoto stopped parsing the line before it got to them and didn't check if there was any more characters that it hadn't parsed yet (which is technically a bug). That might work for some settings by luck, but won't work for all - I'd be surprised if that was working on any line that ends with "ResourceDepthBuffer", because that would make it look for a resource called "ResourceDepthBuffer // This needs to be...", but it should make a boop sound and issue a warning in the log file when it can't find it.
helifax said:and the vertex shader where I want to copy the depth:
<snip>
<Register id=110 handle=00000001046344D0>00000000</Register>


But I can't see under id=110 any value... Does this means the depth buffer is not copied?
That looks fine - just the fact that you are seeing something show up with id=110 means there is something there. The hash is 0 because 3DMigoto doesn't generate hashes for any resources it created itself at the moment (it used to, but had some problems - if anyone needs these to be hashed for whatever reason I can re-add it and try to solve those problems).
helifax said:I was wondering how can I export the result of r0.xy to a texture? (Obviously I will need to do the same for the r0.y as the above code):
It is possible (Oomek has been trying this in his mod), but I wouldn't recommend attempting this yet because there are still some missing pieces (setting the OM blend state and arbitrary resource creation - currently you have to copy an existing resource and hope that the OM state the game has set will work).

Would defining
<snip>
and then in the ini file do:
[ResourceDepthBuffer]
[ShaderOverrideShadow]

Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture
ResourceDepthBuffer = reference ps-o1

[ShaderOverrideCrosshair]
Hash = 0xFFFFF //VS hash code of the HUD
vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl


Will this Work? Will it be enough?
This is along the right lines, but the line in the shadow shader would need to be the other way around (o1 = reference ResourceDepthBuffer, because there is no resource in the o1 slot, so you have to assign the ResourceDepthBuffer to it), and you would then need to create the ResourceDepthBuffer separately and ensure that it is compatible with other simultaneous render targets (e.g. by making it a full copy of o0). If you went down this path you should also make sure you unbind it after the draw calls to make sure it won't be assigned as an input and output simultaneously (post o1 = null, post ps-t110 = null).

But, because we can't currently set the OM blend state you would be at the mercy of the game setting it to something usable, and you would also have to make sure that you are writing that from a full screen shadow shader.

Or if
The DepthToW is defined as:
float4 DepthToW : packoffset(c20);

can I export it somehow to my other shader? so I can scale the Depth buffer there?

Big thanks in advance!
Yes, this is what I do. You don't export that single value, instead look at what constant buffer it is in and find the register(b0) (or whatever b register it is in) and add something like this
[ResourceConstantBuffer]
[ShaderOverrideShadow]
Hash = 0xFFFFFF // whatever HASH of the PIxel shader that has the Depth Buffer texture
ResourceDepthBuffer = reference ps-t1
ResourceConstantBuffer = ps-cb0 // or whatever b register it was in

[ShaderOverrideCrosshair]
vs-t110 = ResourceDepthBuffer // This needs to be the same as is used by the crosshair.hlsl
vs-cb13 = ResourceConstantBuffer


Then also copy the HLSL definition of the constant buffer into the shader and change it's register to b13.

NOTE: Don't try to copy it into vs-cb12! I wasted hours trying to work out why it wasn't working when I used that, and it turns out that vs-cb12 is used by the 3D Vision driver to pass the separation and convergence settings in for any shader it is stereoising.


btw are you using those // comments in the ini file, or is that just for posting here? The only correct way to comment an ini file is with the ; character at the very start of the line. If those comments work, it will only be because 3DMigoto stopped parsing the line before it got to them and didn't check if there was any more characters that it hadn't parsed yet (which is technically a bug). That might work for some settings by luck, but won't work for all - I'd be surprised if that was working on any line that ends with "ResourceDepthBuffer", because that would make it look for a resource called "ResourceDepthBuffer // This needs to be...", but it should make a boop sound and issue a warning in the log file when it can't find it.

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

Posted 02/03/2016 11:36 PM   
I will definitely need to read the above post a couple of times to fully understand it;)) but BIG BIG thanks for the help and explanation!!! No, in the actual ini file I use the ";" character! But because here the "[ code ]" section doesn't recognize it I use the "C" standard of comments which it seems to be pick up;) I am just trying to make the readability easier;) (I noticed that sometimes the website parser of the [ code] section gets confused ^_^) So, that means that the Depth Buffer IS copied;) That is awesome news;) I think I need to poke a bit more around there;) Is nothing really crucial (more of a self-test of understanding and wanting it to work properly, as the TR(2013) had the crosshair fixed at a certain depth anyway, which we can also see in the current TR:(Rise of), but yeah...really curious to make this one work ^_^). BIG Thank you again!
I will definitely need to read the above post a couple of times to fully understand it;)) but BIG BIG thanks for the help and explanation!!!

No, in the actual ini file I use the ";" character! But because here the "[ code ]" section doesn't recognize it I use the "C" standard of comments which it seems to be pick up;)
I am just trying to make the readability easier;) (I noticed that sometimes the website parser of the [ code] section gets confused ^_^)

So, that means that the Depth Buffer IS copied;) That is awesome news;) I think I need to poke a bit more around there;) Is nothing really crucial (more of a self-test of understanding and wanting it to work properly, as the TR(2013) had the crosshair fixed at a certain depth anyway, which we can also see in the current TR:(Rise of), but yeah...really curious to make this one work ^_^).

BIG Thank you again!

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)

Posted 02/04/2016 02:45 AM   
While hunting for a dodgy PS shader which after trying 1h to find I said to try and use the ShaderUsage.txt based on the VS... And I get this: [code] <VertexShader hash="5f7cc636837c2319"> <CalledPixelShaders></CalledPixelShaders> <Register id=0 handle=00000000458EC810>b2231c41</Register> <Register id=0 handle=00000000F398C050>217c9e8b</Register> <Register id=0 handle=0000000133762650>ba43b58c</Register> <Register id=42 handle=0000000014A8FD10 hash_contaminated=true>dc7e5674</Register> <Register id=43 handle=0000000014A8F8D0>00000000</Register> <Register id=44 handle=0000000014A8EB90 hash_contaminated=true>18911d61</Register> <Register id=45 handle=0000000014A8E990>873be7b9</Register> <Register id=49 handle=0000000014A4C250>00000000</Register> <Register id=110 handle=00000000172D8F50>00000000</Register> <Register id=120 handle=00000000092BD990>00000000</Register> <Register id=125 handle=000000000616D910>00000000</Register> </VertexShader> [/code] It says there is no Pixel Attached? but when I select the VS I clearly see a change... Could this be a bug??
While hunting for a dodgy PS shader which after trying 1h to find I said to try and use the ShaderUsage.txt based on the VS...

And I get this:
<VertexShader hash="5f7cc636837c2319">
<CalledPixelShaders></CalledPixelShaders>
<Register id=0 handle=00000000458EC810>b2231c41</Register>
<Register id=0 handle=00000000F398C050>217c9e8b</Register>
<Register id=0 handle=0000000133762650>ba43b58c</Register>
<Register id=42 handle=0000000014A8FD10 hash_contaminated=true>dc7e5674</Register>
<Register id=43 handle=0000000014A8F8D0>00000000</Register>
<Register id=44 handle=0000000014A8EB90 hash_contaminated=true>18911d61</Register>
<Register id=45 handle=0000000014A8E990>873be7b9</Register>
<Register id=49 handle=0000000014A4C250>00000000</Register>
<Register id=110 handle=00000000172D8F50>00000000</Register>
<Register id=120 handle=00000000092BD990>00000000</Register>
<Register id=125 handle=000000000616D910>00000000</Register>
</VertexShader>


It says there is no Pixel Attached? but when I select the VS I clearly see a change... Could this be a bug??

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)

Posted 02/04/2016 08:07 PM   
That could well be legitimate - Batman does that for occlusion culling tests causing geometry flickering before I tracked that down and stereoised the vertex shader (that will still do an early depth/stencil buffer test in the rasterizer). It would also be valid to skip the pixel shader for a pass writing vertex data to a "stream output" buffer, though 3DMigoto cannot currently intercept vertex or geometry shaders used for that purpose. Also, the OM blend state can be set to use 0 or 1 instead of the output from a pixel shader, so I assume in that case a pixel shader would not be needed to generate output. You can grab a frame analysis log and search for that vertex shader to see what the game is doing with it.
That could well be legitimate - Batman does that for occlusion culling tests causing geometry flickering before I tracked that down and stereoised the vertex shader (that will still do an early depth/stencil buffer test in the rasterizer). It would also be valid to skip the pixel shader for a pass writing vertex data to a "stream output" buffer, though 3DMigoto cannot currently intercept vertex or geometry shaders used for that purpose. Also, the OM blend state can be set to use 0 or 1 instead of the output from a pixel shader, so I assume in that case a pixel shader would not be needed to generate output.

You can grab a frame analysis log and search for that vertex shader to see what the game is doing with it.

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

Posted 02/05/2016 02:04 AM   
[quote="DarkStarSword"]That could well be legitimate - Batman does that for occlusion culling tests causing geometry flickering before I tracked that down and stereoised the vertex shader (that will still do an early depth/stencil buffer test in the rasterizer). It would also be valid to skip the pixel shader for a pass writing vertex data to a "stream output" buffer, though 3DMigoto cannot currently intercept vertex or geometry shaders used for that purpose. Also, the OM blend state can be set to use 0 or 1 instead of the output from a pixel shader, so I assume in that case a pixel shader would not be needed to generate output. You can grab a frame analysis log and search for that vertex shader to see what the game is doing with it.[/quote] Awesome info right there! After I posted there I was thinking exactly that! A stencil pre-pass would make sense not to use a Pixel Shader attached:) But I just wanted to share this information here and ask if anyone else saw something like this! Big thank you again DSS, helpful as always;)
DarkStarSword said:That could well be legitimate - Batman does that for occlusion culling tests causing geometry flickering before I tracked that down and stereoised the vertex shader (that will still do an early depth/stencil buffer test in the rasterizer). It would also be valid to skip the pixel shader for a pass writing vertex data to a "stream output" buffer, though 3DMigoto cannot currently intercept vertex or geometry shaders used for that purpose. Also, the OM blend state can be set to use 0 or 1 instead of the output from a pixel shader, so I assume in that case a pixel shader would not be needed to generate output.

You can grab a frame analysis log and search for that vertex shader to see what the game is doing with it.


Awesome info right there! After I posted there I was thinking exactly that! A stencil pre-pass would make sense not to use a Pixel Shader attached:) But I just wanted to share this information here and ask if anyone else saw something like this!

Big thank you again DSS, helpful as always;)

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)

Posted 02/05/2016 10:24 AM   
[center][size="L"][color="orange"]3DMigoto 1.2.28 is out:[/color][/size] [url]https://github.com/bo3b/3Dmigoto/releases/tag/1.2.28[/url][/center] This release adds numerous features used in The Witness, including some that have been long awaited for other games: - Adds options to [Resource] sections to allow custom resources to be created from scratch, or have their description overridden when creating by copying another resource. Options include type (Buffer, ByteAddressBuffer, Texture1D, Texture2D, Texture3D, TextureCube), format (use the DXGI_FORMAT name), width, height, depth, mips, array (generally specify 1), msaa (generally specify 1), msaa_quality, byte_width (for buffers, alternatively use array to specify the number of elements and 3DMigoto will work this out), stride (for structured buffers). If a resource fails to be created an error will be shown in the log including the resource description 3DMigoto tried to use. This feature is only lightly tested so far (to override a format during a copy) and may have bugs. - Adds a copy_description copy mode to create (or update if necessary) a resource to match another resource's description without performing a full copy. This is a better way to create a resource to use as a simultaneous render target (replaces the old hack of copying o0), possibly in conjunction with the above ability to override the format if required. Note that it will not clear the resource and the only way clear these is currently by injecting a custom shader to do the job - The Witness has an example of this. - Changes how resource formats are handled internally in custom resource copying to solve some edge cases related to depth/stencil buffers and certain MSAA resources. This is a significant rework as I had to reimplement a large amount of code that previously DX was doing for us to solve these edge cases, so there is a chance that this might have introduced a regression - if you are using arbitrary resource copying, please test this version to check if it is still working. - Added a model= option to ShaderOverride sections to allow the shader model to be overridden. model=vs_5_0 allows the use of Texture2DMS (MSAA textures) in a vertex shader - necessary to use the auto crosshair if the depth buffer is MSAA (note that the stereo2mono version of the auto crosshair does not work with MSAA resources, which would need to be resolved into a non-MSAA resource first. Also note that the regular auto crosshair also needed some minor changes to work with MSAA depth buffers). - Added a draw=from_caller mode to [CustomShader] sections. This will call whichever draw operation the game did (except for DrawAuto or any of the Indirect or Dispatch calls) with the same parameters. This provides a convenient way to inject a shader that renders the same geometry as the shader it is tied to. This is used in The Witness to render depth information for certain geometry (certain puzzles that render with the depth buffer in read-only mode) to a custom render target without the risk of using the game's current OM blend state for a simultaneous render target, and to allow the use of render targets that may not be compatible with other simultaneous render targets. - Hooks SetWindowPos and disables it while forcing full screen (as this call can switch a game to borderless window) - Numerous other small fixes.


This release adds numerous features used in The Witness, including some that have been long awaited for other games:

- Adds options to [Resource] sections to allow custom resources to be created from scratch, or have their description overridden when creating by copying another resource. Options include type (Buffer, ByteAddressBuffer, Texture1D, Texture2D, Texture3D, TextureCube), format (use the DXGI_FORMAT name), width, height, depth, mips, array (generally specify 1), msaa (generally specify 1), msaa_quality, byte_width (for buffers, alternatively use array to specify the number of elements and 3DMigoto will work this out), stride (for structured buffers). If a resource fails to be created an error will be shown in the log including the resource description 3DMigoto tried to use. This feature is only lightly tested so far (to override a format during a copy) and may have bugs.

- Adds a copy_description copy mode to create (or update if necessary) a resource to match another resource's description without performing a full copy. This is a better way to create a resource to use as a simultaneous render target (replaces the old hack of copying o0), possibly in conjunction with the above ability to override the format if required. Note that it will not clear the resource and the only way clear these is currently by injecting a custom shader to do the job - The Witness has an example of this.

- Changes how resource formats are handled internally in custom resource copying to solve some edge cases related to depth/stencil buffers and certain MSAA resources. This is a significant rework as I had to reimplement a large amount of code that previously DX was doing for us to solve these edge cases, so there is a chance that this might have introduced a regression - if you are using arbitrary resource copying, please test this version to check if it is still working.

- Added a model= option to ShaderOverride sections to allow the shader model to be overridden. model=vs_5_0 allows the use of Texture2DMS (MSAA textures) in a vertex shader - necessary to use the auto crosshair if the depth buffer is MSAA (note that the stereo2mono version of the auto crosshair does not work with MSAA resources, which would need to be resolved into a non-MSAA resource first. Also note that the regular auto crosshair also needed some minor changes to work with MSAA depth buffers).

- Added a draw=from_caller mode to [CustomShader] sections. This will call whichever draw operation the game did (except for DrawAuto or any of the Indirect or Dispatch calls) with the same parameters. This provides a convenient way to inject a shader that renders the same geometry as the shader it is tied to. This is used in The Witness to render depth information for certain geometry (certain puzzles that render with the depth buffer in read-only mode) to a custom render target without the risk of using the game's current OM blend state for a simultaneous render target, and to allow the use of render targets that may not be compatible with other simultaneous render targets.

- Hooks SetWindowPos and disables it while forcing full screen (as this call can switch a game to borderless window)

- Numerous other small fixes.

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

Posted 02/06/2016 10:59 PM   
Oo...AWESOME WORK !!! Lots of awesome features right there!!!!
Oo...AWESOME WORK !!! Lots of awesome features right there!!!!

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)

Posted 02/06/2016 11:30 PM   
Would it be possible to add some switch which would allow 3DM to load precompiled shaders even if all the hlsl files were deleted?
Would it be possible to add some switch which would allow 3DM to load precompiled shaders even if all the hlsl files were deleted?

EVGA GeForce GTX 980 SC
Core i5 2500K
MSI Z77A-G45
8GB DDR3
Windows 10 x64

Posted 02/07/2016 01:08 PM   
Hi DarkStarSword, I was wondering if there a way to copy the Depth Buffer from the current Frame without specifying a HASH from which shader to copy? I am asking this since the shader I found seems to only work in some scenarios and not all the time...(man this game loves loading/unloading shaders...)...
Hi DarkStarSword,

I was wondering if there a way to copy the Depth Buffer from the current Frame without specifying a HASH from which shader to copy?

I am asking this since the shader I found seems to only work in some scenarios and not all the time...(man this game loves loading/unloading shaders...)...

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)

Posted 02/07/2016 01:58 PM   
Hi DarkStarSword, I found a new problems with DCS 3DMigoto dump a shader than can not be reloaded. Here are the related messages in d3d11_log.txt [code]> reloading *_replace.txt fixes from ShaderFixes >Replacement shader found. Re-Loading replacement HLSL code from bde6ae27805227a2-vs_replace.txt Reload source code loaded. Size = 7952 compiling replacement HLSL code with shader model vs_4_0 compile result for replacement HLSL shader: 80004005 --------------------------------------------- BEGIN --------------------------------------------- D:\jeux\DCS World\wrapper1349(43,18-25): error X3000: syntax error: unexpected token 'lensData' ---------------------------------------------- END ----------------------------------------------[/code] and the faulty shader is [url=http://www.mediafire.com/view/t36cb6r4gd4aocw/bde6ae27805227a2-vs_replace.txt]here[/url] I had to comment the lines [code]StructuredBuffer<lensData> lensData : register(t0);[/code] and [code]// Known bad code for instruction (needs manual fix): ld_structured r1.x, l(0), l(0), t0.xxxx r1.x = lensData[]..swiz;[/code] and set r.1.x to 1 (arbitrary) in order to be able to fix and load this shader, but there is a drawback: the HDR effect is seen through cockpit frame... Is there a way to improve the reading of shader by 3Dmigoto ? By the way, it seems also that some shaders can not be dumped. Here is the log when I try to dump it: [code]*** Overlay call CoInitializeEx failed: -2147417850 StereoScreenShot on Mark: D:\jeux\DCS World 2 OpenAlpha\bin\ShaderFixes\1ebdb3925859d5f6-vs.jps, result: 0 creating HLSL representation. ******* Exception caught while decompiling shader ****** error while decompiling. > FAILED to copy Marked shader to ShaderFixes[/code]
Hi DarkStarSword,
I found a new problems with DCS
3DMigoto dump a shader than can not be reloaded. Here are the related messages in d3d11_log.txt
> reloading *_replace.txt fixes from ShaderFixes
>Replacement shader found. Re-Loading replacement HLSL code from bde6ae27805227a2-vs_replace.txt
Reload source code loaded. Size = 7952
compiling replacement HLSL code with shader model vs_4_0
compile result for replacement HLSL shader: 80004005
--------------------------------------------- BEGIN ---------------------------------------------
D:\jeux\DCS World\wrapper1349(43,18-25): error X3000: syntax error: unexpected token 'lensData'
---------------------------------------------- END ----------------------------------------------

and the faulty shader is here
I had to comment the lines
StructuredBuffer<lensData> lensData : register(t0);
and
// Known bad code for instruction (needs manual fix):
ld_structured r1.x, l(0), l(0), t0.xxxx
r1.x = lensData[]..swiz;
and set r.1.x to 1 (arbitrary) in order to be able to fix and load this shader, but there is a drawback: the HDR effect is seen through cockpit frame...
Is there a way to improve the reading of shader by 3Dmigoto ?

By the way, it seems also that some shaders can not be dumped. Here is the log when I try to dump it:
*** Overlay call CoInitializeEx failed: -2147417850 
StereoScreenShot on Mark: D:\jeux\DCS World 2 OpenAlpha\bin\ShaderFixes\1ebdb3925859d5f6-vs.jps, result: 0
creating HLSL representation.
******* Exception caught while decompiling shader ******
error while decompiling.
> FAILED to copy Marked shader to ShaderFixes

Posted 02/07/2016 04:09 PM   
  54 / 141    
Scroll To Top