Bo3b's School For Shaderhackers
  78 / 88    
Hello, The true name of god of 3d is?
Hello,

The true name of god of 3d is?

Asus Rog Swift PG27V - 3D Vision 2 - Ventus RTX 2080 TI (MSI) - i7 7700 - 16GB RAM - WIN 10 / WIN 7

Posted 06/18/2017 10:40 AM   
helix or helifax i forget, i already asked the question and get my answer in the forum. Not easy to find lol
helix or helifax i forget, i already asked the question and get my answer in the forum.

Not easy to find lol

Posted 06/18/2017 11:03 AM   
Thanks :)
Thanks :)

Asus Rog Swift PG27V - 3D Vision 2 - Ventus RTX 2080 TI (MSI) - i7 7700 - 16GB RAM - WIN 10 / WIN 7

Posted 06/18/2017 02:42 PM   
Hi, You're welcome!
Hi,

You're welcome!

Posted 06/19/2017 03:03 AM   
Hello everyone i wanna try to fix some unity5.3 5.4 dx11 early access games with the great unity templates from DSS. i dont have programing knowledge how to set it up with cygwin and were to put the scripts correctly. My question is can anyone please make a step by step guide or is it too complicated for a non coder? Thanks all for keepin 3d vision alive
Hello everyone
i wanna try to fix some unity5.3 5.4 dx11 early access games with the great unity templates
from DSS. i dont have programing knowledge how to set it up with cygwin and were to put the
scripts correctly. My question is can anyone please make a step by step guide or is it too
complicated for a non coder?

Thanks all for keepin 3d vision alive

Posted 10/13/2017 02:14 PM   
You should try and run through the lessons in bo3b's school first. They'll give you a better understanding of what you're dealing with, and will help you solve problems. They don't directly apply to the DX11/unity stuff, but the concepts are similar. You don't need to be a programmer to learn some basic fixing, and having that basic understanding should help you understand the unity stuff better, once someone (hopefully) provides the information you're asking for.
You should try and run through the lessons in bo3b's school first. They'll give you a better understanding of what you're dealing with, and will help you solve problems. They don't directly apply to the DX11/unity stuff, but the concepts are similar. You don't need to be a programmer to learn some basic fixing, and having that basic understanding should help you understand the unity stuff better, once someone (hopefully) provides the information you're asking for.

Posted 10/13/2017 02:59 PM   
Right so I have this shader: [code] // ---- Created with 3Dmigoto v1.2.66 on Thu Oct 26 19:20:30 2017 cbuffer _Globals : register(b0) { float3 LightDir : packoffset(c0); float4x4 ShadowVolumeTransform : packoffset(c1); float4 Unproject : packoffset(c5); float4x4 EyeToLightSpace : packoffset(c6); float2 CascadeShadowSettings : packoffset(c10); float CascadeIndex : packoffset(c10.z); float CascadeShadowMapSize : packoffset(c10.w); float2 RcpDeferredShadowMapSize : packoffset(c11); } SamplerComparisonState SmpLessClampLinear_s : register(s0); Texture2D<float> LinearDepth : register(t0); Texture2DArray<float> CascadeShadowMap : register(t1); // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : SV_Position0, out float o0 : SV_Target0) { float4 r0,r1,r2,r3,r4; uint4 bitmask, uiDest; float4 fDest; r0.z = CascadeIndex; r1.xy = (int2)v0.xy; r1.zw = float2(0,0); r1.z = LinearDepth.Load(r1.xyz).x; r2.xy = v0.xy * Unproject.xy + Unproject.zw; r1.xy = r2.xy * r1.zz; r1.w = 1; r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30); r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31); r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32); r0.w = -CascadeShadowSettings.x + r0.w; r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5); r1.zw = floor(r1.xy); r1.xy = r1.xy + -r1.zw; r1.zw = float2(-0.5,-0.5) + r1.zw; r2.xy = float2(2,2) + -r1.xy; r2.zw = -r1.yx * float2(2,2) + float2(3,3); r2.xy = r2.xy / r2.wz; r3.zw = float2(-1,-1) + r2.xy; r2.xy = r1.xy * float2(2,2) + float2(1,1); r1.xy = r1.xy / r2.xy; r3.xy = float2(1,1) + r1.xy; r1.x = 1 / CascadeShadowMapSize; r4.xyzw = r3.zwxw * r1.xxxx; r3.xyzw = r3.zyxy * r1.xxxx; r0.xy = r1.zw * r1.xx + r4.zw; r4.xy = r1.zw * r1.xx + r4.xy; r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r0.xyz, r0.w).x; r0.yz = r2.xy * r2.zw; r1.y = r2.w * r2.z; r2.x = r2.x * r2.y; r0.x = r0.y * r0.x; r4.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x; r0.x = r1.y * r0.y + r0.x; r4.xy = r1.zw * r1.xx + r3.xy; r1.xy = r1.zw * r1.xx + r3.zw; r4.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x; r0.x = r0.z * r0.y + r0.x; r1.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.w).x; r0.x = r2.x * r0.y + r0.x; o0.x = 0.0625 * r0.x; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [/code] I have tried most of the usual stuff, but it failed:( Anyone has any idea on how to fix this one? (is a shadow Shader for the record ^_^) Edit: the VS is this: [code] // ---- Created with 3Dmigoto v1.2.66 on Thu Oct 26 19:50:07 2017 cbuffer _Globals : register(b0) { float3 LightDir : packoffset(c0); float4x4 ShadowVolumeTransform : packoffset(c1); float4 Unproject : packoffset(c5); float4x4 EyeToLightSpace : packoffset(c6); float2 CascadeShadowSettings : packoffset(c10); float CascadeIndex : packoffset(c10.z); float CascadeShadowMapSize : packoffset(c10.w); float2 RcpDeferredShadowMapSize : packoffset(c11); } // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( uint v0 : SV_VertexID0, out float4 o0 : SV_Position0) { const float4 icb[] = { { 0, 1, 2, 3}, { 4, 7, 6, 5}, { 0, 4, 5, 1}, { 3, 2, 6, 7}, { 0, 3, 7, 4}, { 1, 5, 6, 2}, { -1.000000, -1.000000, 0, 0}, { 1.000000, -1.000000, 0, 0}, { 1.000000, 1.000000, 0, 0}, { -1.000000, 1.000000, 0, 0}, { -1.000000, -1.000000, 1.000000, 0}, { 1.000000, -1.000000, 1.000000, 0}, { 1.000000, 1.000000, 1.000000, 0}, { -1.000000, 1.000000, 1.000000, 0} }; // Needs manual fix for instruction: // unknown dcl_: dcl_input_sgv v0.x, vertex_id float4 r0,r1; uint4 bitmask, uiDest; float4 fDest; uiDest.x = (uint)v0.x / 3; r1.x = (uint)v0.x % 3; r0.x = uiDest.x; r0.y = (int)r0.x & 1; r0.x = (uint)r0.x >> 1; r0.xyz = r0.yyy ? icb[r0.x+0].xyz : icb[r0.x+0].xzw; r0.w = (int)r1.x + -2; r1.xy = cmp((uint2)r1.xx < int2(1,2)); r1.z = r1.x ? 0 : r0.w; r1.w = cmp((int)r1.y == 0); r0.xyz = r1.xzw ? r0.xyz : 0; r0.w = 0; r0.xy = (int2)r0.yw | (int2)r0.xz; r0.x = (int)r0.y | (int)r0.x; r0.xyz = icb[r0.x+6].xyz; r0.w = 1; o0.x = dot(r0.xyzw, ShadowVolumeTransform._m00_m10_m20_m30); o0.y = dot(r0.xyzw, ShadowVolumeTransform._m01_m11_m21_m31); o0.z = dot(r0.xyzw, ShadowVolumeTransform._m02_m12_m22_m32); o0.w = dot(r0.xyzw, ShadowVolumeTransform._m03_m13_m23_m33); return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [/code] Ps: Tried both the ASM and HLSL variant to fix (as I noticed the error there in HLSL ^_^)
Right so I have this shader:

// ---- Created with 3Dmigoto v1.2.66 on Thu Oct 26 19:20:30 2017

cbuffer _Globals : register(b0)
{
float3 LightDir : packoffset(c0);
float4x4 ShadowVolumeTransform : packoffset(c1);
float4 Unproject : packoffset(c5);
float4x4 EyeToLightSpace : packoffset(c6);
float2 CascadeShadowSettings : packoffset(c10);
float CascadeIndex : packoffset(c10.z);
float CascadeShadowMapSize : packoffset(c10.w);
float2 RcpDeferredShadowMapSize : packoffset(c11);
}

SamplerComparisonState SmpLessClampLinear_s : register(s0);
Texture2D<float> LinearDepth : register(t0);
Texture2DArray<float> CascadeShadowMap : register(t1);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


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

r0.z = CascadeIndex;
r1.xy = (int2)v0.xy;
r1.zw = float2(0,0);
r1.z = LinearDepth.Load(r1.xyz).x;
r2.xy = v0.xy * Unproject.xy + Unproject.zw;
r1.xy = r2.xy * r1.zz;
r1.w = 1;



r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30);
r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31);
r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32);



r0.w = -CascadeShadowSettings.x + r0.w;
r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5);
r1.zw = floor(r1.xy);
r1.xy = r1.xy + -r1.zw;
r1.zw = float2(-0.5,-0.5) + r1.zw;
r2.xy = float2(2,2) + -r1.xy;
r2.zw = -r1.yx * float2(2,2) + float2(3,3);
r2.xy = r2.xy / r2.wz;
r3.zw = float2(-1,-1) + r2.xy;
r2.xy = r1.xy * float2(2,2) + float2(1,1);
r1.xy = r1.xy / r2.xy;
r3.xy = float2(1,1) + r1.xy;
r1.x = 1 / CascadeShadowMapSize;
r4.xyzw = r3.zwxw * r1.xxxx;
r3.xyzw = r3.zyxy * r1.xxxx;
r0.xy = r1.zw * r1.xx + r4.zw;
r4.xy = r1.zw * r1.xx + r4.xy;
r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r0.xyz, r0.w).x;
r0.yz = r2.xy * r2.zw;
r1.y = r2.w * r2.z;
r2.x = r2.x * r2.y;
r0.x = r0.y * r0.x;
r4.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x;
r0.x = r1.y * r0.y + r0.x;
r4.xy = r1.zw * r1.xx + r3.xy;
r1.xy = r1.zw * r1.xx + r3.zw;
r4.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x;
r0.x = r0.z * r0.y + r0.x;
r1.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.w).x;
r0.x = r2.x * r0.y + r0.x;
o0.x = 0.0625 * r0.x;
return;
}

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


I have tried most of the usual stuff, but it failed:(
Anyone has any idea on how to fix this one? (is a shadow Shader for the record ^_^)


Edit:
the VS is this:
// ---- Created with 3Dmigoto v1.2.66 on Thu Oct 26 19:50:07 2017

cbuffer _Globals : register(b0)
{
float3 LightDir : packoffset(c0);
float4x4 ShadowVolumeTransform : packoffset(c1);
float4 Unproject : packoffset(c5);
float4x4 EyeToLightSpace : packoffset(c6);
float2 CascadeShadowSettings : packoffset(c10);
float CascadeIndex : packoffset(c10.z);
float CascadeShadowMapSize : packoffset(c10.w);
float2 RcpDeferredShadowMapSize : packoffset(c11);
}



// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
uint v0 : SV_VertexID0,
out float4 o0 : SV_Position0)
{
const float4 icb[] = { { 0, 1, 2, 3},
{ 4, 7, 6, 5},
{ 0, 4, 5, 1},
{ 3, 2, 6, 7},
{ 0, 3, 7, 4},
{ 1, 5, 6, 2},
{ -1.000000, -1.000000, 0, 0},
{ 1.000000, -1.000000, 0, 0},
{ 1.000000, 1.000000, 0, 0},
{ -1.000000, 1.000000, 0, 0},
{ -1.000000, -1.000000, 1.000000, 0},
{ 1.000000, -1.000000, 1.000000, 0},
{ 1.000000, 1.000000, 1.000000, 0},
{ -1.000000, 1.000000, 1.000000, 0} };
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v0.x, vertex_id
float4 r0,r1;
uint4 bitmask, uiDest;
float4 fDest;

uiDest.x = (uint)v0.x / 3;
r1.x = (uint)v0.x % 3;
r0.x = uiDest.x;
r0.y = (int)r0.x & 1;
r0.x = (uint)r0.x >> 1;
r0.xyz = r0.yyy ? icb[r0.x+0].xyz : icb[r0.x+0].xzw;
r0.w = (int)r1.x + -2;
r1.xy = cmp((uint2)r1.xx < int2(1,2));
r1.z = r1.x ? 0 : r0.w;
r1.w = cmp((int)r1.y == 0);
r0.xyz = r1.xzw ? r0.xyz : 0;
r0.w = 0;
r0.xy = (int2)r0.yw | (int2)r0.xz;
r0.x = (int)r0.y | (int)r0.x;
r0.xyz = icb[r0.x+6].xyz;
r0.w = 1;
o0.x = dot(r0.xyzw, ShadowVolumeTransform._m00_m10_m20_m30);
o0.y = dot(r0.xyzw, ShadowVolumeTransform._m01_m11_m21_m31);
o0.z = dot(r0.xyzw, ShadowVolumeTransform._m02_m12_m22_m32);
o0.w = dot(r0.xyzw, ShadowVolumeTransform._m03_m13_m23_m33);
return;
}

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


Ps: Tried both the ASM and HLSL variant to fix (as I noticed the error there in HLSL ^_^)

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 10/26/2017 06:28 PM   
@helifax my first try with the PS will be this: [code]r1.z = LinearDepth.Load(r1.xyz).x; r2.xy = v0.xy * Unproject.xy + Unproject.zw; r1.xy = r2.xy * r1.zz; r1.w = 1; //Fix float4 stereo = StereoParams.Load(0); r1.x -= stereo.x * (r1.z - stereo.y); r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30); r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31); r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32); r0.w = -CascadeShadowSettings.x + r0.w; r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5);[/code] You see shadows separate (assuming shadows are 2D without any fix) with that code? no matter if there wrong, but at least separated (no 2D).
@helifax

my first try with the PS will be this:

r1.z = LinearDepth.Load(r1.xyz).x;
r2.xy = v0.xy * Unproject.xy + Unproject.zw;
r1.xy = r2.xy * r1.zz;
r1.w = 1;

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


r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30);
r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31);
r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32);



r0.w = -CascadeShadowSettings.x + r0.w;
r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5);


You see shadows separate (assuming shadows are 2D without any fix) with that code? no matter if there wrong, but at least separated (no 2D).

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

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

Posted 10/26/2017 08:47 PM   
Thks DHR, Tried all the "hacks" in my book;) Both regular and less than trivial;) After spending some time I am not sure this is the right shader;) Yes it does separate the shadows that are affected by this shader, but it looks like is missing a FOV division :( (Or frustum correction). Funny enough, I couldn't find the other PS for other shadows :( So, I bet is a CS (out of the 120) that actually controls the shadow/lighting. I could find one VS for all shadows though! And trying any correction on that gives 2D => again looks like a CS is in the middle (between VS and PS ) ^_^ Many thanks again! If you wonder what the game is, is ELEX ;) If you feel brave and want to try something new, give this game a go ;) Cheers, Helifax
Thks DHR,

Tried all the "hacks" in my book;) Both regular and less than trivial;)
After spending some time I am not sure this is the right shader;)

Yes it does separate the shadows that are affected by this shader, but it looks like is missing a FOV division :( (Or frustum correction).

Funny enough, I couldn't find the other PS for other shadows :(
So, I bet is a CS (out of the 120) that actually controls the shadow/lighting. I could find one VS for all shadows though! And trying any correction on that gives 2D => again looks like a CS is in the middle (between VS and PS ) ^_^

Many thanks again! If you wonder what the game is, is ELEX ;) If you feel brave and want to try something new, give this game a go ;)

Cheers,
Helifax

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 10/26/2017 09:12 PM   
If the shadows are 2D and using the previous fixing code you see the shadows separate (become 3D)....you are in the right track.... Next step, you need to find the correct signs for the formula and correct value for the FOV correction. Since in the headers you don't have the Projection Matrix (or the Inverse) you will need to use Frame Analysis for that later (probably the matrix is in an undeclared contant buffer or in the VS) Now try to multiplicate the fix for a value that align the shadows...start with 0.5... (changing the signs)...now you need some test and try different combinations. [code]r1.x -= stereo.x * (r1.z - stereo.y) * 0,5;[/code] If you see that the shadows are aligned even eye to eye (paralel) or moved strange when you move the camera....we need a different approach.
If the shadows are 2D and using the previous fixing code you see the shadows separate (become 3D)....you are in the right track.... Next step, you need to find the correct signs for the formula and correct value for the FOV correction.

Since in the headers you don't have the Projection Matrix (or the Inverse) you will need to use Frame Analysis for that later (probably the matrix is in an undeclared contant buffer or in the VS)

Now try to multiplicate the fix for a value that align the shadows...start with 0.5... (changing the signs)...now you need some test and try different combinations.

r1.x -= stereo.x * (r1.z - stereo.y) * 0,5;



If you see that the shadows are aligned even eye to eye (paralel) or moved strange when you move the camera....we need a different approach.

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

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

Posted 10/26/2017 09:26 PM   
So I tried different things in that shader. Nothing works. Close I came is this: [code] // ---- Created with 3Dmigoto v1.2.66 on Sat Oct 28 12:26:20 2017 cbuffer _Globals : register(b0) { float3 LightDir : packoffset(c0); float4x4 ShadowVolumeTransform : packoffset(c1); float4 Unproject : packoffset(c5); float4x4 EyeToLightSpace : packoffset(c6); float2 CascadeShadowSettings : packoffset(c10); float CascadeIndex : packoffset(c10.z); float CascadeShadowMapSize : packoffset(c10.w); float2 RcpDeferredShadowMapSize : packoffset(c11); } SamplerComparisonState SmpLessClampLinear_s : register(s0); Texture2D<float> LinearDepth : register(t0); Texture2DArray<float> CascadeShadowMap : register(t1); // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : SV_Position0, out float o0 : SV_Target0) { float4 r0,r1,r2,r3,r4; uint4 bitmask, uiDest; float4 fDest; r0.z = CascadeIndex; r1.xy = (int2)v0.xy; r1.zw = float2(0,0); r1.z = LinearDepth.Load(r1.xyz).x; //Fix float2 vPos = v0.xy * Unproject.xy + Unproject.zw; float4 stereo = StereoParams.Load(0); //vPos.x += stereo.x * (r1.z / stereo.y -1); vPos.x -= stereo.x; r2.xy = vPos.xy; //r2.xy = v0.xy * Unproject.xy + Unproject.zw; r1.xy = r2.xy * r1.zz; r1.w = 1; r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30); r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31); r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32); r0.w = -CascadeShadowSettings.x + r0.w; r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5); r1.zw = floor(r1.xy); r1.xy = r1.xy + -r1.zw; r1.zw = float2(-0.5,-0.5) + r1.zw; r2.xy = float2(2,2) + -r1.xy; r2.zw = -r1.yx * float2(2,2) + float2(3,3); r2.xy = r2.xy / r2.wz; r3.zw = float2(-1,-1) + r2.xy; r2.xy = r1.xy * float2(2,2) + float2(1,1); r1.xy = r1.xy / r2.xy; r3.xy = float2(1,1) + r1.xy; r1.x = 1 / CascadeShadowMapSize; r4.xyzw = r3.zwxw * r1.xxxx; r3.xyzw = r3.zyxy * r1.xxxx; r0.xy = r1.zw * r1.xx + r4.zw; r4.xy = r1.zw * r1.xx + r4.xy; r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r0.xyz, r0.w).x; r0.yz = r2.xy * r2.zw; r1.y = r2.w * r2.z; r2.x = r2.x * r2.y; r0.x = r0.y * r0.x; r4.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x; r0.x = r1.y * r0.y + r0.x; r4.xy = r1.zw * r1.xx + r3.xy; r1.xy = r1.zw * r1.xx + r3.zw; r4.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x; r0.x = r0.z * r0.y + r0.x; r1.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.w).x; r0.x = r2.x * r0.y + r0.x; o0.x = 0.0625 * r0.x; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [/code] Shadows are in 3D but it seems they are pushed at infinity. They look OK in the background but too much separation near the character. This is because I only use the stereo separation. Weird thing is that normally things are the other way around: They look ok close, but not far. Again, I am running out of ideas :( One thing to note: "vPos.x += stereo.x * (r1.z / stereo.y -1);" GIVES the EXACT same result as "vPos.x -= stereo.x;" [img]https://forums.geforce.com/cmd/default/download-comment-attachment/73940/[/img]
So I tried different things in that shader. Nothing works.
Close I came is this:

// ---- Created with 3Dmigoto v1.2.66 on Sat Oct 28 12:26:20 2017

cbuffer _Globals : register(b0)
{
float3 LightDir : packoffset(c0);
float4x4 ShadowVolumeTransform : packoffset(c1);
float4 Unproject : packoffset(c5);
float4x4 EyeToLightSpace : packoffset(c6);
float2 CascadeShadowSettings : packoffset(c10);
float CascadeIndex : packoffset(c10.z);
float CascadeShadowMapSize : packoffset(c10.w);
float2 RcpDeferredShadowMapSize : packoffset(c11);
}

SamplerComparisonState SmpLessClampLinear_s : register(s0);
Texture2D<float> LinearDepth : register(t0);
Texture2DArray<float> CascadeShadowMap : register(t1);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


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

r0.z = CascadeIndex;
r1.xy = (int2)v0.xy;
r1.zw = float2(0,0);
r1.z = LinearDepth.Load(r1.xyz).x;

//Fix
float2 vPos = v0.xy * Unproject.xy + Unproject.zw;
float4 stereo = StereoParams.Load(0);
//vPos.x += stereo.x * (r1.z / stereo.y -1);
vPos.x -= stereo.x;

r2.xy = vPos.xy;
//r2.xy = v0.xy * Unproject.xy + Unproject.zw;

r1.xy = r2.xy * r1.zz;
r1.w = 1;



r2.x = dot(r1.xyzw, EyeToLightSpace._m00_m10_m20_m30);
r2.y = dot(r1.xyzw, EyeToLightSpace._m01_m11_m21_m31);
r0.w = dot(r1.xyzw, EyeToLightSpace._m02_m12_m22_m32);
r0.w = -CascadeShadowSettings.x + r0.w;
r1.xy = r2.xy * CascadeShadowMapSize + float2(0.5,0.5);
r1.zw = floor(r1.xy);
r1.xy = r1.xy + -r1.zw;
r1.zw = float2(-0.5,-0.5) + r1.zw;
r2.xy = float2(2,2) + -r1.xy;
r2.zw = -r1.yx * float2(2,2) + float2(3,3);
r2.xy = r2.xy / r2.wz;
r3.zw = float2(-1,-1) + r2.xy;
r2.xy = r1.xy * float2(2,2) + float2(1,1);
r1.xy = r1.xy / r2.xy;
r3.xy = float2(1,1) + r1.xy;
r1.x = 1 / CascadeShadowMapSize;
r4.xyzw = r3.zwxw * r1.xxxx;
r3.xyzw = r3.zyxy * r1.xxxx;
r0.xy = r1.zw * r1.xx + r4.zw;
r4.xy = r1.zw * r1.xx + r4.xy;
r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r0.xyz, r0.w).x;
r0.yz = r2.xy * r2.zw;
r1.y = r2.w * r2.z;
r2.x = r2.x * r2.y;
r0.x = r0.y * r0.x;
r4.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x;
r0.x = r1.y * r0.y + r0.x;
r4.xy = r1.zw * r1.xx + r3.xy;
r1.xy = r1.zw * r1.xx + r3.zw;
r4.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.w).x;
r0.x = r0.z * r0.y + r0.x;
r1.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.w).x;
r0.x = r2.x * r0.y + r0.x;
o0.x = 0.0625 * r0.x;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Shadows are in 3D but it seems they are pushed at infinity. They look OK in the background but too much separation near the character. This is because I only use the stereo separation.
Weird thing is that normally things are the other way around: They look ok close, but not far.

Again, I am running out of ideas :(


One thing to note: "vPos.x += stereo.x * (r1.z / stereo.y -1);" GIVES the EXACT same result as "vPos.x -= stereo.x;"



Image
Attachments

ELEX001_085.jps

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 10/28/2017 12:58 PM   
@Helifax Start with the fix i suggest: [code]r1.x -= stereo.x * (r1.z - stereo.y) * FOV;[/code] In r1.z is the depth. you are not using it, that's why the shadows are paralel in each eye. You need to try changing the signs of the formula and FOV. For FOV try a fix number first, don't use constant buffers directly...when you have the FOV number you have to use Frame Analysis to locate the constant buffer that holds that number.
@Helifax

Start with the fix i suggest:

r1.x -= stereo.x * (r1.z - stereo.y) * FOV;


In r1.z is the depth. you are not using it, that's why the shadows are paralel in each eye.

You need to try changing the signs of the formula and FOV. For FOV try a fix number first, don't use constant buffers directly...when you have the FOV number you have to use Frame Analysis to locate the constant buffer that holds that number.

MY WEB

Helix Mod - Making 3D Better

My 3D Screenshot Gallery

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

Posted 10/28/2017 02:59 PM   
Hi Helifax, your shader is definitely the correct one. Looks like that is one of that games which needs some depth buffer offset and scaling. I almost fixed a shadow shader which is responsible for the very near shadows in the starting area when looking directly east. It only needs some view direction correction. I got some approximate offset and scale numbers by trial and error but maybe we could identify the real numbers in some buffers. PS e2152343856ed197: [code] // Very near Shadows, start area // ---- Created with 3Dmigoto v1.2.65 on Wed Oct 25 17:47:27 2017 cbuffer _Globals : register(b0) { float3 LightDir : packoffset(c0); float4x4 ShadowVolumeTransform : packoffset(c1); float4 Unproject : packoffset(c5); float4x4 EyeToLightSpace : packoffset(c6); float2 CascadeShadowSettings : packoffset(c10); float CascadeIndex : packoffset(c10.z); float CascadeShadowMapSize : packoffset(c10.w); float2 RcpDeferredShadowMapSize : packoffset(c11); } SamplerComparisonState SmpLessClampLinear_s : register(s0); Texture2D<float> LinearDepth : register(t0); Texture2DArray<float> CascadeShadowMap : register(t1); // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : SV_Position0, out float o0 : SV_Target0) { float4 r0,r1,r2,r3,r4,r5,r6,r7,r8; uint4 bitmask, uiDest; float4 fDest; r0.xy = (int2)v0.xy; r0.zw = float2(0,0); r0.z = LinearDepth.Load(r0.xyz).x; r1.xy = v0.xy * Unproject.xy + Unproject.zw; // still needs view angle correction float4 stereo = StereoParams.Load(0); float scale = 80; float off = 0.99 - stereo.y * 0.00333333; r1.x -= stereo.x * (r0.z * scale + off); r0.xy = r1.xy * r0.zz; r0.w = 1; r1.x = dot(r0.xyzw, EyeToLightSpace._m00_m10_m20_m30); r1.y = dot(r0.xyzw, EyeToLightSpace._m01_m11_m21_m31); r0.x = dot(r0.xyzw, EyeToLightSpace._m02_m12_m22_m32); r0.x = -CascadeShadowSettings.x + r0.x; r0.yz = r1.xy * CascadeShadowMapSize + float2(0.5,0.5); r1.xy = floor(r0.yz); r0.yz = -r1.xy + r0.yz; r1.xy = float2(-0.5,-0.5) + r1.xy; r1.zw = -r0.zy * float2(3,3) + float2(4,4); r2.xy = r0.yz * float2(3,3) + float2(1,1); r2.zw = r2.xy * r1.zw; r0.w = r1.w * r1.z; r3.xy = float2(7,7) * r1.zw; r4.z = CascadeIndex; r3.zw = -r0.yz * float2(2,2) + float2(3,3); r1.zw = r3.zw / r1.wz; r5.xw = float2(-2,-2) + r1.zw; r1.zw = float2(3,3) + r0.yz; r0.yz = r0.yz / r2.xy; r6.xy = float2(2,2) + r0.yz; r5.yz = float2(0.142857149,0.142857149) * r1.wz; r0.y = 1 / CascadeShadowMapSize; r7.xyzw = r5.xwzw * r0.yyyy; r4.xy = r1.xy * r0.yy + r7.zw; r7.xy = r1.xy * r0.yy + r7.xy; r0.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x; r0.z = r3.x * r0.z; r7.z = CascadeIndex; r1.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r7.xyz, r0.x).x; r0.z = r0.w * r1.z + r0.z; r4.z = CascadeIndex; r6.zw = r5.wy; r7.xyzw = r6.xzxw * r0.yyyy; r4.xy = r1.xy * r0.yy + r7.xy; r7.xy = r1.xy * r0.yy + r7.zw; r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x; r0.z = r2.z * r0.w + r0.z; r4.xyzw = r5.xyzy * r0.yyyy; r8.xy = r1.xy * r0.yy + r4.xy; r4.xy = r1.xy * r0.yy + r4.zw; r8.z = CascadeIndex; r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r8.xyz, r0.x).x; r0.z = r3.y * r0.w + r0.z; r4.z = CascadeIndex; r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x; r0.z = r0.w * 49 + r0.z; r1.zw = float2(7,7) * r2.xy; r0.w = r2.x * r2.y; r7.z = CascadeIndex; r2.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r7.xyz, r0.x).x; r0.z = r1.z * r2.x + r0.z; r5.y = r6.y; r3.xyzw = r5.xyzy * r0.yyyy; r2.xy = r1.xy * r0.yy + r3.xy; r3.xy = r1.xy * r0.yy + r3.zw; r1.xy = r1.xy * r0.yy; r1.xy = r6.xy * r0.yy + r1.xy; r2.z = CascadeIndex; r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r2.xyz, r0.x).x; r0.y = r2.w * r0.y + r0.z; r3.z = CascadeIndex; r0.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r3.xyz, r0.x).x; r0.y = r1.w * r0.z + r0.y; r1.z = CascadeIndex; r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.x).x; r0.x = r0.w * r0.x + r0.y; o0.x = 0.0069444445 * r0.x; return; } [/code] Have you already experimented with HUD shaders in ELEX? Looks like there is some real madness there. They even use different pixel shaders for different characters within the same word. Not enough with that, as soon as you enable the vertex shader fix for different partner PS, there are a lot of double correction and clipping issues (works with only one PS enabled). I'll write more about that if I've done more experiments.
Hi Helifax,

your shader is definitely the correct one. Looks like that is one of that games which needs some depth buffer offset and scaling.

I almost fixed a shadow shader which is responsible for the very near shadows in the starting area when looking directly east. It only needs some view direction correction. I got some approximate offset and scale numbers by trial and error but maybe we could identify the real numbers in some buffers.

PS e2152343856ed197:
// Very near Shadows, start area
// ---- Created with 3Dmigoto v1.2.65 on Wed Oct 25 17:47:27 2017

cbuffer _Globals : register(b0)
{
float3 LightDir : packoffset(c0);
float4x4 ShadowVolumeTransform : packoffset(c1);
float4 Unproject : packoffset(c5);
float4x4 EyeToLightSpace : packoffset(c6);
float2 CascadeShadowSettings : packoffset(c10);
float CascadeIndex : packoffset(c10.z);
float CascadeShadowMapSize : packoffset(c10.w);
float2 RcpDeferredShadowMapSize : packoffset(c11);
}

SamplerComparisonState SmpLessClampLinear_s : register(s0);
Texture2D<float> LinearDepth : register(t0);
Texture2DArray<float> CascadeShadowMap : register(t1);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
float4 v0 : SV_Position0,
out float o0 : SV_Target0)
{
float4 r0,r1,r2,r3,r4,r5,r6,r7,r8;
uint4 bitmask, uiDest;
float4 fDest;

r0.xy = (int2)v0.xy;
r0.zw = float2(0,0);
r0.z = LinearDepth.Load(r0.xyz).x;
r1.xy = v0.xy * Unproject.xy + Unproject.zw;

// still needs view angle correction
float4 stereo = StereoParams.Load(0);

float scale = 80;
float off = 0.99 - stereo.y * 0.00333333;

r1.x -= stereo.x * (r0.z * scale + off);

r0.xy = r1.xy * r0.zz;
r0.w = 1;
r1.x = dot(r0.xyzw, EyeToLightSpace._m00_m10_m20_m30);
r1.y = dot(r0.xyzw, EyeToLightSpace._m01_m11_m21_m31);
r0.x = dot(r0.xyzw, EyeToLightSpace._m02_m12_m22_m32);
r0.x = -CascadeShadowSettings.x + r0.x;
r0.yz = r1.xy * CascadeShadowMapSize + float2(0.5,0.5);
r1.xy = floor(r0.yz);
r0.yz = -r1.xy + r0.yz;
r1.xy = float2(-0.5,-0.5) + r1.xy;
r1.zw = -r0.zy * float2(3,3) + float2(4,4);
r2.xy = r0.yz * float2(3,3) + float2(1,1);
r2.zw = r2.xy * r1.zw;
r0.w = r1.w * r1.z;
r3.xy = float2(7,7) * r1.zw;
r4.z = CascadeIndex;
r3.zw = -r0.yz * float2(2,2) + float2(3,3);
r1.zw = r3.zw / r1.wz;
r5.xw = float2(-2,-2) + r1.zw;
r1.zw = float2(3,3) + r0.yz;
r0.yz = r0.yz / r2.xy;
r6.xy = float2(2,2) + r0.yz;
r5.yz = float2(0.142857149,0.142857149) * r1.wz;
r0.y = 1 / CascadeShadowMapSize;
r7.xyzw = r5.xwzw * r0.yyyy;
r4.xy = r1.xy * r0.yy + r7.zw;
r7.xy = r1.xy * r0.yy + r7.xy;
r0.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x;
r0.z = r3.x * r0.z;
r7.z = CascadeIndex;
r1.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r7.xyz, r0.x).x;
r0.z = r0.w * r1.z + r0.z;
r4.z = CascadeIndex;
r6.zw = r5.wy;
r7.xyzw = r6.xzxw * r0.yyyy;
r4.xy = r1.xy * r0.yy + r7.xy;
r7.xy = r1.xy * r0.yy + r7.zw;
r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x;
r0.z = r2.z * r0.w + r0.z;
r4.xyzw = r5.xyzy * r0.yyyy;
r8.xy = r1.xy * r0.yy + r4.xy;
r4.xy = r1.xy * r0.yy + r4.zw;
r8.z = CascadeIndex;
r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r8.xyz, r0.x).x;
r0.z = r3.y * r0.w + r0.z;
r4.z = CascadeIndex;
r0.w = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r4.xyz, r0.x).x;
r0.z = r0.w * 49 + r0.z;
r1.zw = float2(7,7) * r2.xy;
r0.w = r2.x * r2.y;
r7.z = CascadeIndex;
r2.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r7.xyz, r0.x).x;
r0.z = r1.z * r2.x + r0.z;
r5.y = r6.y;
r3.xyzw = r5.xyzy * r0.yyyy;
r2.xy = r1.xy * r0.yy + r3.xy;
r3.xy = r1.xy * r0.yy + r3.zw;
r1.xy = r1.xy * r0.yy;
r1.xy = r6.xy * r0.yy + r1.xy;
r2.z = CascadeIndex;
r0.y = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r2.xyz, r0.x).x;
r0.y = r2.w * r0.y + r0.z;
r3.z = CascadeIndex;
r0.z = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r3.xyz, r0.x).x;
r0.y = r1.w * r0.z + r0.y;
r1.z = CascadeIndex;
r0.x = CascadeShadowMap.SampleCmpLevelZero(SmpLessClampLinear_s, r1.xyz, r0.x).x;
r0.x = r0.w * r0.x + r0.y;
o0.x = 0.0069444445 * r0.x;
return;
}

Have you already experimented with HUD shaders in ELEX? Looks like there is some real madness there. They even use different pixel shaders for different characters within the same word. Not enough with that, as soon as you enable the vertex shader fix for different partner PS, there are a lot of double correction and clipping issues (works with only one PS enabled). I'll write more about that if I've done more experiments.
[quote="DHR"]@Helifax Start with the fix i suggest: [code]r1.x -= stereo.x * (r1.z - stereo.y) * FOV;[/code] In r1.z is the depth. you are not using it, that's why the shadows are paralel in each eye. You need to try changing the signs of the formula and FOV. For FOV try a fix number first, don't use constant buffers directly...when you have the FOV number you have to use Frame Analysis to locate the constant buffer that holds that number. [/quote] DHR, I already tried all of this and already told you it doesn't work! Don't you think I wouldn't ask for help it was so "trivial" ? :) I tried all of the ABC of shadow fixing, including inverting the "EyeToLightSpace" matrix (I have no idea in what space that is.) I said "F@ck it, let's try". Also other fancy and much more complicated stuff;) I even tried to get the damn Projection Matrix from a different VS to apply the damn FOV. The formula breaks the shadows completely (as the depth is wrong) @mx-2: I think is onto something there;)) And this is exactly what I believe is happening! Have you tried dumping the CB constants (Frame Analysis? If I remember right, I think Unproject.x is 0.916 something) I think we need to use those "Unprojects" to correctly scale the depth buffer! What are your thoughts? I didn't look into the VS for the HUD. If is a double correction we can fix that (in the Pixel Shaders). I started with these shadows are they are driving me crazy:)) Edit: The "unproject" cb looks like this: cb0[5].x: 0.00106916716 cb0[5].y: -0.00106916716 cb0[5].z: -1.02640045 cb0[5].w: 0.577350259
DHR said:@Helifax

Start with the fix i suggest:

r1.x -= stereo.x * (r1.z - stereo.y) * FOV;


In r1.z is the depth. you are not using it, that's why the shadows are paralel in each eye.

You need to try changing the signs of the formula and FOV. For FOV try a fix number first, don't use constant buffers directly...when you have the FOV number you have to use Frame Analysis to locate the constant buffer that holds that number.


DHR, I already tried all of this and already told you it doesn't work! Don't you think I wouldn't ask for help it was so "trivial" ? :) I tried all of the ABC of shadow fixing, including inverting the "EyeToLightSpace" matrix (I have no idea in what space that is.) I said "F@ck it, let's try". Also other fancy and much more complicated stuff;) I even tried to get the damn Projection Matrix from a different VS to apply the damn FOV.
The formula breaks the shadows completely (as the depth is wrong)

@mx-2:
I think is onto something there;)) And this is exactly what I believe is happening!
Have you tried dumping the CB constants (Frame Analysis? If I remember right, I think Unproject.x is 0.916 something) I think we need to use those "Unprojects" to correctly scale the depth buffer!

What are your thoughts?

I didn't look into the VS for the HUD. If is a double correction we can fix that (in the Pixel Shaders). I started with these shadows are they are driving me crazy:))

Edit:

The "unproject" cb looks like this:

cb0[5].x: 0.00106916716
cb0[5].y: -0.00106916716
cb0[5].z: -1.02640045
cb0[5].w: 0.577350259

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 10/28/2017 05:34 PM   
I run into some problems in my Elex fix. I managed to fix point light shadows in Elex in this [url=https://github.com/mx-2/3d-fix/blob/master/Elex/ShaderFixes/f280a3ad5178fb31-cs.txt]huge compute shader[/url]. The fix itself is almost identical to the other shadow fixes in that game but it introduces some problems (see picture): - There are some strange artifacts around the players head and on that junk on the left - The far light is clipped on the left/right dependent on the rendered eye [img]https://forums.geforce.com/cmd/default/download-comment-attachment/73950/[/img] Second problem is that strange decal vertex shader which has some strange "dcl_input_sgv v1.x, instance_id" and "dcl_output_siv o2.xyzw, position" registers. These prevent using HLSL and in addition everything in this shader behaves differently. If I add some constant values to any of the outputs nothing happens. If I multiply on output with a constant slightly above 1, the objects move a bit. However, if I increase these values to about 1.8 the whole objects get clipped even though the PS is modified to output constant color. [code] // // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // using 3Dmigoto v1.2.65 on Sat Oct 21 13:12:52 2017 // // // Buffer Definitions: // // cbuffer cb_Globals // { // // struct SGlobalConstants // { // // float4x4 m_matViewProjection; // Offset: 0 // float4x4 m_matInvProjection; // Offset: 64 // float4x4 m_matProjection; // Offset: 128 // float4x4 m_matView; // Offset: 192 // float4x4 m_matCameraViewProjection;// Offset: 256 // float4x4 m_matCameraProjection;// Offset: 320 // float4 m_frustumPlanes[6]; // Offset: 384 // float3 m_vecCamPos; // Offset: 480 // float m_fFar; // Offset: 492 // float3 m_vecWorldCamPos; // Offset: 496 // float m_fRcpFar; // Offset: 508 // float3 m_vecRenderOffset; // Offset: 512 // float m_fNear; // Offset: 524 // float3 m_vecCamDir; // Offset: 528 // float m_fExposure; // Offset: 540 // float2 m_vecViewPortSize; // Offset: 544 // float2 m_vecRcpViewPortSize; // Offset: 552 // float2 m_vecDistortionScale; // Offset: 560 // float m_fFoV; // Offset: 568 // float _padding0; // Offset: 572 // float m_fCamAzimuth; // Offset: 576 // float m_fTime; // Offset: 580 // float m_fFrameTime; // Offset: 584 // float m_fAdaptiveTessellationFactor;// Offset: 588 // float2 m_vecMiePhaseConstants; // Offset: 592 // float m_fOceanWaterLevel; // Offset: 600 // float m_fRenderOffsetOceanWaterLevel;// Offset: 604 // float4 m_vecOceanColorAndOpacity;// Offset: 608 // float2 m_vecOceanTexCoordScale;// Offset: 624 // float2 m_vecRcpOceanTexCoordScale;// Offset: 632 // float m_fWeatherTemperature; // Offset: 640 // float2 m_vecZToDepth; // Offset: 644 // float _padding1; // Offset: 652 // float3 m_vecSunDir; // Offset: 656 // float _padding2; // Offset: 668 // // } Globals; // Offset: 0 Size: 672 // // } // // cbuffer cb_InstanceData // { // // struct SDecalInstanceData // { // // struct SDecalInstance // { // // float4x4 m_matWorld; // Offset: 0 // float4x4 m_matScreenToTexCoord;// Offset: 64 // float4 m_vecClipScaleAndOffset;// Offset: 128 // float4 m_vecColor; // Offset: 144 // // } m_arrInstances[256]; // Offset: 0 // // } InstanceData; // Offset: 0 Size: 40960 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // cb_Globals cbuffer NA NA 0 1 // cb_InstanceData cbuffer NA NA 1 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // POSITION 0 xyz 0 NONE float xyz // SV_InstanceID 0 x 1 INSTID uint x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // WORLDPOS 0 xyz 0 NONE float xyz // DOMAINDATA 0 x 1 NONE uint x // SV_Position 0 xyzw 2 POS float xyzw // vs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[4], immediateIndexed dcl_constantbuffer cb1[2560], dynamicIndexed dcl_input v0.xyz dcl_input_sgv v1.x, instance_id dcl_output o0.xyz dcl_output o1.x dcl_output_siv o2.xyzw, position dcl_temps 3 imul null, r0.x, v1.x, l(10) mov r1.xyz, v0.xyzx mov r1.w, l(1.000000) dp4 r2.x, r1.xyzw, cb1[r0.x + 0].xyzw dp4 r2.y, r1.xyzw, cb1[r0.x + 1].xyzw dp4 r2.z, r1.xyzw, cb1[r0.x + 2].xyzw dp4 r0.x, r1.xyzw, cb1[r0.x + 3].xyzw div r0.xyz, r2.xyzx, r0.xxxx mov o0.xyz, r0.xyzx mov o1.x, v1.x mov r0.w, l(1.000000) dp4 o2.x, r0.xyzw, cb0[0].xyzw dp4 o2.y, r0.xyzw, cb0[1].xyzw dp4 o2.z, r0.xyzw, cb0[2].xyzw dp4 o2.w, r0.xyzw, cb0[3].xyzw ret // Approximately 16 instruction slots used [/code] Does anybody has an idea for a fix?
I run into some problems in my Elex fix. I managed to fix point light shadows in Elex in this huge compute shader. The fix itself is almost identical to the other shadow fixes in that game but it introduces some problems (see picture):
- There are some strange artifacts around the players head and on that junk on the left
- The far light is clipped on the left/right dependent on the rendered eye

Image

Second problem is that strange decal vertex shader which has some strange "dcl_input_sgv v1.x, instance_id" and "dcl_output_siv o2.xyzw, position" registers. These prevent using HLSL and in addition everything in this shader behaves differently.
If I add some constant values to any of the outputs nothing happens. If I multiply on output with a constant slightly above 1, the objects move a bit. However, if I increase these values to about 1.8 the whole objects get clipped even though the PS is modified to output constant color.

//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// using 3Dmigoto v1.2.65 on Sat Oct 21 13:12:52 2017
//
//
// Buffer Definitions:
//
// cbuffer cb_Globals
// {
//
// struct SGlobalConstants
// {
//
// float4x4 m_matViewProjection; // Offset: 0
// float4x4 m_matInvProjection; // Offset: 64
// float4x4 m_matProjection; // Offset: 128
// float4x4 m_matView; // Offset: 192
// float4x4 m_matCameraViewProjection;// Offset: 256
// float4x4 m_matCameraProjection;// Offset: 320
// float4 m_frustumPlanes[6]; // Offset: 384
// float3 m_vecCamPos; // Offset: 480
// float m_fFar; // Offset: 492
// float3 m_vecWorldCamPos; // Offset: 496
// float m_fRcpFar; // Offset: 508
// float3 m_vecRenderOffset; // Offset: 512
// float m_fNear; // Offset: 524
// float3 m_vecCamDir; // Offset: 528
// float m_fExposure; // Offset: 540
// float2 m_vecViewPortSize; // Offset: 544
// float2 m_vecRcpViewPortSize; // Offset: 552
// float2 m_vecDistortionScale; // Offset: 560
// float m_fFoV; // Offset: 568
// float _padding0; // Offset: 572
// float m_fCamAzimuth; // Offset: 576
// float m_fTime; // Offset: 580
// float m_fFrameTime; // Offset: 584
// float m_fAdaptiveTessellationFactor;// Offset: 588
// float2 m_vecMiePhaseConstants; // Offset: 592
// float m_fOceanWaterLevel; // Offset: 600
// float m_fRenderOffsetOceanWaterLevel;// Offset: 604
// float4 m_vecOceanColorAndOpacity;// Offset: 608
// float2 m_vecOceanTexCoordScale;// Offset: 624
// float2 m_vecRcpOceanTexCoordScale;// Offset: 632
// float m_fWeatherTemperature; // Offset: 640
// float2 m_vecZToDepth; // Offset: 644
// float _padding1; // Offset: 652
// float3 m_vecSunDir; // Offset: 656
// float _padding2; // Offset: 668
//
// } Globals; // Offset: 0 Size: 672
//
// }
//
// cbuffer cb_InstanceData
// {
//
// struct SDecalInstanceData
// {
//
// struct SDecalInstance
// {
//
// float4x4 m_matWorld; // Offset: 0
// float4x4 m_matScreenToTexCoord;// Offset: 64
// float4 m_vecClipScaleAndOffset;// Offset: 128
// float4 m_vecColor; // Offset: 144
//
// } m_arrInstances[256]; // Offset: 0
//
// } InstanceData; // Offset: 0 Size: 40960
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cb_Globals cbuffer NA NA 0 1
// cb_InstanceData cbuffer NA NA 1 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyz 0 NONE float xyz
// SV_InstanceID 0 x 1 INSTID uint x
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// WORLDPOS 0 xyz 0 NONE float xyz
// DOMAINDATA 0 x 1 NONE uint x
// SV_Position 0 xyzw 2 POS float xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[2560], dynamicIndexed
dcl_input v0.xyz
dcl_input_sgv v1.x, instance_id
dcl_output o0.xyz
dcl_output o1.x
dcl_output_siv o2.xyzw, position
dcl_temps 3
imul null, r0.x, v1.x, l(10)
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb1[r0.x + 0].xyzw
dp4 r2.y, r1.xyzw, cb1[r0.x + 1].xyzw
dp4 r2.z, r1.xyzw, cb1[r0.x + 2].xyzw
dp4 r0.x, r1.xyzw, cb1[r0.x + 3].xyzw
div r0.xyz, r2.xyzx, r0.xxxx
mov o0.xyz, r0.xyzx
mov o1.x, v1.x
mov r0.w, l(1.000000)
dp4 o2.x, r0.xyzw, cb0[0].xyzw
dp4 o2.y, r0.xyzw, cb0[1].xyzw
dp4 o2.z, r0.xyzw, cb0[2].xyzw
dp4 o2.w, r0.xyzw, cb0[3].xyzw
ret
// Approximately 16 instruction slots used

Does anybody has an idea for a fix?
Attachments

shadow-artifacts.jpg

  78 / 88    
Scroll To Top