Understanding 3D Migoto and the fixes we make
Hey All, I always been told in my fix threads to go look at others code and see what they did.. Well I have done that and well to be honest when I look at some of these what seem like more advanced fixes I just have not a clue what is being done and how they did it.. Here is an example code from some code and the fix for it.. [code]// UI - orange spinny thing when activating a door, etc. Highlight on // directional marker pointing to an enemy about to spot player cbuffer CSceneFireUiPrimitiveParameterProvider : register(b0) { float4 _BackgroundColor : packoffset(c0); float4 _BordersColor : packoffset(c1); float4 _ColorAdd : packoffset(c2); float4 _ColorAdjustment : packoffset(c3); float4 _ColorMultiplier : packoffset(c4); float4 _ColorTransparent : packoffset(c5); float4x4 _Transform : packoffset(c6); float4x4 _UVTransform : packoffset(c10); float2 _ViewportScaleXY : packoffset(c14); float _BordersSizeFloatArray[8] : packoffset(c15); float _Desaturation : packoffset(c22.y); float _DistanceFieldFloatArray[18] : packoffset(c23); float _LinePercentage : packoffset(c40.y); float _TexHeight : packoffset(c40.z); float _TexRatio : packoffset(c40.w); float _TextWidth : packoffset(c41); float _Time : packoffset(c41.y); } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float2 v0 : position0, out float4 o0 : SV_Position0, out float4 o1 : TEXCOORD0, out float4 o2 : TEXCOORD1) { float4 r0,r1; uint4 bitmask; r0.xy = v0.xy; r0.zw = float2(1.000000e+000,1.000000e+000); r1.x = dot(r0.xyww, _Transform._m00_m10_m20_m30); r1.y = dot(r0.xyww, _Transform._m01_m11_m21_m31); r1.xy = r1.xy * float2(2.000000e+000,2.000000e+000) + float2(-1.000000e+000,-1.000000e+000); o0.xy = float2(1.000000e+000,-1.000000e+000) * r1.xy; o0.z = dot(r0.xyww, _Transform._m02_m12_m22_m32); o0.w = dot(r0.xyww, _Transform._m03_m13_m23_m33); o1.xyzw = float4(1.000000e+000,1.000000e+000,1.000000e+000,1.000000e+000); o2.z = dot(r0.xyww, _UVTransform._m00_m10_m20_m30); o2.w = dot(r0.xyzw, _UVTransform._m01_m11_m21_m31); o2.xy = v0.xy; float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; float hud_depth = IniParams.Load(0).x; o0.x += separation * hud_depth; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // // Buffer Definitions: // // cbuffer CSceneFireUiPrimitiveParameterProvider // { // // float4 _BackgroundColor; // Offset: 0 Size: 16 [unused] // float4 _BordersColor; // Offset: 16 Size: 16 [unused] // float4 _ColorAdd; // Offset: 32 Size: 16 [unused] // float4 _ColorAdjustment; // Offset: 48 Size: 16 [unused] // float4 _ColorMultiplier; // Offset: 64 Size: 16 [unused] // float4 _ColorTransparent; // Offset: 80 Size: 16 [unused] // float4x4 _Transform; // Offset: 96 Size: 64 // float4x4 _UVTransform; // Offset: 160 Size: 64 // float2 _ViewportScaleXY; // Offset: 224 Size: 8 [unused] // float _BordersSizeFloatArray[8]; // Offset: 240 Size: 116 [unused] // float _Desaturation; // Offset: 356 Size: 4 [unused] // float _DistanceFieldFloatArray[18];// Offset: 368 Size: 276 [unused] // float _LinePercentage; // Offset: 644 Size: 4 [unused] // float _TexHeight; // Offset: 648 Size: 4 [unused] // float _TexRatio; // Offset: 652 Size: 4 [unused] // float _TextWidth; // Offset: 656 Size: 4 [unused] // float _Time; // Offset: 660 Size: 4 [unused] // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // CSceneFireUiPrimitiveParameterProvider cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // position 0 xy 0 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 POS float xyzw // TEXCOORD 0 xyzw 1 NONE float xyzw // TEXCOORD 1 xyzw 2 NONE float xyzw // vs_4_0 dcl_constantbuffer cb0[12], immediateIndexed dcl_input v0.xy dcl_output_siv o0.xyzw, position dcl_output o1.xyzw dcl_output o2.xyzw dcl_temps 2 mov r0.xy, v0.xyxx mov r0.zw, l(0,0,1.000000,1.000000) dp4 r1.x, r0.xyww, cb0[6].xyzw dp4 r1.y, r0.xyww, cb0[7].xyzw mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000) mul o0.xy, r1.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000)float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; float hud_depth = IniParams.Load(0).x; o0.x += separation * hud_depth; dp4 o0.z, r0.xyww, cb0[8].xyzw dp4 o0.w, r0.xyww, cb0[9].xyzw mov o1.xyzw, l(1.000000,1.000000,1.000000,1.000000) dp4 o2.z, r0.xyww, cb0[10].xyzw dp4 o2.w, r0.xyzw, cb0[11].xyzw mov o2.xy, v0.xyxx ret // Approximately 13 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] now I see this was for a UI element which I understand how to fix but what was used here makes no sence to me.. This is for Far Cry 4.. here is the line that fixed this problem: float4 stereo = StereoParams.Load(0); float separation = stereo.x; float convergence = stereo.y; float hud_depth = IniParams.Load(0).x; o0.x += separation * hud_depth; now IT seems to make a little sence but the last line where he writes in Hud Depth.. it makes no sence to mee basically I have not a clue but could some kind soul who is better at this them me break down whazt is being done here?? I would appreciate and would like to grow in my ability of making fixes and have done 5 3D Migoto fixes to date abit basic but they work.. Thznk you Nephilim'
Hey All,

I always been told in my fix threads to go look at others code and see what they did.. Well I have done that and well to be honest when I look at some of these what seem like more advanced fixes I just have not a clue what is being done and how they did it..

Here is an example code from some code and the fix for it..

// UI - orange spinny thing when activating a door, etc. Highlight on
// directional marker pointing to an enemy about to spot player

cbuffer CSceneFireUiPrimitiveParameterProvider : register(b0)
{
float4 _BackgroundColor : packoffset(c0);
float4 _BordersColor : packoffset(c1);
float4 _ColorAdd : packoffset(c2);
float4 _ColorAdjustment : packoffset(c3);
float4 _ColorMultiplier : packoffset(c4);
float4 _ColorTransparent : packoffset(c5);
float4x4 _Transform : packoffset(c6);
float4x4 _UVTransform : packoffset(c10);
float2 _ViewportScaleXY : packoffset(c14);
float _BordersSizeFloatArray[8] : packoffset(c15);
float _Desaturation : packoffset(c22.y);
float _DistanceFieldFloatArray[18] : packoffset(c23);
float _LinePercentage : packoffset(c40.y);
float _TexHeight : packoffset(c40.z);
float _TexRatio : packoffset(c40.w);
float _TextWidth : packoffset(c41);
float _Time : packoffset(c41.y);
}

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

void main(
float2 v0 : position0,
out float4 o0 : SV_Position0,
out float4 o1 : TEXCOORD0,
out float4 o2 : TEXCOORD1)
{
float4 r0,r1;
uint4 bitmask;
r0.xy = v0.xy;
r0.zw = float2(1.000000e+000,1.000000e+000);
r1.x = dot(r0.xyww, _Transform._m00_m10_m20_m30);
r1.y = dot(r0.xyww, _Transform._m01_m11_m21_m31);
r1.xy = r1.xy * float2(2.000000e+000,2.000000e+000) + float2(-1.000000e+000,-1.000000e+000);
o0.xy = float2(1.000000e+000,-1.000000e+000) * r1.xy;
o0.z = dot(r0.xyww, _Transform._m02_m12_m22_m32);
o0.w = dot(r0.xyww, _Transform._m03_m13_m23_m33);
o1.xyzw = float4(1.000000e+000,1.000000e+000,1.000000e+000,1.000000e+000);
o2.z = dot(r0.xyww, _UVTransform._m00_m10_m20_m30);
o2.w = dot(r0.xyzw, _UVTransform._m01_m11_m21_m31);
o2.xy = v0.xy;


float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;
float hud_depth = IniParams.Load(0).x;
o0.x += separation * hud_depth;

return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions:
//
// cbuffer CSceneFireUiPrimitiveParameterProvider
// {
//
// float4 _BackgroundColor; // Offset: 0 Size: 16 [unused]
// float4 _BordersColor; // Offset: 16 Size: 16 [unused]
// float4 _ColorAdd; // Offset: 32 Size: 16 [unused]
// float4 _ColorAdjustment; // Offset: 48 Size: 16 [unused]
// float4 _ColorMultiplier; // Offset: 64 Size: 16 [unused]
// float4 _ColorTransparent; // Offset: 80 Size: 16 [unused]
// float4x4 _Transform; // Offset: 96 Size: 64
// float4x4 _UVTransform; // Offset: 160 Size: 64
// float2 _ViewportScaleXY; // Offset: 224 Size: 8 [unused]
// float _BordersSizeFloatArray[8]; // Offset: 240 Size: 116 [unused]
// float _Desaturation; // Offset: 356 Size: 4 [unused]
// float _DistanceFieldFloatArray[18];// Offset: 368 Size: 276 [unused]
// float _LinePercentage; // Offset: 644 Size: 4 [unused]
// float _TexHeight; // Offset: 648 Size: 4 [unused]
// float _TexRatio; // Offset: 652 Size: 4 [unused]
// float _TextWidth; // Offset: 656 Size: 4 [unused]
// float _Time; // Offset: 660 Size: 4 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// CSceneFireUiPrimitiveParameterProvider cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// position 0 xy 0 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xyzw 1 NONE float xyzw
// TEXCOORD 1 xyzw 2 NONE float xyzw
//
vs_4_0
dcl_constantbuffer cb0[12], immediateIndexed
dcl_input v0.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_temps 2
mov r0.xy, v0.xyxx
mov r0.zw, l(0,0,1.000000,1.000000)
dp4 r1.x, r0.xyww, cb0[6].xyzw
dp4 r1.y, r0.xyww, cb0[7].xyzw
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul o0.xy, r1.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000)float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;
float hud_depth = IniParams.Load(0).x;
o0.x += separation * hud_depth;
dp4 o0.z, r0.xyww, cb0[8].xyzw
dp4 o0.w, r0.xyww, cb0[9].xyzw
mov o1.xyzw, l(1.000000,1.000000,1.000000,1.000000)
dp4 o2.z, r0.xyww, cb0[10].xyzw
dp4 o2.w, r0.xyzw, cb0[11].xyzw
mov o2.xy, v0.xyxx
ret
// Approximately 13 instruction slots used
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


now I see this was for a UI element which I understand how to fix but what was used here makes no sence to me.. This is for Far Cry 4..

here is the line that fixed this problem:

float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;
float hud_depth = IniParams.Load(0).x;
o0.x += separation * hud_depth;

now IT seems to make a little sence but the last line where he writes in Hud Depth.. it makes no sence to mee basically I have not a clue but could some kind soul who is better at this them me break down whazt is being done here??

I would appreciate and would like to grow in my ability of making fixes and have done 5 3D Migoto fixes to date abit basic but they work..


Thznk you
Nephilim'

Intel i5 7600K @ 4.8ghz / MSI Z270 SLI / Asus 1080GTX - 416.16 / Optoma HD142x Projector / 1 4'x10' Curved Screen PVC / TrackIR / HOTAS Cougar / Cougar MFD's / Track IR / NVidia 3D Vision / Win 10 64bit

#1
Posted 03/24/2017 10:20 PM   
Right, this is one of the most simplistic fixes actually. Nothing really advanced here and no linear algebra or "space" manipulation (which some might say is a bit advanced - as a learning curve - but it is really is basic when it comes to Computer generated graphics). Let's pick one by one: [code] float4 stereo = StereoParams.Load(0); [/code] float4 - means is a vector that holds 4 elements .xyzw and each element is a float (ex: 1.234) stereo - is the name of the variable StereoParams.Load(0) - means is loading the "magical" stereo cbuffer that 3D Vision Automatic uses and passes the values inside the "stereo" vector. [code] float separation = stereo.x; float convergence = stereo.y; [/code] separation - passes the value from the previous defined value on the component x - which is the separation. convergence - passes the value from the previous defined value on the component y - which is the convergence. Convergence is not use here. As you can see below. [code] float hud_depth = IniParams.Load(0).x; [/code] hud_depth - is a float and is read from the d3dx.ini file. There under [Constants] you define "x = 0.5" (For example). This line, reads the ini file and finds that X value and stores it into "hud_depth". [code] o0.x += separation * hud_depth; [/code] This is obviously a vertex shader (from the oO which is the primary position output - as defined in the main() function and denoted by "vs_4_0" - Vertex Shader version 4.0). Thus, for every on-screen element that is shown on screen and is computed by this vertex shader, we modify the position: - By multiplying the SEPARATION (per eye) with our X constant (from the ini file) - and ADDING it to the existing position of each element calculated by this vertex shader. For reference: Oo.x - is the X position - left, right position Oo.x - is the y position - up, down position Oo.x - is the Z position - DEPTH position Oo.x - is the X position - Clip Space "depth" position ( a bit more advanced here, so I'll not go into detail, but imagine it the DEPTH relative to you SCREEN and not the WORLD of the game - which is .z). Hope this is clear enough;) Let me know if you still find my explanation too ambiguous;) Cheers, Helifax Edit: Also don't know if you followed this one, but bo3b made a very good wiki and tutorials. I know is a bit "outdated" as is DX9, but the RULES are the same. Only semantics differ: http://wiki.bo3b.net/index.php?title=Bo3b%27s_School_for_Shaderhackers DX11 is easier as is baically "C" language and not shader ASM (assembly) language, but the exact same rules apply. Just easier to "code" in DX11 ;)
Right, this is one of the most simplistic fixes actually. Nothing really advanced here and no linear algebra or "space" manipulation (which some might say is a bit advanced - as a learning curve - but it is really is basic when it comes to Computer generated graphics).

Let's pick one by one:

float4 stereo = StereoParams.Load(0);


float4 - means is a vector that holds 4 elements .xyzw and each element is a float (ex: 1.234)
stereo - is the name of the variable
StereoParams.Load(0) - means is loading the "magical" stereo cbuffer that 3D Vision Automatic uses and passes the values inside the "stereo" vector.

float separation = stereo.x; 
float convergence = stereo.y;

separation - passes the value from the previous defined value on the component x - which is the separation.
convergence - passes the value from the previous defined value on the component y - which is the convergence.

Convergence is not use here. As you can see below.

float hud_depth = IniParams.Load(0).x;


hud_depth - is a float and is read from the d3dx.ini file. There under [Constants] you define "x = 0.5" (For example). This line, reads the ini file and finds that X value and stores it into "hud_depth".

o0.x += separation * hud_depth;


This is obviously a vertex shader (from the oO which is the primary position output - as defined in the main() function and denoted by "vs_4_0" - Vertex Shader version 4.0).
Thus, for every on-screen element that is shown on screen and is computed by this vertex shader, we modify the position:
- By multiplying the SEPARATION (per eye) with our X constant (from the ini file)
- and ADDING it to the existing position of each element calculated by this vertex shader.

For reference:
Oo.x - is the X position - left, right position
Oo.x - is the y position - up, down position
Oo.x - is the Z position - DEPTH position
Oo.x - is the X position - Clip Space "depth" position ( a bit more advanced here, so I'll not go into detail, but imagine it the DEPTH relative to you SCREEN and not the WORLD of the game - which is .z).

Hope this is clear enough;) Let me know if you still find my explanation too ambiguous;)

Cheers,
Helifax

Edit:
Also don't know if you followed this one, but bo3b made a very good wiki and tutorials. I know is a bit "outdated" as is DX9, but the RULES are the same. Only semantics differ:
http://wiki.bo3b.net/index.php?title=Bo3b%27s_School_for_Shaderhackers

DX11 is easier as is baically "C" language and not shader ASM (assembly) language, but the exact same rules apply. Just easier to "code" in DX11 ;)

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)

#2
Posted 03/24/2017 11:27 PM   
Well yes as they say easy when you know it looked advanced to me as I am bot A Programmer of the sort.. I do appreciate your time in explaining this that makes a lot of scece thank you.. Yes I did look at that guide but will have another look.. Just want to better understand this stuff as to keep making fixes
Well yes as they say easy when you know it looked advanced to me as I am bot A Programmer of the sort.. I do appreciate your time in explaining this that makes a lot of scece thank you..

Yes I did look at that guide but will have another look.. Just want to better understand this stuff as to keep making fixes

Intel i5 7600K @ 4.8ghz / MSI Z270 SLI / Asus 1080GTX - 416.16 / Optoma HD142x Projector / 1 4'x10' Curved Screen PVC / TrackIR / HOTAS Cougar / Cougar MFD's / Track IR / NVidia 3D Vision / Win 10 64bit

#3
Posted 03/25/2017 01:57 AM   
You've made 5 fixes? That's awesome. If you want access to the shared shaderhacker accounts, PM me.
You've made 5 fixes? That's awesome. If you want access to the shared shaderhacker accounts, PM me.

#4
Posted 03/25/2017 06:44 AM   
Hey Wow thank you Pirateguybush.. I will send a PM. if there are any rules I should strictly follow just let me know what to do as to keep everything running good.. The above help was very good it all seems a bit more understandable now I really appreciate the help as I can grow and create better and more fixes.. This is a bit addicting I like fixing almost as much as playing.. Thank you to all who made and make 3D Migoto what it is ..
Hey Wow thank you Pirateguybush.. I will send a PM. if there are any rules I should strictly follow just let me know what to do as to keep everything running good..

The above help was very good it all seems a bit more understandable now I really appreciate the help as I can grow and create better and more fixes..

This is a bit addicting I like fixing almost as much as playing.. Thank you to all who made and make 3D Migoto what it is ..

Intel i5 7600K @ 4.8ghz / MSI Z270 SLI / Asus 1080GTX - 416.16 / Optoma HD142x Projector / 1 4'x10' Curved Screen PVC / TrackIR / HOTAS Cougar / Cougar MFD's / Track IR / NVidia 3D Vision / Win 10 64bit

#5
Posted 03/26/2017 12:52 AM   
If you any questions, please let us know;) I am always happy to help anyone to wants to learn and understand this;) It might seem "Magical", but is really not;) Although, the results ARE pretty magical;))
If you any questions, please let us know;)
I am always happy to help anyone to wants to learn and understand this;)
It might seem "Magical", but is really not;) Although, the results ARE pretty magical;))

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)

#6
Posted 03/26/2017 01:15 AM   
Well sure I have a few or more questions as I am still learning about how this all works.. I have gotten most of my odes I use in my Dedicated threads.. Is there a thread I could ask these questions or would here be OK?? I appreciate the help thank you guys..
Well sure I have a few or more questions as I am still learning about how this all works.. I have gotten most of my odes I use in my Dedicated threads..

Is there a thread I could ask these questions or would here be OK??

I appreciate the help thank you guys..

Intel i5 7600K @ 4.8ghz / MSI Z270 SLI / Asus 1080GTX - 416.16 / Optoma HD142x Projector / 1 4'x10' Curved Screen PVC / TrackIR / HOTAS Cougar / Cougar MFD's / Track IR / NVidia 3D Vision / Win 10 64bit

#7
Posted 03/26/2017 01:47 AM   
OK here is a line from Elite Dangerous that fixes Ultra Shadows.. I would like to make this work for FFXIV which still needs the shadows fixed.. here is the code used in Elite Dangerous: [code] // Ultra shadows - fixed cbuffer cb0 : register(b0) { float4 cb0[38]; } Texture2D<float4> StereoParams : register(t125); Texture1D<float4> IniParams : register(t120); void main( float3 v0 : TEXCOORD0, float3 v1 : TEXCOORD1, uint v2 : TEXCOORD2, out float3 o0 : TEXCOORD0, out float4 o1 : TEXCOORD1, out float4 o2 : TEXCOORD2, out float4 o3 : TEXCOORD3, out float3 o4 : TEXCOORD4, out float3 o5 : TEXCOORD5, out float3 o6 : TEXCOORD6, out float4 o7 : SV_Position0) { float4 r0,r1,r2,r3; uint4 bitmask, uiDest; float4 fDest; r0.xyz = v0.xyz; r0.w = 1.000000000e+000; r1.x = dot(cb0[0].xyzw, r0.xyzw); r1.y = dot(cb0[1].xyzw, r0.xyzw); r1.w = dot(cb0[3].xyzw, r0.xyzw); o7.z = dot(cb0[2].xyzw, r0.xyzw); o0.xyz = r1.xyw; float4 stereo = StereoParams.Load(0); float4 params = IniParams.Load(0); o0.x += stereo.x * (o0.z - stereo.y); o7.xyw = r1.xyw; r0.x = v2.x; o1.xyzw = cb0[r0.x+30].xyzw; r1.xyz = -cb0[4].xyz + v0.xyz; r2.w = dot(r1.xyz, cb0[5].xyz); o2.w = r2.w; o2.xyz = r1.xyz; r3.w = 0.000000000e+000; r1.w = 1.000000000e+000; r2.x = dot(r1.xyzw, cb0[r0.x+6].xyzw); r2.y = dot(r1.xyzw, cb0[r0.x+14].xyzw); r2.z = dot(r1.xyzw, cb0[r0.x+22].xyzw); o4.xyz = r1.xyz; r3.x = cb0[r0.x+6].w; r3.y = cb0[r0.x+14].w; r3.z = cb0[r0.x+22].w; o3.xyzw = -r3.xyzw + r2.xyzw; o6.xyz = r3.xyz; o5.xyz = -cb0[4].xyz + v1.xyz; return; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // TEXCOORD 0 xyz 0 NONE float xyz // TEXCOORD 1 xyz 1 NONE float xyz // TEXCOORD 2 x 2 NONE uint x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // TEXCOORD 0 xyz 0 NONE float xyz // TEXCOORD 1 xyzw 1 NONE float xyzw // TEXCOORD 2 xyzw 2 NONE float xyzw // TEXCOORD 3 xyzw 3 NONE float xyzw // TEXCOORD 4 xyz 4 NONE float xyz // TEXCOORD 5 xyz 5 NONE float xyz // TEXCOORD 6 xyz 6 NONE float xyz // SV_Position 0 xyzw 7 POS float xyzw // vs_4_0 dcl_constantbuffer cb0[38], dynamicIndexed dcl_input v0.xyz dcl_input v1.xyz dcl_input v2.x dcl_output o0.xyz dcl_output o1.xyzw dcl_output o2.xyzw dcl_output o3.xyzw dcl_output o4.xyz dcl_output o5.xyz dcl_output o6.xyz dcl_output_siv o7.xyzw, position dcl_temps 4 mov r0.xyz, v0.xyzx mov r0.w, l(1.000000) dp4 r1.x, cb0[0].xyzw, r0.xyzw dp4 r1.y, cb0[1].xyzw, r0.xyzw dp4 r1.w, cb0[3].xyzw, r0.xyzw dp4 o7.z, cb0[2].xyzw, r0.xyzw mov o0.xyz, r1.xywx mov o7.xyw, r1.xyxw mov r0.x, v2.x mov o1.xyzw, cb0[r0.x + 30].xyzw add r1.xyz, v0.xyzx, -cb0[4].xyzx dp3 r2.w, r1.xyzx, cb0[5].xyzx mov o2.w, r2.w mov o2.xyz, r1.xyzx mov r3.w, l(0) mov r1.w, l(1.000000) dp4 r2.x, r1.xyzw, cb0[r0.x + 6].xyzw dp4 r2.y, r1.xyzw, cb0[r0.x + 14].xyzw dp4 r2.z, r1.xyzw, cb0[r0.x + 22].xyzw mov o4.xyz, r1.xyzx mov r3.x, cb0[r0.x + 6].w mov r3.y, cb0[r0.x + 14].w mov r3.z, cb0[r0.x + 22].w add o3.xyzw, r2.xyzw, -r3.xyzw mov o6.xyz, r3.xyzx add o5.xyz, v1.xyzx, -cb0[4].xyzx ret // Approximately 0 instruction slots used ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ [/code] now from what I can tell the new code injected was the following: float4 stereo = StereoParams.Load(0); float4 params = IniParams.Load(0); o0.x += stereo.x * (o0.z - stereo.y); Now would this be a universal shadow fix or possibly work for FFXIV?? I know shadows are a little bit more harder to fix and IF I am getting to far ahead please let me know.. Also with those shader hacker classes I did most of them and ran through the last 2. that made me get it a bit more but there seems to be so much more to understand.. ;)
OK here is a line from Elite Dangerous that fixes Ultra Shadows.. I would like to make this work for FFXIV which still needs the shadows fixed.. here is the code used in Elite Dangerous:


// Ultra shadows - fixed

cbuffer cb0 : register(b0)
{
float4 cb0[38];
}


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

void main(
float3 v0 : TEXCOORD0,
float3 v1 : TEXCOORD1,
uint v2 : TEXCOORD2,
out float3 o0 : TEXCOORD0,
out float4 o1 : TEXCOORD1,
out float4 o2 : TEXCOORD2,
out float4 o3 : TEXCOORD3,
out float3 o4 : TEXCOORD4,
out float3 o5 : TEXCOORD5,
out float3 o6 : TEXCOORD6,
out float4 o7 : SV_Position0)
{
float4 r0,r1,r2,r3;
uint4 bitmask, uiDest;
float4 fDest;

r0.xyz = v0.xyz;
r0.w = 1.000000000e+000;
r1.x = dot(cb0[0].xyzw, r0.xyzw);
r1.y = dot(cb0[1].xyzw, r0.xyzw);
r1.w = dot(cb0[3].xyzw, r0.xyzw);
o7.z = dot(cb0[2].xyzw, r0.xyzw);
o0.xyz = r1.xyw;
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o0.x += stereo.x * (o0.z - stereo.y);
o7.xyw = r1.xyw;
r0.x = v2.x;
o1.xyzw = cb0[r0.x+30].xyzw;
r1.xyz = -cb0[4].xyz + v0.xyz;
r2.w = dot(r1.xyz, cb0[5].xyz);
o2.w = r2.w;
o2.xyz = r1.xyz;
r3.w = 0.000000000e+000;
r1.w = 1.000000000e+000;
r2.x = dot(r1.xyzw, cb0[r0.x+6].xyzw);
r2.y = dot(r1.xyzw, cb0[r0.x+14].xyzw);
r2.z = dot(r1.xyzw, cb0[r0.x+22].xyzw);
o4.xyz = r1.xyz;
r3.x = cb0[r0.x+6].w;
r3.y = cb0[r0.x+14].w;
r3.z = cb0[r0.x+22].w;
o3.xyzw = -r3.xyzw + r2.xyzw;
o6.xyz = r3.xyz;
o5.xyz = -cb0[4].xyz + v1.xyz;
return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyz 0 NONE float xyz
// TEXCOORD 1 xyz 1 NONE float xyz
// TEXCOORD 2 x 2 NONE uint x
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyz 0 NONE float xyz
// TEXCOORD 1 xyzw 1 NONE float xyzw
// TEXCOORD 2 xyzw 2 NONE float xyzw
// TEXCOORD 3 xyzw 3 NONE float xyzw
// TEXCOORD 4 xyz 4 NONE float xyz
// TEXCOORD 5 xyz 5 NONE float xyz
// TEXCOORD 6 xyz 6 NONE float xyz
// SV_Position 0 xyzw 7 POS float xyzw
//
vs_4_0
dcl_constantbuffer cb0[38], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.x
dcl_output o0.xyz
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xyz
dcl_output_siv o7.xyzw, position
dcl_temps 4
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, cb0[0].xyzw, r0.xyzw
dp4 r1.y, cb0[1].xyzw, r0.xyzw
dp4 r1.w, cb0[3].xyzw, r0.xyzw
dp4 o7.z, cb0[2].xyzw, r0.xyzw
mov o0.xyz, r1.xywx
mov o7.xyw, r1.xyxw
mov r0.x, v2.x
mov o1.xyzw, cb0[r0.x + 30].xyzw
add r1.xyz, v0.xyzx, -cb0[4].xyzx
dp3 r2.w, r1.xyzx, cb0[5].xyzx
mov o2.w, r2.w
mov o2.xyz, r1.xyzx
mov r3.w, l(0)
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[r0.x + 6].xyzw
dp4 r2.y, r1.xyzw, cb0[r0.x + 14].xyzw
dp4 r2.z, r1.xyzw, cb0[r0.x + 22].xyzw
mov o4.xyz, r1.xyzx
mov r3.x, cb0[r0.x + 6].w
mov r3.y, cb0[r0.x + 14].w
mov r3.z, cb0[r0.x + 22].w
add o3.xyzw, r2.xyzw, -r3.xyzw
mov o6.xyz, r3.xyzx
add o5.xyz, v1.xyzx, -cb0[4].xyzx
ret
// Approximately 0 instruction slots used

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



now from what I can tell the new code injected was the following:


float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o0.x += stereo.x * (o0.z - stereo.y);



Now would this be a universal shadow fix or possibly work for FFXIV?? I know shadows are a little bit more harder to fix and IF I am getting to far ahead please let me know..

Also with those shader hacker classes I did most of them and ran through the last 2. that made me get it a bit more but there seems to be so much more to understand.. ;)

Intel i5 7600K @ 4.8ghz / MSI Z270 SLI / Asus 1080GTX - 416.16 / Optoma HD142x Projector / 1 4'x10' Curved Screen PVC / TrackIR / HOTAS Cougar / Cougar MFD's / Track IR / NVidia 3D Vision / Win 10 64bit

#8
Posted 03/26/2017 10:32 PM   
[quote="The_Nephilim"]OK here is a line from Elite Dangerous that fixes Ultra Shadows.. I would like to make this work for FFXIV which still needs the shadows fixed.. here is the code used in Elite Dangerous: <snip> now from what I can tell the new code injected was the following: float4 stereo = StereoParams.Load(0); float4 params = IniParams.Load(0); o0.x += stereo.x * (o0.z - stereo.y); Now would this be a universal shadow fix or possibly work for FFXIV?? I know shadows are a little bit more harder to fix and IF I am getting to far ahead please let me know.. Also with those shader hacker classes I did most of them and ran through the last 2. that made me get it a bit more but there seems to be so much more to understand.. ;)[/quote] No, shadows are generally very hard to fix. They should really be one of the last things you try to fix, unless you enjoy a real challenge. For this example, that is the canonical stereo fixing formula, what I've called the Prime Directive. That is the simplest variant for shadows that you will run across. It literally does not get any easier than this. The problem with shadows is that they are highly variable. Nearly every game does something weirdly different, and it makes it so that there is no one-size-fits-all solution to shadows. Unlike say Skybox fixes, or haloing problems. So... it's always a possibility that FFXIV will do something sensible, but don't count on it. Asking questions here is OK, but it's probably better to use the main 3Dmigoto thread, because that's a common resource for everyone. Questions asked in specific game threads tend to get lost.
The_Nephilim said:OK here is a line from Elite Dangerous that fixes Ultra Shadows.. I would like to make this work for FFXIV which still needs the shadows fixed.. here is the code used in Elite Dangerous:


<snip>

now from what I can tell the new code injected was the following:


float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o0.x += stereo.x * (o0.z - stereo.y);



Now would this be a universal shadow fix or possibly work for FFXIV?? I know shadows are a little bit more harder to fix and IF I am getting to far ahead please let me know..

Also with those shader hacker classes I did most of them and ran through the last 2. that made me get it a bit more but there seems to be so much more to understand.. ;)

No, shadows are generally very hard to fix. They should really be one of the last things you try to fix, unless you enjoy a real challenge.

For this example, that is the canonical stereo fixing formula, what I've called the Prime Directive. That is the simplest variant for shadows that you will run across. It literally does not get any easier than this.

The problem with shadows is that they are highly variable. Nearly every game does something weirdly different, and it makes it so that there is no one-size-fits-all solution to shadows. Unlike say Skybox fixes, or haloing problems.

So... it's always a possibility that FFXIV will do something sensible, but don't count on it.


Asking questions here is OK, but it's probably better to use the main 3Dmigoto thread, because that's a common resource for everyone. Questions asked in specific game threads tend to get lost.

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

#9
Posted 03/27/2017 08:04 PM   
Ah.. Shadows and lights are pretty hard to fix. They depend on: - What "space" they are in. - 99% of the time you fix them in a PIXEL/FRAGMENT shader and not a Vertex. - If they are already in Stereo but at wrong depth, they need to be made MONO in Vertex Shader and corrected in the Pixel Shader. In the pixel shader, you'll get into Linear Algebra and matrices manipulation. A basic understanding how 3D Graphics work (all the spaces) is also required.
Ah.. Shadows and lights are pretty hard to fix.
They depend on:
- What "space" they are in.
- 99% of the time you fix them in a PIXEL/FRAGMENT shader and not a Vertex.
- If they are already in Stereo but at wrong depth, they need to be made MONO in Vertex Shader and corrected in the Pixel Shader.

In the pixel shader, you'll get into Linear Algebra and matrices manipulation. A basic understanding how 3D Graphics work (all the spaces) is also required.

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)

#10
Posted 03/27/2017 08:13 PM   
@The_Nephilim, I know that I linked this to you previously, so you know about it. But I figured I'd put it for others looking at this thread that have not seen it yet. https://forums.geforce.com/default/topic/896196/ This is a thread made by andysonofbob [SIMPLIFIED GUIDE] Quick n easy shader disabling / fixing static objects' depth if rendered wrong. It's a nice guide to getting started with 3Dmigoto Also for those that do not know, there is a video and written course for learning the basics of dx9 shader hacking that also apply in principle to dx11 here https://forums.geforce.com/default/topic/766890/ Bo3b's School For Shaderhackers
@The_Nephilim, I know that I linked this to you previously, so you know about it. But I figured I'd put it for others looking at this thread that have not seen it yet.


https://forums.geforce.com/default/topic/896196/


This is a thread made by andysonofbob

[SIMPLIFIED GUIDE] Quick n easy shader disabling / fixing static objects' depth if rendered wrong.

It's a nice guide to getting started with 3Dmigoto




Also for those that do not know, there is a video and written course for learning the basics of dx9 shader hacking that also apply in principle to dx11 here


https://forums.geforce.com/default/topic/766890/


Bo3b's School For Shaderhackers

#11
Posted 03/28/2017 04:08 AM   
Scroll To Top