Dark Souls 2 Scholar of the First Sin Direct X11 version
  3 / 7    
[quote="masterotaku"]Sorry for taking so long. The most recent version with everything included is here: https://www.dropbox.com/s/q7rb6ieoyce6yh0/DarkSouls2SotFS_fix_1.2.7z?dl=0 New things compared to the very first fix version: - The fire heatwave and other effects related to it are fixed! (fc32d667bf08bba1-vs_replace.txt) Examples are when you teleport or when you turn on a bonfire for the first time. But there's a drawback: you need to have 3D separation at 88% tops for the effect to be perfect after some distance. I don't know why, but there's a very slight deviation that comes into effect at very extreme (and unplayable) convergence values or after the object is at around 15~20 meters of virtual distance. Turning depth down to 88% makes it look correct at all times. - HUD at configurable depth, cycling through 5 settings by pressing F2. - Some lighting improved (0b9a4f4bd9c5b45a-vs_replace.txt). I made one exception of the fix to one pixel shader, so I don't make it worse while improving other things. There's still some monoscopic lighting in some locations. I didn't manage to fix that yet. - For character shadows, I divided the current shader fix intention by convergence. It made the shadows a bit more bearable, but they are still bad and not recommended. I'm still not done with the game yet. I'll try to fix the sun rays, for example (it's disabled right now). It's something I successfully fixed in Shadow Warrior so I hope this is similar. I know the vertex shader hash but I didn't manage to dump it, although I didn't try for more than a few minutes. Maybe tomorrow. By the way, I tried to do some texture overriding, but with zero results. What's the hash? The 8 hexadecimal digit value of the registers, or the handle, or both combined? Edit: the fix is using the latest 3Dmigoto from two days ago, of course.[/quote] Awesome, thanks for improving this! For the Texture Hash it will now be an 8 digit Hex value, by itself. Any version of 3Dmigoto from the 1.2 branch. The change in 1.2 is incompatible with older versions, so if you hunted it before on an earlier version, they will no longer match. For the shadows, please post the shaders here, and we can take a look and make suggestions.
masterotaku said:Sorry for taking so long. The most recent version with everything included is here:

https://www.dropbox.com/s/q7rb6ieoyce6yh0/DarkSouls2SotFS_fix_1.2.7z?dl=0


New things compared to the very first fix version:

- The fire heatwave and other effects related to it are fixed! (fc32d667bf08bba1-vs_replace.txt) Examples are when you teleport or when you turn on a bonfire for the first time. But there's a drawback: you need to have 3D separation at 88% tops for the effect to be perfect after some distance. I don't know why, but there's a very slight deviation that comes into effect at very extreme (and unplayable) convergence values or after the object is at around 15~20 meters of virtual distance. Turning depth down to 88% makes it look correct at all times.

- HUD at configurable depth, cycling through 5 settings by pressing F2.

- Some lighting improved (0b9a4f4bd9c5b45a-vs_replace.txt). I made one exception of the fix to one pixel shader, so I don't make it worse while improving other things. There's still some monoscopic lighting in some locations. I didn't manage to fix that yet.

- For character shadows, I divided the current shader fix intention by convergence. It made the shadows a bit more bearable, but they are still bad and not recommended.



I'm still not done with the game yet. I'll try to fix the sun rays, for example (it's disabled right now). It's something I successfully fixed in Shadow Warrior so I hope this is similar. I know the vertex shader hash but I didn't manage to dump it, although I didn't try for more than a few minutes. Maybe tomorrow.

By the way, I tried to do some texture overriding, but with zero results. What's the hash? The 8 hexadecimal digit value of the registers, or the handle, or both combined?

Edit: the fix is using the latest 3Dmigoto from two days ago, of course.

Awesome, thanks for improving this!

For the Texture Hash it will now be an 8 digit Hex value, by itself. Any version of 3Dmigoto from the 1.2 branch. The change in 1.2 is incompatible with older versions, so if you hunted it before on an earlier version, they will no longer match.


For the shadows, please post the shaders here, and we can take a look and make suggestions.

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

#31
Posted 10/22/2015 03:48 AM   
OK, I'll post them. But I'm at work right now so you'll have to wait between 9 and 11 hours. For now I'll say that there's a global objects/characters shadows vertex shader (included in the file I uploaded) and more detailed and long vertex shaders that control more individual things (armor parts, naked body, etc). With the last ones I could for example make the shadows thinner or fatter.
OK, I'll post them. But I'm at work right now so you'll have to wait between 9 and 11 hours.

For now I'll say that there's a global objects/characters shadows vertex shader (included in the file I uploaded) and more detailed and long vertex shaders that control more individual things (armor parts, naked body, etc). With the last ones I could for example make the shadows thinner or fatter.

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

#32
Posted 10/22/2015 07:41 AM   
Really glad to hear someone is working on this, good luck! I'll definitely use it when you're finished.
Really glad to hear someone is working on this, good luck! I'll definitely use it when you're finished.

#33
Posted 10/27/2015 03:57 PM   
Not at home right now (I forgot about uploading the shadows shaders, sorry), but I have something to say. It was a bad idea to divide by convergence the shadows vertex shader. That means that when you switch to 2D it divides by zero, and shadows disappear. Please, remove that "/convergence" from your shader. You'll know which one is looking at the first line ("character shadows outdoors" or something like that). Other than that, two days ago I made a bloom toggle with the F3 key. The effect is used by the game only sometimes and mildly. It isn't the annoying type. I keep it enabled personally. I found more areas with lighting and/or shadows at screen depth (same vertex shader as always, I think). I think I should try the newest 3Dmigoto features. They were used to fix bloom effects in Mad Max. I have to train myself more :p.
Not at home right now (I forgot about uploading the shadows shaders, sorry), but I have something to say.

It was a bad idea to divide by convergence the shadows vertex shader. That means that when you switch to 2D it divides by zero, and shadows disappear. Please, remove that "/convergence" from your shader. You'll know which one is looking at the first line ("character shadows outdoors" or something like that).

Other than that, two days ago I made a bloom toggle with the F3 key. The effect is used by the game only sometimes and mildly. It isn't the annoying type. I keep it enabled personally.

I found more areas with lighting and/or shadows at screen depth (same vertex shader as always, I think).

I think I should try the newest 3Dmigoto features. They were used to fix bloom effects in Mad Max. I have to train myself more :p.

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

#34
Posted 10/27/2015 06:06 PM   
Very good news for you all! Just a few minutes before going to sleep (I'm in my bed now) I fixed almost entirely the lighting (and as a consecuence the shadows it produces) that was at depth screen. I only had the time to test it in the Lost Bastille (the 3 bosses at one room) and the room of the dragon that is the final boss of the first DLC. I said almost entirely because it currently needs more or less 2.4 convergence. I'll probably manage to make it work at any setting, I hope. And I have to test more places. If I succeed, I'll release here the updated fix (this weekend). If I don't succeed, I'll post the shaders anyway and beg for some help :p. And in both cases, I have to post all the shadows shaders I can find.
Very good news for you all! Just a few minutes before going to sleep (I'm in my bed now) I fixed almost entirely the lighting (and as a consecuence the shadows it produces) that was at depth screen. I only had the time to test it in the Lost Bastille (the 3 bosses at one room) and the room of the dragon that is the final boss of the first DLC.

I said almost entirely because it currently needs more or less 2.4 convergence. I'll probably manage to make it work at any setting, I hope. And I have to test more places.

If I succeed, I'll release here the updated fix (this weekend). If I don't succeed, I'll post the shaders anyway and beg for some help :p. And in both cases, I have to post all the shadows shaders I can find.

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

#35
Posted 10/29/2015 11:18 PM   
Fantastic, that's great news!
Fantastic, that's great news!

#36
Posted 10/30/2015 12:11 PM   
Here it is: https://www.dropbox.com/s/yja0y2gnsdtpq0v/DS2_SOTFS_fix_1.3.7z?dl=0 What's new: - Lighting that was displayed at screen depth -> fixed. I feel very proud of this one. It was the most annoying problem of the game in 3D. Some examples of fixed areas: first room of Drangleic Castle, boss room before the 4th bonfire in Drangleic Castle, the centinels boss room in Lost Bastille, the final boss room of the first DLC, Doors of Pharros, the skeleton dragon room in Aldia's Keep, the cathedral of the 3rd DLC, and many more. It should work fine at every convergence setting you want, contrary to what I said in my previous post. - The green poison mist in Harvest Valley -> fixed. It was at screen depth previously, and now the effect covers its own surface. However, when you are inside the mist the effect changes to a different shader ("46853964568f213b-vs_replace.txt"). This one doesn't have depth itself (it's a fullscreen effect). If you place it at 50% depth (uncommenting the "//o0.x+=separation*0.5;" line), it will be more comfortable, but it will cut the left and right borders (this is like adding fake depth to a 3D movie), even if you are outside of the mist, somehow. - Black curse effect in one tower of Brume Tower -> fixed. It was at the wrong depth. I was lucky to catch this one, because it's in one of the DLC areas and after dissipating the curse the effect disappears until the next playthrough. Hotkeys: - F2 to cycle through HUD depth presets. Screen depth by default. - F3 to toggle bloom. Bloom is enabled by default. - F4 to toggle an experimental lighting fix. It makes getting near bonfires, torches and some other lighting better. By default it's like the depth gets wronger as you go near the light source, making a "Y" letter effect, if you know what I mean (like wanting to diverge to the infinite), and then it suddenly fixes itself when you are very close. With the fix, this bug is almost completely fixed (now there is just a little difference when the light changes its calculations), buuuuut there are drawbacks. Lights that were previously OK (like dropped items, the content of chests, or the light on the wall that leads to the tunnel to Heide's Tower) now have their outer limits cut off, and it gets worse at some distance, or even disappears. That's why it's experimental and optional. - F5 to use the 100% depth and 2.4 convergence setting. - F6 to use the 85% depth and 2.4 convergence setting. This one of for the fire heatwave effect. Any depth setting over this will have bugs. In case some of you didn't know, the depth % is different in absolute terms depending on your monitor size or if you use a projector. I use a 24" monitor (BenQ XL2411Z), for reference. Now I have something to ask you all about the sun rays pixel shader (the goal of the shader file is disabling the effect). The one I included is the one I needed after a sudden change ("dcca840946b49897-ps_replace.txt"). The one that worked before was "d86083b54efcc535-ps_replace.txt". Here it is in case you need it: https://www.dropbox.com/s/8pdyardu02dku85/d86083b54efcc535-ps_replace.txt?dl=0 Please, tell me if the one included in the fix works for you. To bo3b, the main shadows vertex shader is "e43b9b2d6333b956-vs_replace.txt". Content (you will now what lines I added. Just the stereoizing intention and the stereoparams variables): [code] //Characters and objects shadows. Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Position0, out float4 o1 : TEXCOORD0, out float4 o2 : TEXCOORD1) { float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; o0.xyzw = v0.xyzw; o1.xy = v1.xy; o2.xyzw = v0.xyzw; o2.x -= separation * (o2.w - convergence*0.22); return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // using 3Dmigoto v1.2.6 on Sun Nov 01 02:10:52 2015 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // POSITION 0 xyzw 0 NONE float xyzw // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float xyzw // TEXCOORD 0 xy 1 NONE float xy // TEXCOORD 1 xyzw 2 NONE float xyzw // vs_5_0 dcl_globalFlags refactoringAllowed dcl_input v0.xyzw dcl_input v1.xy dcl_output_siv o0.xyzw, position dcl_output o1.xy dcl_output o2.xyzw mov o0.xyzw, v0.xyzw mov o1.xy, v1.xyxx mov o2.xyzw, v0.xyzw ret // Approximately 4 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] With the "*0.22" multiplier I managed to make the feet of the shadow be glued to the character feet (I guess this won't be needed if someone stereoizes the shadows). Anyway, shadows are still incorrect. Their angle should change with depth but it doesn't. So they don't "stick" to the surface they are on. By the way, this time I've included the "profile.txt". Edit 9001: how can we make users that downloaded previous versions of the fix aware of these changes? This new version includes major improvements.
Here it is: https://www.dropbox.com/s/yja0y2gnsdtpq0v/DS2_SOTFS_fix_1.3.7z?dl=0

What's new:

- Lighting that was displayed at screen depth -> fixed. I feel very proud of this one. It was the most annoying problem of the game in 3D. Some examples of fixed areas: first room of Drangleic Castle, boss room before the 4th bonfire in Drangleic Castle, the centinels boss room in Lost Bastille, the final boss room of the first DLC, Doors of Pharros, the skeleton dragon room in Aldia's Keep, the cathedral of the 3rd DLC, and many more. It should work fine at every convergence setting you want, contrary to what I said in my previous post.
- The green poison mist in Harvest Valley -> fixed. It was at screen depth previously, and now the effect covers its own surface. However, when you are inside the mist the effect changes to a different shader ("46853964568f213b-vs_replace.txt"). This one doesn't have depth itself (it's a fullscreen effect). If you place it at 50% depth (uncommenting the "//o0.x+=separation*0.5;" line), it will be more comfortable, but it will cut the left and right borders (this is like adding fake depth to a 3D movie), even if you are outside of the mist, somehow.
- Black curse effect in one tower of Brume Tower -> fixed. It was at the wrong depth. I was lucky to catch this one, because it's in one of the DLC areas and after dissipating the curse the effect disappears until the next playthrough.

Hotkeys:

- F2 to cycle through HUD depth presets. Screen depth by default.
- F3 to toggle bloom. Bloom is enabled by default.
- F4 to toggle an experimental lighting fix. It makes getting near bonfires, torches and some other lighting better. By default it's like the depth gets wronger as you go near the light source, making a "Y" letter effect, if you know what I mean (like wanting to diverge to the infinite), and then it suddenly fixes itself when you are very close. With the fix, this bug is almost completely fixed (now there is just a little difference when the light changes its calculations), buuuuut there are drawbacks. Lights that were previously OK (like dropped items, the content of chests, or the light on the wall that leads to the tunnel to Heide's Tower) now have their outer limits cut off, and it gets worse at some distance, or even disappears. That's why it's experimental and optional.
- F5 to use the 100% depth and 2.4 convergence setting.
- F6 to use the 85% depth and 2.4 convergence setting. This one of for the fire heatwave effect. Any depth setting over this will have bugs. In case some of you didn't know, the depth % is different in absolute terms depending on your monitor size or if you use a projector. I use a 24" monitor (BenQ XL2411Z), for reference.


Now I have something to ask you all about the sun rays pixel shader (the goal of the shader file is disabling the effect). The one I included is the one I needed after a sudden change ("dcca840946b49897-ps_replace.txt"). The one that worked before was "d86083b54efcc535-ps_replace.txt". Here it is in case you need it: https://www.dropbox.com/s/8pdyardu02dku85/d86083b54efcc535-ps_replace.txt?dl=0

Please, tell me if the one included in the fix works for you.


To bo3b, the main shadows vertex shader is "e43b9b2d6333b956-vs_replace.txt".

Content (you will now what lines I added. Just the stereoizing intention and the stereoparams variables):

//Characters and objects shadows.
Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : POSITION0,
float2 v1 : TEXCOORD0,
out float4 o0 : SV_Position0,
out float4 o1 : TEXCOORD0,
out float4 o2 : TEXCOORD1)
{
float4 stereo = StereoParams.Load(0);
float separation = stereo.x;
float convergence = stereo.y;

o0.xyzw = v0.xyzw;
o1.xy = v1.xy;
o2.xyzw = v0.xyzw;
o2.x -= separation * (o2.w - convergence*0.22);
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// using 3Dmigoto v1.2.6 on Sun Nov 01 02:10:52 2015
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyzw 0 NONE float xyzw
// TEXCOORD 0 xy 1 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xy 1 NONE float xy
// TEXCOORD 1 xyzw 2 NONE float xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
mov o0.xyzw, v0.xyzw
mov o1.xy, v1.xyxx
mov o2.xyzw, v0.xyzw
ret
// Approximately 4 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


With the "*0.22" multiplier I managed to make the feet of the shadow be glued to the character feet (I guess this won't be needed if someone stereoizes the shadows). Anyway, shadows are still incorrect. Their angle should change with depth but it doesn't. So they don't "stick" to the surface they are on.


By the way, this time I've included the "profile.txt".

Edit 9001: how can we make users that downloaded previous versions of the fix aware of these changes? This new version includes major improvements.

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

#37
Posted 11/01/2015 08:40 PM   
Good stuff, that's a dramatic improvement for this game! If you want to get this up right away, probably contact oneup03 to bump the version again. We don't have any way of contacting or following people who have downloaded fixes. So, best we can do is to bump the page to the front of HelixModBlog, and bump a thread like this to get some attention that it's changed. Let's see if we can work out the shadow fix. If we can that will be a nice bump to this before posting it to the blog. The vertex shader there is not where the action will be. It's just doing a simple vertex pass through, not modifying the positions. We'll want to look at the Pixel Shader associated, which will be doing some sort of deferred rendering. Hunt for the PS for this effect. It's going to be unintuitive. You'll most likely find a shadow mask first, which makes the shadows disappear altogether, but that is not the actual shader we want. The actual shader will be associated with lights instead, and make the shadows disappear by killing the light. If you experiment around, you can probably find the right one, and we can try to fix it. Some notes on finding the right one: http://wiki.bo3b.net/index.php?title=Mike_notes
Good stuff, that's a dramatic improvement for this game! If you want to get this up right away, probably contact oneup03 to bump the version again.

We don't have any way of contacting or following people who have downloaded fixes. So, best we can do is to bump the page to the front of HelixModBlog, and bump a thread like this to get some attention that it's changed.


Let's see if we can work out the shadow fix. If we can that will be a nice bump to this before posting it to the blog.

The vertex shader there is not where the action will be. It's just doing a simple vertex pass through, not modifying the positions. We'll want to look at the Pixel Shader associated, which will be doing some sort of deferred rendering.

Hunt for the PS for this effect. It's going to be unintuitive. You'll most likely find a shadow mask first, which makes the shadows disappear altogether, but that is not the actual shader we want. The actual shader will be associated with lights instead, and make the shadows disappear by killing the light. If you experiment around, you can probably find the right one, and we can try to fix it. Some notes on finding the right one: http://wiki.bo3b.net/index.php?title=Mike_notes

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

#38
Posted 11/01/2015 11:49 PM   
[quote="bo3b"]Good stuff, that's a dramatic improvement for this game! If you want to get this up right away, probably contact oneup03 to bump the version again.[/quote] Thank you, I'll do that. But maybe I'll experiment with the shadows a bit before. [quote="bo3b"] Let's see if we can work out the shadow fix. If we can that will be a nice bump to this before posting it to the blog.[/quote] Yeah, that's the best plan. [quote="bo3b"]The vertex shader there is not where the action will be. It's just doing a simple vertex pass through, not modifying the positions. We'll want to look at the Pixel Shader associated, which will be doing some sort of deferred rendering. Hunt for the PS for this effect. It's going to be unintuitive. You'll most likely find a shadow mask first, which makes the shadows disappear altogether, but that is not the actual shader we want. The actual shader will be associated with lights instead, and make the shadows disappear by killing the light. If you experiment around, you can probably find the right one, and we can try to fix it. Some notes on finding the right one: http://wiki.bo3b.net/index.php?title=Mike_notes[/quote] I found one that disables all the shadows ("067216403dcf8557-ps_replace"): [code] cbuffer cbBase : register(b0) { float4 FC_DifColMul : packoffset(c0); float FC_GlobalTime : packoffset(c1); row_major float3x4 FC_MatrixViewT : packoffset(c2); float4 FC_FarClipInfo : packoffset(c5); float4 FC_ShadowMapParam : packoffset(c6); float4 FC_ShadowColor : packoffset(c7); float4 FC_ScreenSize : packoffset(c8); float4 FC_FinalColorMult : packoffset(c9); } cbuffer cbScreenSpaceShadow : register(b6) { row_major float4x4 g_InvProjMatrixT : packoffset(c0); row_major float4x4 g_ProjSpaceToShadowMatrixT[4] : packoffset(c4); float4 g_CascadeSelectDist : packoffset(c20); float4 g_vDepthComputeParam : packoffset(c21); float4 g_avSampleOffsets[16] : packoffset(c22); } SamplerState g_DepthMapSampler_sampler_s : register(s1); SamplerState g_SSAOMap_sampler_s : register(s13); SamplerComparisonState g_ShadowMap_sampler_s : register(s12); Texture2D<float4> g_DepthMapSampler_texture : register(t1); Texture2D<float4> g_ShadowMap_texture : register(t12); Texture2D<float4> g_SSAOMap_texture : register(t13); Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_Position0, float4 v1 : TEXCOORD0, float4 v2 : TEXCOORD1, out float4 o0 : SV_Target0) { float4 r0,r1,r2,r3,r4; uint4 bitmask, uiDest; float4 fDest; r0.z = g_DepthMapSampler_texture.Sample(g_DepthMapSampler_sampler_s, v1.xy).x; r1.x = g_vDepthComputeParam.x + -r0.z; r1.x = -g_vDepthComputeParam.y / r1.x; r2.xyzw = g_CascadeSelectDist.xyzw < r1.xxxx; r1.x = FC_ShadowMapParam.x + -r1.x; r1.x = saturate(FC_ShadowMapParam.y * r1.x); r2.xyzw = r2.xyzw ? 1.000000 : 0; r1.y = dot(r2.xyzw, float4(1,1,1,1)); r1.y = (int)r1.y; r1.z = (int)r1.y == 4; r1.y = (uint)r1.y << 2; r1.y = r1.z ? 12 : r1.y; if (r1.z != 0) discard; r0.xy = v2.xy; r0.w = 1; r2.x = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m00_m01_m02_m03, r0.xyzw); r2.y = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m10_m11_m12_m13, r0.xyzw); r2.z = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m20_m21_m22_m23, r0.xyzw); r2.w = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m30_m31_m32_m33, r0.xyzw); r0.xy = FC_ShadowMapParam.zw * r2.ww; r0.w = -r0.y; r0.z = 0; r3.xyzw = r2.xyzw + r0.xwzz; r0.w = 1 / r3.w; r1.yzw = r3.xyz * r0.www; r3.y = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x; r4.xyzw = r2.xyzw + r0.xyzz; r0.w = 1 / r4.w; r1.yzw = r4.xyz * r0.www; r3.x = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x; r4.xyzw = r0.xyzz * float4(-1,1,1,1) + r2.xyzw; r0.xyzw = r0.xyzz * float4(-1,-1,1,1) + r2.xyzw; r1.y = 1 / r4.w; r1.yzw = r4.xyz * r1.yyy; r3.z = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x; r0.w = 1 / r0.w; r0.xyz = r0.xyz * r0.www; r3.w = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r0.xy, r0.z).x; r0.x = dot(r3.xyzw, float4(0.25,0.25,0.25,0.25)); o0.xyz = -r1.xxx * r0.xxx + float3(1,1,1); r0.x = g_SSAOMap_texture.Sample(g_SSAOMap_sampler_s, v1.xy).w; o0.w = r0.x; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // using 3Dmigoto v1.2.6 on Mon Nov 02 01:04:06 2015 // // // Buffer Definitions: // // cbuffer cbBase // { // // float4 FC_DifColMul; // Offset: 0 Size: 16 [unused] // float FC_GlobalTime; // Offset: 16 Size: 4 [unused] // row_major float3x4 FC_MatrixViewT; // Offset: 32 Size: 48 [unused] // float4 FC_FarClipInfo; // Offset: 80 Size: 16 [unused] // float4 FC_ShadowMapParam; // Offset: 96 Size: 16 // float4 FC_ShadowColor; // Offset: 112 Size: 16 [unused] // float4 FC_ScreenSize; // Offset: 128 Size: 16 [unused] // float4 FC_FinalColorMult; // Offset: 144 Size: 16 [unused] // // } // // cbuffer cbScreenSpaceShadow // { // // row_major float4x4 g_InvProjMatrixT;// Offset: 0 Size: 64 [unused] // row_major float4x4 g_ProjSpaceToShadowMatrixT[4];// Offset: 64 Size: 256 // float4 g_CascadeSelectDist; // Offset: 320 Size: 16 // float4 g_vDepthComputeParam; // Offset: 336 Size: 16 // float4 g_avSampleOffsets[16]; // Offset: 352 Size: 256 [unused] // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // g_DepthMapSampler_sampler sampler NA NA 1 1 // g_ShadowMap_sampler sampler_c NA NA 12 1 // g_SSAOMap_sampler sampler NA NA 13 1 // g_DepthMapSampler_texture texture float4 2d 1 1 // g_ShadowMap_texture texture float4 2d 12 1 // g_SSAOMap_texture texture float4 2d 13 1 // cbBase cbuffer NA NA 0 1 // cbScreenSpaceShadow cbuffer NA NA 6 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float // TEXCOORD 0 xy 1 NONE float xy // TEXCOORD 1 xyzw 2 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[7], immediateIndexed dcl_constantbuffer cb6[22], dynamicIndexed dcl_sampler s1, mode_default dcl_sampler s12, mode_comparison dcl_sampler s13, mode_default dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t12 dcl_resource_texture2d (float,float,float,float) t13 dcl_input_ps linear v1.xy dcl_input_ps linear v2.xy dcl_output o0.xyzw dcl_temps 5 sample_indexable(texture2d)(float,float,float,float) r0.z, v1.xyxx, t1.yzxw, s1 add r1.x, -r0.z, cb6[21].x div r1.x, -cb6[21].y, r1.x lt r2.xyzw, cb6[20].xyzw, r1.xxxx add r1.x, -r1.x, cb0[6].x mul_sat r1.x, r1.x, cb0[6].y and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000) dp4 r1.y, r2.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000) ftoi r1.y, r1.y ieq r1.z, r1.y, l(4) ishl r1.y, r1.y, l(2) movc r1.y, r1.z, l(12), r1.y discard_nz r1.z mov r0.xy, v2.xyxx mov r0.w, l(1.000000) dp4 r2.x, cb6[r1.y + 4].xyzw, r0.xyzw dp4 r2.y, cb6[r1.y + 5].xyzw, r0.xyzw dp4 r2.z, cb6[r1.y + 6].xyzw, r0.xyzw dp4 r2.w, cb6[r1.y + 7].xyzw, r0.xyzw mul r0.xy, r2.wwww, cb0[6].zwzz mov r0.w, -r0.y mov r0.z, l(0) add r3.xyzw, r0.xwzz, r2.xyzw div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w mul r1.yzw, r0.wwww, r3.xxyz sample_c_indexable(texture2d)(float,float,float,float) r3.y, r1.yzyy, t12.xxxx, s12, r1.w add r4.xyzw, r0.xyzz, r2.xyzw div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w mul r1.yzw, r0.wwww, r4.xxyz sample_c_indexable(texture2d)(float,float,float,float) r3.x, r1.yzyy, t12.xxxx, s12, r1.w mad r4.xyzw, r0.xyzz, l(-1.000000, 1.000000, 1.000000, 1.000000), r2.xyzw mad r0.xyzw, r0.xyzz, l(-1.000000, -1.000000, 1.000000, 1.000000), r2.xyzw div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w mul r1.yzw, r1.yyyy, r4.xxyz sample_c_indexable(texture2d)(float,float,float,float) r3.z, r1.yzyy, t12.xxxx, s12, r1.w div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w mul r0.xyz, r0.wwww, r0.xyzx sample_c_indexable(texture2d)(float,float,float,float) r3.w, r0.xyxx, t12.xxxx, s12, r0.z dp4 r0.x, r3.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000) mad o0.xyz, -r1.xxxx, r0.xxxx, l(1.000000, 1.000000, 1.000000, 0.000000) sample_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t13.wxyz, s13 mov o0.w, r0.x ret // Approximately 43 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] This one for example disables the shadows of the weapons and a few other objects ("77f4996cb2eb5c78-ps_replace.txt"): [code] cbuffer cbInstance : register(b5) { float4 FC_AmbientSH_0 : packoffset(c0); float4 FC_AmbientSH_1 : packoffset(c1); float4 FC_AmbientSH_2 : packoffset(c2); float4 FC_CubeEnvSH_0 : packoffset(c3); float4 FC_CubeEnvSH_1 : packoffset(c4); float4 FC_CubeEnvSH_2 : packoffset(c5); float4 FC_InstanceColor : packoffset(c6); float4 FC_LightMask : packoffset(c7); } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float4 v0 : SV_Position0, float4 v1 : TEXCOORD5, float2 v2 : TEXCOORD6, float v3 : SV_ClipDistance0, out float4 o0 : SV_Target0) { o0.w = FC_InstanceColor.w * v1.w; o0.xyz = float3(1,1,1); return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // using 3Dmigoto v1.2.6 on Mon Nov 02 01:13:02 2015 // // // Buffer Definitions: // // cbuffer cbInstance // { // // float4 FC_AmbientSH_0; // Offset: 0 Size: 16 [unused] // float4 FC_AmbientSH_1; // Offset: 16 Size: 16 [unused] // float4 FC_AmbientSH_2; // Offset: 32 Size: 16 [unused] // float4 FC_CubeEnvSH_0; // Offset: 48 Size: 16 [unused] // float4 FC_CubeEnvSH_1; // Offset: 64 Size: 16 [unused] // float4 FC_CubeEnvSH_2; // Offset: 80 Size: 16 [unused] // float4 FC_InstanceColor; // Offset: 96 Size: 16 // float4 FC_LightMask; // Offset: 112 Size: 16 [unused] // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // cbInstance cbuffer NA NA 5 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float // TEXCOORD 5 xyzw 1 NONE float w // TEXCOORD 6 xy 2 NONE float // SV_ClipDistance 0 x 3 CLIPDST float // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Target 0 xyzw 0 TARGET float xyzw // ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb5[7], immediateIndexed dcl_input_ps linear v1.w dcl_output o0.xyzw mul o0.w, v1.w, cb5[6].w mov o0.xyz, l(1.000000,1.000000,1.000000,0) ret // Approximately 3 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] I have to go to bed now, so I won't experiment until tomorrow. Please, tell me that the first one I posted in this post is the good one :p. Edit: by the way, I saw in the Unity 5 thread that helifax found a shader that behaves the same as the one that can be modified by pressing F4 in my fix. If you (or someone else) find an accurate solution, please tell me.
bo3b said:Good stuff, that's a dramatic improvement for this game! If you want to get this up right away, probably contact oneup03 to bump the version again.

Thank you, I'll do that. But maybe I'll experiment with the shadows a bit before.

bo3b said:
Let's see if we can work out the shadow fix. If we can that will be a nice bump to this before posting it to the blog.

Yeah, that's the best plan.

bo3b said:The vertex shader there is not where the action will be. It's just doing a simple vertex pass through, not modifying the positions. We'll want to look at the Pixel Shader associated, which will be doing some sort of deferred rendering.

Hunt for the PS for this effect. It's going to be unintuitive. You'll most likely find a shadow mask first, which makes the shadows disappear altogether, but that is not the actual shader we want. The actual shader will be associated with lights instead, and make the shadows disappear by killing the light. If you experiment around, you can probably find the right one, and we can try to fix it. Some notes on finding the right one: http://wiki.bo3b.net/index.php?title=Mike_notes


I found one that disables all the shadows ("067216403dcf8557-ps_replace"):

cbuffer cbBase : register(b0)
{
float4 FC_DifColMul : packoffset(c0);
float FC_GlobalTime : packoffset(c1);
row_major float3x4 FC_MatrixViewT : packoffset(c2);
float4 FC_FarClipInfo : packoffset(c5);
float4 FC_ShadowMapParam : packoffset(c6);
float4 FC_ShadowColor : packoffset(c7);
float4 FC_ScreenSize : packoffset(c8);
float4 FC_FinalColorMult : packoffset(c9);
}

cbuffer cbScreenSpaceShadow : register(b6)
{
row_major float4x4 g_InvProjMatrixT : packoffset(c0);
row_major float4x4 g_ProjSpaceToShadowMatrixT[4] : packoffset(c4);
float4 g_CascadeSelectDist : packoffset(c20);
float4 g_vDepthComputeParam : packoffset(c21);
float4 g_avSampleOffsets[16] : packoffset(c22);
}
SamplerState g_DepthMapSampler_sampler_s : register(s1);
SamplerState g_SSAOMap_sampler_s : register(s13);
SamplerComparisonState g_ShadowMap_sampler_s : register(s12);
Texture2D<float4> g_DepthMapSampler_texture : register(t1);
Texture2D<float4> g_ShadowMap_texture : register(t12);
Texture2D<float4> g_SSAOMap_texture : register(t13);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : SV_Position0,
float4 v1 : TEXCOORD0,
float4 v2 : TEXCOORD1,
out float4 o0 : SV_Target0)
{
float4 r0,r1,r2,r3,r4;
uint4 bitmask, uiDest;
float4 fDest;

r0.z = g_DepthMapSampler_texture.Sample(g_DepthMapSampler_sampler_s, v1.xy).x;
r1.x = g_vDepthComputeParam.x + -r0.z;
r1.x = -g_vDepthComputeParam.y / r1.x;
r2.xyzw = g_CascadeSelectDist.xyzw < r1.xxxx;
r1.x = FC_ShadowMapParam.x + -r1.x;
r1.x = saturate(FC_ShadowMapParam.y * r1.x);
r2.xyzw = r2.xyzw ? 1.000000 : 0;
r1.y = dot(r2.xyzw, float4(1,1,1,1));
r1.y = (int)r1.y;
r1.z = (int)r1.y == 4;
r1.y = (uint)r1.y << 2;
r1.y = r1.z ? 12 : r1.y;
if (r1.z != 0) discard;
r0.xy = v2.xy;
r0.w = 1;
r2.x = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m00_m01_m02_m03, r0.xyzw);
r2.y = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m10_m11_m12_m13, r0.xyzw);
r2.z = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m20_m21_m22_m23, r0.xyzw);
r2.w = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m30_m31_m32_m33, r0.xyzw);
r0.xy = FC_ShadowMapParam.zw * r2.ww;
r0.w = -r0.y;
r0.z = 0;
r3.xyzw = r2.xyzw + r0.xwzz;
r0.w = 1 / r3.w;
r1.yzw = r3.xyz * r0.www;
r3.y = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x;
r4.xyzw = r2.xyzw + r0.xyzz;
r0.w = 1 / r4.w;
r1.yzw = r4.xyz * r0.www;
r3.x = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x;
r4.xyzw = r0.xyzz * float4(-1,1,1,1) + r2.xyzw;
r0.xyzw = r0.xyzz * float4(-1,-1,1,1) + r2.xyzw;
r1.y = 1 / r4.w;
r1.yzw = r4.xyz * r1.yyy;
r3.z = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r1.yz, r1.w).x;
r0.w = 1 / r0.w;
r0.xyz = r0.xyz * r0.www;
r3.w = g_ShadowMap_texture.SampleCmp(g_ShadowMap_sampler_s, r0.xy, r0.z).x;
r0.x = dot(r3.xyzw, float4(0.25,0.25,0.25,0.25));
o0.xyz = -r1.xxx * r0.xxx + float3(1,1,1);
r0.x = g_SSAOMap_texture.Sample(g_SSAOMap_sampler_s, v1.xy).w;
o0.w = r0.x;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// using 3Dmigoto v1.2.6 on Mon Nov 02 01:04:06 2015
//
//
// Buffer Definitions:
//
// cbuffer cbBase
// {
//
// float4 FC_DifColMul; // Offset: 0 Size: 16 [unused]
// float FC_GlobalTime; // Offset: 16 Size: 4 [unused]
// row_major float3x4 FC_MatrixViewT; // Offset: 32 Size: 48 [unused]
// float4 FC_FarClipInfo; // Offset: 80 Size: 16 [unused]
// float4 FC_ShadowMapParam; // Offset: 96 Size: 16
// float4 FC_ShadowColor; // Offset: 112 Size: 16 [unused]
// float4 FC_ScreenSize; // Offset: 128 Size: 16 [unused]
// float4 FC_FinalColorMult; // Offset: 144 Size: 16 [unused]
//
// }
//
// cbuffer cbScreenSpaceShadow
// {
//
// row_major float4x4 g_InvProjMatrixT;// Offset: 0 Size: 64 [unused]
// row_major float4x4 g_ProjSpaceToShadowMatrixT[4];// Offset: 64 Size: 256
// float4 g_CascadeSelectDist; // Offset: 320 Size: 16
// float4 g_vDepthComputeParam; // Offset: 336 Size: 16
// float4 g_avSampleOffsets[16]; // Offset: 352 Size: 256 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_DepthMapSampler_sampler sampler NA NA 1 1
// g_ShadowMap_sampler sampler_c NA NA 12 1
// g_SSAOMap_sampler sampler NA NA 13 1
// g_DepthMapSampler_texture texture float4 2d 1 1
// g_ShadowMap_texture texture float4 2d 12 1
// g_SSAOMap_texture texture float4 2d 13 1
// cbBase cbuffer NA NA 0 1
// cbScreenSpaceShadow cbuffer NA NA 6 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// TEXCOORD 1 xyzw 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[7], immediateIndexed
dcl_constantbuffer cb6[22], dynamicIndexed
dcl_sampler s1, mode_default
dcl_sampler s12, mode_comparison
dcl_sampler s13, mode_default
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 5
sample_indexable(texture2d)(float,float,float,float) r0.z, v1.xyxx, t1.yzxw, s1
add r1.x, -r0.z, cb6[21].x
div r1.x, -cb6[21].y, r1.x
lt r2.xyzw, cb6[20].xyzw, r1.xxxx
add r1.x, -r1.x, cb0[6].x
mul_sat r1.x, r1.x, cb0[6].y
and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
dp4 r1.y, r2.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
ftoi r1.y, r1.y
ieq r1.z, r1.y, l(4)
ishl r1.y, r1.y, l(2)
movc r1.y, r1.z, l(12), r1.y
discard_nz r1.z
mov r0.xy, v2.xyxx
mov r0.w, l(1.000000)
dp4 r2.x, cb6[r1.y + 4].xyzw, r0.xyzw
dp4 r2.y, cb6[r1.y + 5].xyzw, r0.xyzw
dp4 r2.z, cb6[r1.y + 6].xyzw, r0.xyzw
dp4 r2.w, cb6[r1.y + 7].xyzw, r0.xyzw
mul r0.xy, r2.wwww, cb0[6].zwzz
mov r0.w, -r0.y
mov r0.z, l(0)
add r3.xyzw, r0.xwzz, r2.xyzw
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
mul r1.yzw, r0.wwww, r3.xxyz
sample_c_indexable(texture2d)(float,float,float,float) r3.y, r1.yzyy, t12.xxxx, s12, r1.w
add r4.xyzw, r0.xyzz, r2.xyzw
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
mul r1.yzw, r0.wwww, r4.xxyz
sample_c_indexable(texture2d)(float,float,float,float) r3.x, r1.yzyy, t12.xxxx, s12, r1.w
mad r4.xyzw, r0.xyzz, l(-1.000000, 1.000000, 1.000000, 1.000000), r2.xyzw
mad r0.xyzw, r0.xyzz, l(-1.000000, -1.000000, 1.000000, 1.000000), r2.xyzw
div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
mul r1.yzw, r1.yyyy, r4.xxyz
sample_c_indexable(texture2d)(float,float,float,float) r3.z, r1.yzyy, t12.xxxx, s12, r1.w
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r0.xyz, r0.wwww, r0.xyzx
sample_c_indexable(texture2d)(float,float,float,float) r3.w, r0.xyxx, t12.xxxx, s12, r0.z
dp4 r0.x, r3.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
mad o0.xyz, -r1.xxxx, r0.xxxx, l(1.000000, 1.000000, 1.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t13.wxyz, s13
mov o0.w, r0.x
ret
// Approximately 43 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/



This one for example disables the shadows of the weapons and a few other objects ("77f4996cb2eb5c78-ps_replace.txt"):

cbuffer cbInstance : register(b5)
{
float4 FC_AmbientSH_0 : packoffset(c0);
float4 FC_AmbientSH_1 : packoffset(c1);
float4 FC_AmbientSH_2 : packoffset(c2);
float4 FC_CubeEnvSH_0 : packoffset(c3);
float4 FC_CubeEnvSH_1 : packoffset(c4);
float4 FC_CubeEnvSH_2 : packoffset(c5);
float4 FC_InstanceColor : packoffset(c6);
float4 FC_LightMask : packoffset(c7);
}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main(
float4 v0 : SV_Position0,
float4 v1 : TEXCOORD5,
float2 v2 : TEXCOORD6,
float v3 : SV_ClipDistance0,
out float4 o0 : SV_Target0)
{
o0.w = FC_InstanceColor.w * v1.w;
o0.xyz = float3(1,1,1);
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// using 3Dmigoto v1.2.6 on Mon Nov 02 01:13:02 2015
//
//
// Buffer Definitions:
//
// cbuffer cbInstance
// {
//
// float4 FC_AmbientSH_0; // Offset: 0 Size: 16 [unused]
// float4 FC_AmbientSH_1; // Offset: 16 Size: 16 [unused]
// float4 FC_AmbientSH_2; // Offset: 32 Size: 16 [unused]
// float4 FC_CubeEnvSH_0; // Offset: 48 Size: 16 [unused]
// float4 FC_CubeEnvSH_1; // Offset: 64 Size: 16 [unused]
// float4 FC_CubeEnvSH_2; // Offset: 80 Size: 16 [unused]
// float4 FC_InstanceColor; // Offset: 96 Size: 16
// float4 FC_LightMask; // Offset: 112 Size: 16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cbInstance cbuffer NA NA 5 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float
// TEXCOORD 5 xyzw 1 NONE float w
// TEXCOORD 6 xy 2 NONE float
// SV_ClipDistance 0 x 3 CLIPDST float
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb5[7], immediateIndexed
dcl_input_ps linear v1.w
dcl_output o0.xyzw
mul o0.w, v1.w, cb5[6].w
mov o0.xyz, l(1.000000,1.000000,1.000000,0)
ret
// Approximately 3 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


I have to go to bed now, so I won't experiment until tomorrow. Please, tell me that the first one I posted in this post is the good one :p.

Edit: by the way, I saw in the Unity 5 thread that helifax found a shader that behaves the same as the one that can be modified by pressing F4 in my fix. If you (or someone else) find an accurate solution, please tell me.

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

#39
Posted 11/02/2015 12:15 AM   
Sorry If I am being a noobie;)) Still learning all the "reverse engineering" parts of "shadow/lighting" fixing;)) I gave a look at the above posted shaders;) The 2nd shader is defo a no-go! Is basically a pass-through;) The first shader looks promission, however: - After a quick scan, I see that "v0 : SV_Position0" is not even used in it. (Meaning the stereo-corrected vertex position is not used in this shader). - What I see is that "v1 : TEXCOORD0" and "v2 : TEXCOORD1" are being used. - This line looks the most promising: [code] r0.z = g_DepthMapSampler_texture.Sample(g_DepthMapSampler_sampler_s, v1.xy).x; [/code] Which is using v1 (aka TEXCOORD0). My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;)) (Then again I might be mistaken and I will let anyone else comment on the above statement ^_^)
Sorry If I am being a noobie;)) Still learning all the "reverse engineering" parts of "shadow/lighting" fixing;))

I gave a look at the above posted shaders;) The 2nd shader is defo a no-go! Is basically a pass-through;)

The first shader looks promission, however:
- After a quick scan, I see that "v0 : SV_Position0" is not even used in it. (Meaning the stereo-corrected vertex position is not used in this shader).
- What I see is that "v1 : TEXCOORD0" and "v2 : TEXCOORD1" are being used.
- This line looks the most promising:
r0.z = g_DepthMapSampler_texture.Sample(g_DepthMapSampler_sampler_s, v1.xy).x;

Which is using v1 (aka TEXCOORD0).

My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;))

(Then again I might be mistaken and I will let anyone else comment on the above statement ^_^)

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)

#40
Posted 11/02/2015 01:24 AM   
[quote="helifax"] My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;))[/quote] Well, it led me back to the "e43b9b2d6333b956-vs_replace.txt" shader. It's the one whose code I posted first. The vertex and pixel shaders are exclusive to each other. There isn't any other pixel shader controlled by the vertex shader. Changing values to "o1" in the vertex shader (or v1 at the start of the pixel shader) with the typical "o1.x+=separation*(v0.w-convergence);" (I used "v0.w" because "v1" is bidimensional. I also tried other things in the pixel shader) mostly alters the shadowing on the character model (so you can see a haloed yourself at the sides), and it also does the same efect for SSAO. However, SSAO can be refixed in the pixel shader doing the opposite operation to "v1" before the last "r0.x" statement. Shadows on the environment are also changed somewhat. But still wrong. It seems that there isn't a simple solution, unless I missed something obvious :(.
helifax said:
My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;))


Well, it led me back to the "e43b9b2d6333b956-vs_replace.txt" shader. It's the one whose code I posted first. The vertex and pixel shaders are exclusive to each other. There isn't any other pixel shader controlled by the vertex shader.

Changing values to "o1" in the vertex shader (or v1 at the start of the pixel shader) with the typical "o1.x+=separation*(v0.w-convergence);" (I used "v0.w" because "v1" is bidimensional. I also tried other things in the pixel shader) mostly alters the shadowing on the character model (so you can see a haloed yourself at the sides), and it also does the same efect for SSAO. However, SSAO can be refixed in the pixel shader doing the opposite operation to "v1" before the last "r0.x" statement.

Shadows on the environment are also changed somewhat. But still wrong.

It seems that there isn't a simple solution, unless I missed something obvious :(.

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

#41
Posted 11/02/2015 10:05 AM   
[quote="masterotaku"][quote="helifax"] My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;))[/quote] Well, it led me back to the "e43b9b2d6333b956-vs_replace.txt" shader. It's the one whose code I posted first. The vertex and pixel shaders are exclusive to each other. There isn't any other pixel shader controlled by the vertex shader. Changing values to "o1" in the vertex shader (or v1 at the start of the pixel shader) with the typical "o1.x+=separation*(v0.w-convergence);" (I used "v0.w" because "v1" is bidimensional. I also tried other things in the pixel shader) mostly alters the shadowing on the character model (so you can see a haloed yourself at the sides), and it also does the same efect for SSAO. However, SSAO can be refixed in the pixel shader doing the opposite operation to "v1" before the last "r0.x" statement. Shadows on the environment are also changed somewhat. But still wrong. It seems that there isn't a simple solution, unless I missed something obvious :(.[/quote] I remember doing the fix for the DX9 version. I wasn't able to properly fix the shadows there due to this weird behaviour. (all are approximations). I know Mike_ar69 also gave the game a look back then and he was puzzled as well by how the shaders work. I haven't look at the DX11 version, but technically the same things should apply here as well?
masterotaku said:
helifax said:
My hunch is that you need to find the Vertex shader(attached to this pixel shader) and correct the Position there for the Output of "TEXCOORD0". Then when is passed to the Pixel Shader is should already be in "Stereo" and hopefully nothing needs to be done;))


Well, it led me back to the "e43b9b2d6333b956-vs_replace.txt" shader. It's the one whose code I posted first. The vertex and pixel shaders are exclusive to each other. There isn't any other pixel shader controlled by the vertex shader.

Changing values to "o1" in the vertex shader (or v1 at the start of the pixel shader) with the typical "o1.x+=separation*(v0.w-convergence);" (I used "v0.w" because "v1" is bidimensional. I also tried other things in the pixel shader) mostly alters the shadowing on the character model (so you can see a haloed yourself at the sides), and it also does the same efect for SSAO. However, SSAO can be refixed in the pixel shader doing the opposite operation to "v1" before the last "r0.x" statement.

Shadows on the environment are also changed somewhat. But still wrong.

It seems that there isn't a simple solution, unless I missed something obvious :(.


I remember doing the fix for the DX9 version. I wasn't able to properly fix the shadows there due to this weird behaviour. (all are approximations). I know Mike_ar69 also gave the game a look back then and he was puzzled as well by how the shaders work.
I haven't look at the DX11 version, but technically the same things should apply here as well?

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)

#42
Posted 11/02/2015 10:13 AM   
Starting point should be like this, with the first PS. The VS (e43b9b2d6333b956-vs_replace.txt) is not good in this case. [code]r0.xy = v2.xy; r0.w = 1; float4 stereo = StereoParams.Load(0); r0.x -= stereo.x * (r0.z - stereo.y); // r0.x -= stereo.x * (r0.z - stereo.y) * CORRECTION; r2.x = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m00_m01_m02_m03, r0.xyzw); r2.y = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m10_m11_m12_m13, r0.xyzw); r2.z = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m20_m21_m22_m23, r0.xyzw); r2.w = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m30_m31_m32_m33, r0.xyzw); r0.xy = FC_ShadowMapParam.zw * r2.ww;[/code] Multiply the above fix by a fix number that make shadows aligned, run frame analysis to look if any register have the same value or 1/value or similar of that fix value....that's the register you need. If you left a fix value, with convergence or changing fov the fix will break. (PS: i have pending to do this with Dying Light to make the fix works with any FOV value) Also you can try multiply by register already there (in the asm code some of those are taged unused), this is hit and miss. My first try will be "FC_FarClipInfo" and "FC_ScreenSize" but is taged unused....frame analysis should tell if is used or not. Also you can try changing signs [+/-] in r0.z....you need to test what is better. r0.x -= stereo.x * (-r0.z - stereo.y);
Starting point should be like this, with the first PS. The VS (e43b9b2d6333b956-vs_replace.txt) is not good in this case.

r0.xy = v2.xy;
r0.w = 1;

float4 stereo = StereoParams.Load(0);
r0.x -= stereo.x * (r0.z - stereo.y);
// r0.x -= stereo.x * (r0.z - stereo.y) * CORRECTION;

r2.x = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m00_m01_m02_m03, r0.xyzw);
r2.y = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m10_m11_m12_m13, r0.xyzw);
r2.z = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m20_m21_m22_m23, r0.xyzw);
r2.w = dot(g_ProjSpaceToShadowMatrixT[r1.y/4]._m30_m31_m32_m33, r0.xyzw);
r0.xy = FC_ShadowMapParam.zw * r2.ww;



Multiply the above fix by a fix number that make shadows aligned, run frame analysis to look if any register have the same value or 1/value or similar of that fix value....that's the register you need. If you left a fix value, with convergence or changing fov the fix will break. (PS: i have pending to do this with Dying Light to make the fix works with any FOV value)

Also you can try multiply by register already there (in the asm code some of those are taged unused), this is hit and miss. My first try will be "FC_FarClipInfo" and "FC_ScreenSize" but is taged unused....frame analysis should tell if is used or not.

Also you can try changing signs [+/-] in r0.z....you need to test what is better.
r0.x -= stereo.x * (-r0.z - stereo.y);

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

Like my fixes? you can donate to Paypal: dhr.donation@gmail.com

#43
Posted 11/02/2015 10:59 AM   
OK. I multiplied your line by "-0.333333" (resulting in "r0.x -= stereo.x * (r0.z - stereo.y)*(-0.333333);". Maybe I should have just multiplied by -1/3 or changed the sign and multiplied by 1/3) to align the feet of the shadow to the feet of the character at 2.4 convergence and 100% depth. After the frame analisys (with the default options in 3Dmigoto), there was only one jps related to this pixel shader and its vertex shader. It's "000781-o0=f15c731e-vs=e43b9b2d6333b956-ps=067216403dcf8557.jps". In case you want to see the file (it shows the shadows and SSAO): https://www.dropbox.com/s/y5a8ekmtwuyzdaf/000781-o0%3Df15c731e-vs%3De43b9b2d6333b956-ps%3D067216403dcf8557.jps?dl=0 I'll try multiplying by some of the registers, but I don't know what information that jps os giving.
OK. I multiplied your line by "-0.333333" (resulting in "r0.x -= stereo.x * (r0.z - stereo.y)*(-0.333333);". Maybe I should have just multiplied by -1/3 or changed the sign and multiplied by 1/3) to align the feet of the shadow to the feet of the character at 2.4 convergence and 100% depth. After the frame analisys (with the default options in 3Dmigoto), there was only one jps related to this pixel shader and its vertex shader. It's "000781-o0=f15c731e-vs=e43b9b2d6333b956-ps=067216403dcf8557.jps". In case you want to see the file (it shows the shadows and SSAO): https://www.dropbox.com/s/y5a8ekmtwuyzdaf/000781-o0%3Df15c731e-vs%3De43b9b2d6333b956-ps%3D067216403dcf8557.jps?dl=0

I'll try multiplying by some of the registers, but I don't know what information that jps os giving.

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

#44
Posted 11/02/2015 11:57 AM   
Can you upload a screenshot with the fix multiply by -0.33333? the shadows looks good with that value (2.4 convergence and 100% depth)? the frame analysis sould give you a text file, inside that file there are the register that need to check.
Can you upload a screenshot with the fix multiply by -0.33333? the shadows looks good with that value (2.4 convergence and 100% depth)?

the frame analysis sould give you a text file, inside that file there are the register that need to check.

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

Like my fixes? you can donate to Paypal: dhr.donation@gmail.com

#45
Posted 11/02/2015 12:01 PM   
  3 / 7    
Scroll To Top