Bo3b's School For Shaderhackers
  60 / 88    
[quote="helifax"]Hi DarkStarSword, I am trying to use the DX11 Unity scripts and I am hitting some walls:( [code] unity_asset_extractor.py *_Data/Resources/* *_Data/*.assets # THIS WORKS cd extracted # THIS WORKS extract_unity_shaders.py */*.shader --type=d3d11 # THIS SEEM TO WORK cd ShaderFNVs # FAILED [/code] After the above scripts are run it fails to cd on "ShaderFNVs" folder as is missing. I did copy cmd_Decompiler.exe to both "3d-fixes" and game folders and from what I can see it should work? Am I doing something wrong? Thank you in advance![/quote] Open the command prompt in the game directory and try typing this: [code]extract_unity_shaders.py extracted/*/*.shader --type=d3d11[/code]
helifax said:Hi DarkStarSword,

I am trying to use the DX11 Unity scripts and I am hitting some walls:(

unity_asset_extractor.py *_Data/Resources/* *_Data/*.assets # THIS WORKS
cd extracted # THIS WORKS
extract_unity_shaders.py */*.shader --type=d3d11 # THIS SEEM TO WORK
cd ShaderFNVs # FAILED


After the above scripts are run it fails to cd on "ShaderFNVs" folder as is missing. I did copy cmd_Decompiler.exe to both "3d-fixes" and game folders and from what I can see it should work?

Am I doing something wrong? Thank you in advance!


Open the command prompt in the game directory and try typing this:
extract_unity_shaders.py extracted/*/*.shader --type=d3d11

Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35

Posted 07/10/2016 12:10 PM   
[quote="helifax"]Yupp, both autofix.sh and autofix53.sh fail there... I updated the specified files here: [url=http://3dsurroundgaming.com/3DVision/insideData_unity.rar]Assets Files[/url] Thank you again for taking the time and looking into this![/quote] :facepalm: This was a regression I introduced when adding support for Unity 5.3 that broke all older versions, but how I didn't catch this before... I guess I've only been working on 5.3 games since then... Anyway, all fixed now - update the scripts and try again.
helifax said:Yupp, both autofix.sh and autofix53.sh fail there...
I updated the specified files here: Assets Files

Thank you again for taking the time and looking into this!

:facepalm:

This was a regression I introduced when adding support for Unity 5.3 that broke all older versions, but how I didn't catch this before... I guess I've only been working on 5.3 games since then...

Anyway, all fixed now - update the scripts and try again.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/10/2016 01:03 PM   
[quote="masterotaku"]Am I mixing syntax in the ini with things like "Preset1" and "PRES3"?[/quote]Yeah, [Preset*] are for old versions, [PRES*] are for new versions - see this page: http://wiki.bo3b.net/index.php?title=HelixMod_Feature_List
masterotaku said:Am I mixing syntax in the ini with things like "Preset1" and "PRES3"?
Yeah, [Preset*] are for old versions, [PRES*] are for new versions - see this page:

http://wiki.bo3b.net/index.php?title=HelixMod_Feature_List

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/10/2016 01:28 PM   
[quote="DarkStarSword"][quote="helifax"]Yupp, both autofix.sh and autofix53.sh fail there... I updated the specified files here: [url=http://3dsurroundgaming.com/3DVision/insideData_unity.rar]Assets Files[/url] Thank you again for taking the time and looking into this![/quote] :facepalm: This was a regression I introduced when adding support for Unity 5.3 that broke all older versions, but how I didn't catch this before... I guess I've only been working on 5.3 games since then... Anyway, all fixed now - update the scripts and try again.[/quote] Thanks DSS! I'll check it out later today and report back;) Thank you for looking into this!
DarkStarSword said:
helifax said:Yupp, both autofix.sh and autofix53.sh fail there...
I updated the specified files here: Assets Files

Thank you again for taking the time and looking into this!

:facepalm:

This was a regression I introduced when adding support for Unity 5.3 that broke all older versions, but how I didn't catch this before... I guess I've only been working on 5.3 games since then...

Anyway, all fixed now - update the scripts and try again.


Thanks DSS! I'll check it out later today and report back;)
Thank you for looking into this!

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 07/10/2016 02:07 PM   
[quote="DarkStarSword"]Yeah, [Preset*] are for old versions, [PRES*] are for new versions - see this page: http://wiki.bo3b.net/index.php?title=HelixMod_Feature_List[/quote] Thanks, I got the convergence presets to work with the latest DLL (April 2014). The constants still don't work, though. DX9Settings.ini: [code][General] UseRenderedShaders=true DefPSConst1 = 215 PresetsKeysList = 1;2;3;4; [KEY1] Key = 49 Presets = 1; Type = 1 [KEY2] Key = 50 Presets = 2; Type = 1 [KEY3] Key = 51 Presets = 3;4; Type = 1 [KEY4] Key = 52 Presets = 5;6; Type = 1 [PRES1] SaveSepSettings = true UseSepSettings = true Convergence = 0x4015fb0a Separation = 0x42c80000 [PRES2] SaveSepSettings = true UseSepSettings = true Convergence = 0x3f7b021b Separation = 0x42c80000 [PRES3] Const1 = 0x00000000 [PRES4] Const1 = 0x00000001 UseByDef = true [PRES5] Const2 = 0x00000000 [PRES6] Const2 = 0x00000001 UseByDef = true[/code] In the shaders, somehow the constant equals 0. Are my presets 3 to 6 correct? 5 and 6 are for this shader(C5AB437F.txt): [code]//Characters cel shading. // // Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 // // Parameters: // // float4 g_vParam1_PS; // // // Registers: // // Name Reg Size // ------------ ----- ---- // g_vParam1_PS c137 1 // ps_3_0 def c0, -2, 3, 0.100000001, 0.5 def c1, 1, -1, 0, 0 def c200, 0, 0, 0, 0 dcl_texcoord v0.w dcl_texcoord1 v1.xyz dcl_texcoord2 v2.y mov r30.x, c215.y if_eq r30.x, c200.x else add r0.w, -c137.x, c137.y rcp r0.z, r0.w add r0.w, v0.w, -c137.x mul_sat r0.z, r0.z, r0.w mad r0.w, r0.z, c0.x, c0.y mul r0.z, r0.z, r0.z mul r1.w, r0.w, r0.z dp3 r0.z, v1, v1 lrp r0.w, r1.w, c137.w, c137.z rsq r0.z, r0.z mul r0.xy, r0.z, v1 mad r0.z, v1.z, r0.z, c1.x mul r0.xy, r0.w, r0 mad r0.w, r0.w, r0.z, c1.y mad_sat oC0.w, v2.y, -c0.z, c0.w mad oC0.xyz, r0.xyww, c0.w, c0.w endif // approximately 16 instruction slots used[/code]
DarkStarSword said:Yeah, [Preset*] are for old versions, [PRES*] are for new versions - see this page:
http://wiki.bo3b.net/index.php?title=HelixMod_Feature_List


Thanks, I got the convergence presets to work with the latest DLL (April 2014). The constants still don't work, though.

DX9Settings.ini:

[General]
UseRenderedShaders=true
DefPSConst1 = 215
PresetsKeysList = 1;2;3;4;

[KEY1]
Key = 49
Presets = 1;
Type = 1

[KEY2]
Key = 50
Presets = 2;
Type = 1

[KEY3]
Key = 51
Presets = 3;4;
Type = 1

[KEY4]
Key = 52
Presets = 5;6;
Type = 1

[PRES1]
SaveSepSettings = true
UseSepSettings = true
Convergence = 0x4015fb0a
Separation = 0x42c80000

[PRES2]
SaveSepSettings = true
UseSepSettings = true
Convergence = 0x3f7b021b
Separation = 0x42c80000

[PRES3]
Const1 = 0x00000000

[PRES4]
Const1 = 0x00000001
UseByDef = true

[PRES5]
Const2 = 0x00000000

[PRES6]
Const2 = 0x00000001
UseByDef = true


In the shaders, somehow the constant equals 0. Are my presets 3 to 6 correct? 5 and 6 are for this shader(C5AB437F.txt):

//Characters cel shading.
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// Parameters:
//
// float4 g_vParam1_PS;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// g_vParam1_PS c137 1
//

ps_3_0
def c0, -2, 3, 0.100000001, 0.5
def c1, 1, -1, 0, 0
def c200, 0, 0, 0, 0
dcl_texcoord v0.w
dcl_texcoord1 v1.xyz
dcl_texcoord2 v2.y
mov r30.x, c215.y
if_eq r30.x, c200.x

else
add r0.w, -c137.x, c137.y
rcp r0.z, r0.w
add r0.w, v0.w, -c137.x
mul_sat r0.z, r0.z, r0.w
mad r0.w, r0.z, c0.x, c0.y
mul r0.z, r0.z, r0.z
mul r1.w, r0.w, r0.z
dp3 r0.z, v1, v1
lrp r0.w, r1.w, c137.w, c137.z
rsq r0.z, r0.z
mul r0.xy, r0.z, v1
mad r0.z, v1.z, r0.z, c1.x
mul r0.xy, r0.w, r0
mad r0.w, r0.w, r0.z, c1.y
mad_sat oC0.w, v2.y, -c0.z, c0.w
mad oC0.xyz, r0.xyww, c0.w, c0.w
endif

// approximately 16 instruction slots used

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

Posted 07/10/2016 02:32 PM   
You need to use "Const2 = 0x3f800000" for 1.0 - those values are (annoyingly) hexadecimal representations of 32bit floats. If that doesn't work, try using a lower constant register as some games have issues with high register numbers that aren't fully understood.
You need to use "Const2 = 0x3f800000" for 1.0 - those values are (annoyingly) hexadecimal representations of 32bit floats. If that doesn't work, try using a lower constant register as some games have issues with high register numbers that aren't fully understood.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/10/2016 03:21 PM   
[quote="DarkStarSword"]You need to use "Const2 = 0x3f800000" for 1.0 - those values are (annoyingly) hexadecimal representations of 32bit floats.[/quote] Thank you! That worked :). I'll use the converter from now on (http://gregstoll.dyndns.org/~gregstoll/floattohex/). Everything clear (at least until I try changing HUD depth and other things I haven't tried yet in DX9).
DarkStarSword said:You need to use "Const2 = 0x3f800000" for 1.0 - those values are (annoyingly) hexadecimal representations of 32bit floats.


Thank you! That worked :). I'll use the converter from now on (http://gregstoll.dyndns.org/~gregstoll/floattohex/).

Everything clear (at least until I try changing HUD depth and other things I haven't tried yet in DX9).

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

Posted 07/10/2016 04:17 PM   
Hi DarkStarSword, The new scripts seem to work;) I had to "dos2unix" the "*.sh" files though as they lost their UNIX encoding. Everything seems to have worked fine;) However I get some weird failed "shaders". An example: [code] // hlsltool.py -I ../.. --fix-unity-reflection --only-autofixed --fxc /cygdrive/d/fxc.exe 0b98b564f7fe945d-ps_replace.txt // 3DMigoto: 0b98b564f7fe945d | Unity headers extracted from Sh_PDHuddlePrePass.shader // Shader "Playdead/Toon/Huddle PrePass" { // Properties { // _DiffuseColor ("Base Color", Color) = (0.5,0.5,0.5,1) // _MainTex ("Base (RGB) Illumin (A)", 2D) = "white" { } // _SkinTex ("Skin Ramp (RGB)", 2D) = "white" { } // _BumpMap ("Normalmap", 2D) = "bump" { } // _BumpMapBlend ("Normalmap Bumpiness", Range(0,0.2)) = 0.15 // _LightSoftness ("Light Cutoff Sharpness", Range(0,1)) = 0.5 // _DiffuseCutOff ("Light Cutoff Diffuse", Range(0,1)) = 0.25 // _RimColor ("Rim Color", Color) = (0.5,0.5,0.5,1) // _RimSharpness ("Rim Sharpness", Range(0.3,0.8)) = 1 // _RimUpfacing ("Rim Upfacing", Range(0.5,2)) = 1 // _RimOfs ("Rim Offset", Range(-1,1)) = 0 // _FogColor ("Fog Color", Color) = (0.5,0.5,0.5,1) // _FogMinDist ("Fog MinDist", Range(-6,3)) = 0 // _FogMaxDist ("Fog MaxDist", Range(-6,3)) = 0 // _Gravity ("Soft Gravity", Vector) = (0,0,0,1) // _Stiffness ("Soft Stiffness", Float) = 0.1 // _AngStiffness ("Soft Angular Stiffness", Float) = 0.1 // _PushAmount ("Soft Push Amount", Float) = 0 // _WobbleFactor ("Soft Wobble Factor", Float) = 0.1 // _WobbleIdle ("Soft Wobble Idle", Float) = 0 // } // Fallback "Playdead/Diffuse/Lambert Notex Nofog" // SubShader 1/1 { // LOD 400 // Tags { "RenderType"="Opaque" } // Pass 2/2 { // Tags { "LIGHTMODE"="PrepassFinal" "RenderType"="Opaque" } // Fog { Mode Off } // GpuProgramID 120353 // Program "fp" { // SubProgram "d3d11 " { // SetTexture 0 [_MainTex] 2D 1 // SetTexture 1 [_CameraNormalsTexture] 2D 3 // SetTexture 2 [_LightBuffer] 2D 0 // SetTexture 3 [_SkinTex] 2D 2 // ConstBuffer "$Globals" 432 // Vector 0 [unity_Ambient] // Vector 16 [_DiffuseColor] // Float 112 [_DiffuseCutOff] // Float 116 [_RimUpfacing] // Vector 128 [_RimColor] // Float 144 [_RimSharpness] // Float 148 [_LightSoftness] // Vector 160 [_FogColor] // Vector 208 [_MainCharPosWorld] // Vector 224 [_HuddleAmbientLightColor] // Vector 288 [unity_ColorSpaceLuminance] // ConstBuffer "UnityPerCamera" 144 // Vector 16 [_SinTime] // Vector 64 [_WorldSpaceCameraPos] 3 // Vector 96 [_ScreenParams] // ConstBuffer "UnityFog" 32 // Vector 0 [unity_FogColor] // BindCB "$Globals" 0 // BindCB "UnityPerCamera" 1 // BindCB "UnityFog" 2 // } // } // } // } // } // // Headers extracted with DarkStarSword's extract_unity_shaders.py // https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py // // Shader model ps_4_0 // ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:42 2016 Texture2D<float4> t3 : register(t3); Texture2D<float4> t2 : register(t2); Texture2D<float4> t1 : register(t1); Texture2D<float4> t0 : register(t0); SamplerState s3_s : register(s3); SamplerState s2_s : register(s2); SamplerState s1_s : register(s1); SamplerState s0_s : register(s0); cbuffer cb2 : register(b2) { float4 cb2[1]; } cbuffer cb1 : register(b1) { float4 cb1[9]; } cbuffer cb0 : register(b0) { float4 cb0[19]; } // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); cbuffer UnityPerDraw : register(b11) { float4x4 glstate_matrix_mvp; float4x4 glstate_matrix_modelview0; float4x4 glstate_matrix_invtrans_modelview0; #define UNITY_MATRIX_MVP glstate_matrix_mvp #define UNITY_MATRIX_MV glstate_matrix_modelview0 #define UNITY_MATRIX_IT_MV glstate_matrix_invtrans_modelview0 uniform float4x4 _Object2World; uniform float4x4 _World2Object; uniform float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels uniform float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms } #include <matrix.hlsl> void main( float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, float w1 : TEXCOORD1, float w1 : TEXCOORD7, float4 v2 : TEXCOORD2, float4 v3 : TEXCOORD4, float4 v4 : TEXCOORD5, float3 v5 : TEXCOORD6, out float4 o0 : SV_Target0) { float4 r0,r1,r2,r3,r4,r5; uint4 bitmask, uiDest; float4 fDest; float4 stereo = StereoParams.Load(0); float separation = stereo.x, convergence = stereo.y, eye = stereo.z; // Unity reflection/specular fix inserted with DarkStarSword's hlsltool.py: // hlsltool.py -I ../.. --fix-unity-reflection --only-autofixed --fxc /cygdrive/d/fxc.exe 0b98b564f7fe945d-ps_replace.txt float4 _WorldSpaceCameraPos = cb1[4]; float4 clip_space_adj = float4(-separation * convergence, 0, 0, 0); float4 local_space_adj = mul(inverse(glstate_matrix_mvp), clip_space_adj); float4 world_space_adj = mul(_Object2World, local_space_adj); _WorldSpaceCameraPos.xyz -= world_space_adj.xyz; r0.xy = v2.xy / v2.ww; r1.xyzw = t2.SampleLevel(s0_s, r0.xy, 0).xyzw; r0.xyzw = t1.SampleLevel(s3_s, r0.xy, 0).xyzw; r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1); r1.xyz = max(float3(0.000977517106,0.000977517106,0.000977517106), r1.yzx); r1.xyz = log2(r1.xyz); r0.w = min(-r1.x, -r1.y); r0.w = min(-r1.z, r0.w); r1.w = max(-r1.x, -r1.y); r1.w = max(-r1.z, r1.w); r0.w = r1.w + -r0.w; r2.x = 0.5 * r0.w; r2.yzw = r1.www + r1.xyz; r2.xyz = r2.yzw * float3(0.166666672,0.166666672,0.166666672) + r2.xxx; r2.xyz = r2.xyz / r0.www; r3.xy = float2(0.333333343,0.666666687) + r2.zx; r2.zw = r3.xy + -r2.yz; r2.x = r2.y + -r2.x; r3.xyz = cmp(r1.www == -r1.zxy); r2.y = r3.z ? r2.w : 0; r2.y = r3.y ? r2.z : r2.y; r2.x = r3.x ? r2.x : r2.y; r2.y = cmp(r2.x < 0); r2.z = 1 + r2.x; r2.x = r2.y ? r2.z : r2.x; r2.y = cmp(1 < r2.x); r2.z = -1 + r2.x; r2.x = r2.y ? r2.z : r2.x; r2.y = r0.w / r1.w; r0.w = cmp(r0.w != 0.000000); r2.xy = r0.ww ? r2.xy : 0; r0.w = 6 * r2.x; r0.w = floor(r0.w); r2.z = cmp(r0.w == 4.000000); r2.x = r2.x * 6 + -r0.w; r3.xyzw = cmp(r0.wwww == float4(0,1,2,3)); r0.w = 1 + -r2.x; r2.x = -r2.y * r2.x + 1; r0.w = -r2.y * r0.w + 1; r2.w = 1 + -cb0[9].y; r4.x = cb0[7].x + r2.w; r2.w = cb0[7].x + -r2.w; r2.w = max(0, r2.w); r4.x = min(1, r4.x); r4.x = r4.x + -r2.w; r1.w = -r2.w + r1.w; r4.z = saturate(r1.w / r4.x); r4.y = r4.z * r0.w; r4.w = r4.z * r2.x; r5.xz = r2.zz ? r4.yz : r4.zw; r0.w = 1 + -r2.y; r1.w = cmp(r2.y != 0.000000); r4.x = r4.z * r0.w; r5.y = r4.x; r2.xyz = r3.www ? r4.xwz : r5.xyz; r2.xyz = r3.zzz ? r4.xzy : r2.xyz; r2.xyz = r3.yyy ? r4.wzx : r2.xyz; r2.xyz = r3.xxx ? r4.zyx : r2.xyz; r2.xyz = r1.www ? r2.xyz : r4.zzz; r2.xyz = cb0[0].xyz + r2.xyz; r2.xyz = cb0[1].xyz * r2.xyz; r3.xyz = float3(-1,-1,-1) + cb0[14].xyz; r3.xyz = cb0[9].yyy * r3.xyz + float3(1,1,1); r2.xyz = saturate(r3.xyz * r2.xyz); r2.w = 0.5; r3.xyzw = t3.SampleLevel(s2_s, r2.xw, 0).xyzw; r4.xyzw = t3.SampleLevel(s2_s, r2.yw, 0).xyzw; r2.xyzw = t3.SampleLevel(s2_s, r2.zw, 0).xyzw; r3.z = r2.z; r3.y = r4.y; r0.w = dot(r0.xyz, r0.xyz); r0.w = rsqrt(r0.w); r0.xyz = r0.yxz * r0.www; r2.xyz = _WorldSpaceCameraPos.xyz + -v3.xyz; r0.w = dot(r2.xyz, r2.xyz); r0.w = rsqrt(r0.w); r2.xyz = r2.xyz * r0.www; r0.y = saturate(dot(r0.yxz, r2.xyz)); r0.x = saturate(r0.x); r0.y = 1 + -r0.y; r0.y = log2(r0.y); r0.z = 4 * cb0[9].x; r0.y = r0.z * r0.y; r0.y = exp2(r0.y); r0.zw = cb0[9].xx * float2(-20,0.239999995) + float2(20,0.00999999978); r0.y = r0.y + -r0.w; r0.y = r0.y * 2 + -0.5; r0.y = r0.z * r0.y; r0.yzw = float3(1.44269502,-0.721347511,2.16404247) * r0.yzz; r0.zw = exp2(r0.zw); r0.zw = float2(1,1) + r0.zw; r0.zw = float2(1,1) / r0.zw; r0.y = exp2(r0.y); r0.y = 1 + r0.y; r0.y = 1 / r0.y; r0.y = r0.y + -r0.z; r0.z = r0.w + -r0.z; r0.y = saturate(r0.y / r0.z); r4.xyz = -cb0[13].xyz + v3.xyz; r0.z = dot(r4.xyz, r4.xyz); r0.z = rsqrt(r0.z); r4.xyz = r4.xyz * r0.zzz; r0.z = dot(r4.xyz, r2.xyz); r0.z = saturate(1 + -r0.z); r0.z = r0.z * r0.z; r0.z = r0.z * r0.z; r0.w = 1 + -cb0[7].y; r0.x = cb0[7].y * r0.x + r0.w; r2.xyz = cb0[8].xyz * r0.xxx; r0.xzw = r2.xyz * r0.zzz; r0.xyz = r0.xzw * r0.yyy + r3.xyz; r2.xyz = cb0[10].xyz * w1.xww; r3.xyz = cb0[14].xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5); r2.xyz = r3.xyz * r2.xyz; r0.xyz = max(r2.xyz, r0.xyz); r1.xzw = cb0[18].xyz * -r1.zxy; r1.xw = r1.xx + r1.zw; r0.w = r1.z * r1.w; r1.x = -r1.y * cb0[18].z + r1.x; r0.w = sqrt(r0.w); r0.w = dot(cb0[18].ww, r0.ww); r0.w = r1.x + r0.w; r0.w = saturate(2.85714293 * r0.w); r1.xyzw = t0.Sample(s1_s, v1.xy).xyzw; r2.xyz = float3(1,1,1) + -r1.xyz; r1.xyz = r0.www * r2.xyz + r1.xyz; r0.xyz = r0.xyz * r1.xyz + -cb2[0].xyz; r0.w = 1 + -cb2[0].w; r0.w = max(w1.x, r0.w); r0.w = min(1, r0.w); r0.xyz = r0.www * r0.xyz + cb2[0].xyz; r1.xy = v2.xy * cb1[6].xy + cb1[1].xx; r1.xy = float2(5.39870024,5.44210005) * r1.xy; r1.xy = frac(r1.xy); r1.zw = float2(21.5351009,14.3136997) + r1.xy; r1.z = dot(r1.yx, r1.zw); r1.xy = r1.xy + r1.zz; r1.x = r1.x * r1.y; r1.x = 95.4307022 * r1.x; r1.x = frac(r1.x); r1.x = r1.x * 2 + -1; r0.w = 1; o0.xyzw = r1.xxxx * float4(0.00392156886,0.00392156886,0.00392156886,0.00392156886) + r0.xyzw; return; } /****************************** COMPILE ERRORS ****************************** D:\Temp2\steamapps\common\INSIDE\ShaderFixes\0b98b564f7fe945d-ps_replace.txt(135,9-10): error X3003: redefinition of 'w1' compilation failed; no code produced ****************************** COMPILE ERRORS ******************************/ [/code] I see that ".w1" is defined 2 times. I checked this shader with the raw extracted one from "extracted" folder and indeed "w1" is defined 2 times there. Is there a possibility the shader god dumped wrong? Is there any way to know how to manually fix it (except the obvious by manually trying it out)? Other shaders fail since the subscript .yzw is out of range as the variable is declared as float rather than float4. Thank you in advance!
Hi DarkStarSword,

The new scripts seem to work;) I had to "dos2unix" the "*.sh" files though as they lost their UNIX encoding.
Everything seems to have worked fine;)

However I get some weird failed "shaders".

An example:
// hlsltool.py -I ../.. --fix-unity-reflection --only-autofixed --fxc /cygdrive/d/fxc.exe 0b98b564f7fe945d-ps_replace.txt
// 3DMigoto: 0b98b564f7fe945d | Unity headers extracted from Sh_PDHuddlePrePass.shader
// Shader "Playdead/Toon/Huddle PrePass" {
// Properties {
// _DiffuseColor ("Base Color", Color) = (0.5,0.5,0.5,1)
// _MainTex ("Base (RGB) Illumin (A)", 2D) = "white" { }
// _SkinTex ("Skin Ramp (RGB)", 2D) = "white" { }
// _BumpMap ("Normalmap", 2D) = "bump" { }
// _BumpMapBlend ("Normalmap Bumpiness", Range(0,0.2)) = 0.15
// _LightSoftness ("Light Cutoff Sharpness", Range(0,1)) = 0.5
// _DiffuseCutOff ("Light Cutoff Diffuse", Range(0,1)) = 0.25
// _RimColor ("Rim Color", Color) = (0.5,0.5,0.5,1)
// _RimSharpness ("Rim Sharpness", Range(0.3,0.8)) = 1
// _RimUpfacing ("Rim Upfacing", Range(0.5,2)) = 1
// _RimOfs ("Rim Offset", Range(-1,1)) = 0
// _FogColor ("Fog Color", Color) = (0.5,0.5,0.5,1)
// _FogMinDist ("Fog MinDist", Range(-6,3)) = 0
// _FogMaxDist ("Fog MaxDist", Range(-6,3)) = 0
// _Gravity ("Soft Gravity", Vector) = (0,0,0,1)
// _Stiffness ("Soft Stiffness", Float) = 0.1
// _AngStiffness ("Soft Angular Stiffness", Float) = 0.1
// _PushAmount ("Soft Push Amount", Float) = 0
// _WobbleFactor ("Soft Wobble Factor", Float) = 0.1
// _WobbleIdle ("Soft Wobble Idle", Float) = 0
// }
// Fallback "Playdead/Diffuse/Lambert Notex Nofog"
// SubShader 1/1 {
// LOD 400
// Tags { "RenderType"="Opaque" }
// Pass 2/2 {
// Tags { "LIGHTMODE"="PrepassFinal" "RenderType"="Opaque" }
// Fog { Mode Off }
// GpuProgramID 120353
// Program "fp" {
// SubProgram "d3d11 " {
// SetTexture 0 [_MainTex] 2D 1
// SetTexture 1 [_CameraNormalsTexture] 2D 3
// SetTexture 2 [_LightBuffer] 2D 0
// SetTexture 3 [_SkinTex] 2D 2
// ConstBuffer "$Globals" 432
// Vector 0 [unity_Ambient]
// Vector 16 [_DiffuseColor]
// Float 112 [_DiffuseCutOff]
// Float 116 [_RimUpfacing]
// Vector 128 [_RimColor]
// Float 144 [_RimSharpness]
// Float 148 [_LightSoftness]
// Vector 160 [_FogColor]
// Vector 208 [_MainCharPosWorld]
// Vector 224 [_HuddleAmbientLightColor]
// Vector 288 [unity_ColorSpaceLuminance]
// ConstBuffer "UnityPerCamera" 144
// Vector 16 [_SinTime]
// Vector 64 [_WorldSpaceCameraPos] 3
// Vector 96 [_ScreenParams]
// ConstBuffer "UnityFog" 32
// Vector 0 [unity_FogColor]
// BindCB "$Globals" 0
// BindCB "UnityPerCamera" 1
// BindCB "UnityFog" 2
// }
// }
// }
// }
// }
//
// Headers extracted with DarkStarSword's extract_unity_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py

//
// Shader model ps_4_0

// ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:42 2016
Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
float4 cb2[1];
}

cbuffer cb1 : register(b1)
{
float4 cb1[9];
}

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




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



cbuffer UnityPerDraw : register(b11) {
float4x4 glstate_matrix_mvp;
float4x4 glstate_matrix_modelview0;
float4x4 glstate_matrix_invtrans_modelview0;
#define UNITY_MATRIX_MVP glstate_matrix_mvp
#define UNITY_MATRIX_MV glstate_matrix_modelview0
#define UNITY_MATRIX_IT_MV glstate_matrix_invtrans_modelview0

uniform float4x4 _Object2World;
uniform float4x4 _World2Object;
uniform float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels
uniform float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms
}


#include <matrix.hlsl>

void main(
float4 v0 : SV_POSITION0,
float2 v1 : TEXCOORD0,
float w1 : TEXCOORD1,
float w1 : TEXCOORD7,
float4 v2 : TEXCOORD2,
float4 v3 : TEXCOORD4,
float4 v4 : TEXCOORD5,
float3 v5 : TEXCOORD6,
out float4 o0 : SV_Target0)
{
float4 r0,r1,r2,r3,r4,r5;
uint4 bitmask, uiDest;
float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

// Unity reflection/specular fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../.. --fix-unity-reflection --only-autofixed --fxc /cygdrive/d/fxc.exe 0b98b564f7fe945d-ps_replace.txt
float4 _WorldSpaceCameraPos = cb1[4];
float4 clip_space_adj = float4(-separation * convergence, 0, 0, 0);
float4 local_space_adj = mul(inverse(glstate_matrix_mvp), clip_space_adj);
float4 world_space_adj = mul(_Object2World, local_space_adj);
_WorldSpaceCameraPos.xyz -= world_space_adj.xyz;

r0.xy = v2.xy / v2.ww;
r1.xyzw = t2.SampleLevel(s0_s, r0.xy, 0).xyzw;
r0.xyzw = t1.SampleLevel(s3_s, r0.xy, 0).xyzw;
r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
r1.xyz = max(float3(0.000977517106,0.000977517106,0.000977517106), r1.yzx);
r1.xyz = log2(r1.xyz);
r0.w = min(-r1.x, -r1.y);
r0.w = min(-r1.z, r0.w);
r1.w = max(-r1.x, -r1.y);
r1.w = max(-r1.z, r1.w);
r0.w = r1.w + -r0.w;
r2.x = 0.5 * r0.w;
r2.yzw = r1.www + r1.xyz;
r2.xyz = r2.yzw * float3(0.166666672,0.166666672,0.166666672) + r2.xxx;
r2.xyz = r2.xyz / r0.www;
r3.xy = float2(0.333333343,0.666666687) + r2.zx;
r2.zw = r3.xy + -r2.yz;
r2.x = r2.y + -r2.x;
r3.xyz = cmp(r1.www == -r1.zxy);
r2.y = r3.z ? r2.w : 0;
r2.y = r3.y ? r2.z : r2.y;
r2.x = r3.x ? r2.x : r2.y;
r2.y = cmp(r2.x < 0);
r2.z = 1 + r2.x;
r2.x = r2.y ? r2.z : r2.x;
r2.y = cmp(1 < r2.x);
r2.z = -1 + r2.x;
r2.x = r2.y ? r2.z : r2.x;
r2.y = r0.w / r1.w;
r0.w = cmp(r0.w != 0.000000);
r2.xy = r0.ww ? r2.xy : 0;
r0.w = 6 * r2.x;
r0.w = floor(r0.w);
r2.z = cmp(r0.w == 4.000000);
r2.x = r2.x * 6 + -r0.w;
r3.xyzw = cmp(r0.wwww == float4(0,1,2,3));
r0.w = 1 + -r2.x;
r2.x = -r2.y * r2.x + 1;
r0.w = -r2.y * r0.w + 1;
r2.w = 1 + -cb0[9].y;
r4.x = cb0[7].x + r2.w;
r2.w = cb0[7].x + -r2.w;
r2.w = max(0, r2.w);
r4.x = min(1, r4.x);
r4.x = r4.x + -r2.w;
r1.w = -r2.w + r1.w;
r4.z = saturate(r1.w / r4.x);
r4.y = r4.z * r0.w;
r4.w = r4.z * r2.x;
r5.xz = r2.zz ? r4.yz : r4.zw;
r0.w = 1 + -r2.y;
r1.w = cmp(r2.y != 0.000000);
r4.x = r4.z * r0.w;
r5.y = r4.x;
r2.xyz = r3.www ? r4.xwz : r5.xyz;
r2.xyz = r3.zzz ? r4.xzy : r2.xyz;
r2.xyz = r3.yyy ? r4.wzx : r2.xyz;
r2.xyz = r3.xxx ? r4.zyx : r2.xyz;
r2.xyz = r1.www ? r2.xyz : r4.zzz;
r2.xyz = cb0[0].xyz + r2.xyz;
r2.xyz = cb0[1].xyz * r2.xyz;
r3.xyz = float3(-1,-1,-1) + cb0[14].xyz;
r3.xyz = cb0[9].yyy * r3.xyz + float3(1,1,1);
r2.xyz = saturate(r3.xyz * r2.xyz);
r2.w = 0.5;
r3.xyzw = t3.SampleLevel(s2_s, r2.xw, 0).xyzw;
r4.xyzw = t3.SampleLevel(s2_s, r2.yw, 0).xyzw;
r2.xyzw = t3.SampleLevel(s2_s, r2.zw, 0).xyzw;
r3.z = r2.z;
r3.y = r4.y;
r0.w = dot(r0.xyz, r0.xyz);
r0.w = rsqrt(r0.w);
r0.xyz = r0.yxz * r0.www;
r2.xyz = _WorldSpaceCameraPos.xyz + -v3.xyz;
r0.w = dot(r2.xyz, r2.xyz);
r0.w = rsqrt(r0.w);
r2.xyz = r2.xyz * r0.www;
r0.y = saturate(dot(r0.yxz, r2.xyz));
r0.x = saturate(r0.x);
r0.y = 1 + -r0.y;
r0.y = log2(r0.y);
r0.z = 4 * cb0[9].x;
r0.y = r0.z * r0.y;
r0.y = exp2(r0.y);
r0.zw = cb0[9].xx * float2(-20,0.239999995) + float2(20,0.00999999978);
r0.y = r0.y + -r0.w;
r0.y = r0.y * 2 + -0.5;
r0.y = r0.z * r0.y;
r0.yzw = float3(1.44269502,-0.721347511,2.16404247) * r0.yzz;
r0.zw = exp2(r0.zw);
r0.zw = float2(1,1) + r0.zw;
r0.zw = float2(1,1) / r0.zw;
r0.y = exp2(r0.y);
r0.y = 1 + r0.y;
r0.y = 1 / r0.y;
r0.y = r0.y + -r0.z;
r0.z = r0.w + -r0.z;
r0.y = saturate(r0.y / r0.z);
r4.xyz = -cb0[13].xyz + v3.xyz;
r0.z = dot(r4.xyz, r4.xyz);
r0.z = rsqrt(r0.z);
r4.xyz = r4.xyz * r0.zzz;
r0.z = dot(r4.xyz, r2.xyz);
r0.z = saturate(1 + -r0.z);
r0.z = r0.z * r0.z;
r0.z = r0.z * r0.z;
r0.w = 1 + -cb0[7].y;
r0.x = cb0[7].y * r0.x + r0.w;
r2.xyz = cb0[8].xyz * r0.xxx;
r0.xzw = r2.xyz * r0.zzz;
r0.xyz = r0.xzw * r0.yyy + r3.xyz;
r2.xyz = cb0[10].xyz * w1.xww;
r3.xyz = cb0[14].xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
r2.xyz = r3.xyz * r2.xyz;
r0.xyz = max(r2.xyz, r0.xyz);
r1.xzw = cb0[18].xyz * -r1.zxy;
r1.xw = r1.xx + r1.zw;
r0.w = r1.z * r1.w;
r1.x = -r1.y * cb0[18].z + r1.x;
r0.w = sqrt(r0.w);
r0.w = dot(cb0[18].ww, r0.ww);
r0.w = r1.x + r0.w;
r0.w = saturate(2.85714293 * r0.w);
r1.xyzw = t0.Sample(s1_s, v1.xy).xyzw;
r2.xyz = float3(1,1,1) + -r1.xyz;
r1.xyz = r0.www * r2.xyz + r1.xyz;
r0.xyz = r0.xyz * r1.xyz + -cb2[0].xyz;
r0.w = 1 + -cb2[0].w;
r0.w = max(w1.x, r0.w);
r0.w = min(1, r0.w);
r0.xyz = r0.www * r0.xyz + cb2[0].xyz;
r1.xy = v2.xy * cb1[6].xy + cb1[1].xx;
r1.xy = float2(5.39870024,5.44210005) * r1.xy;
r1.xy = frac(r1.xy);
r1.zw = float2(21.5351009,14.3136997) + r1.xy;
r1.z = dot(r1.yx, r1.zw);
r1.xy = r1.xy + r1.zz;
r1.x = r1.x * r1.y;
r1.x = 95.4307022 * r1.x;
r1.x = frac(r1.x);
r1.x = r1.x * 2 + -1;
r0.w = 1;
o0.xyzw = r1.xxxx * float4(0.00392156886,0.00392156886,0.00392156886,0.00392156886) + r0.xyzw;
return;
}

/****************************** COMPILE ERRORS ******************************
D:\Temp2\steamapps\common\INSIDE\ShaderFixes\0b98b564f7fe945d-ps_replace.txt(135,9-10): error X3003: redefinition of 'w1'

compilation failed; no code produced
****************************** COMPILE ERRORS ******************************/


I see that ".w1" is defined 2 times. I checked this shader with the raw extracted one from "extracted" folder and indeed "w1" is defined 2 times there.

Is there a possibility the shader god dumped wrong?
Is there any way to know how to manually fix it (except the obvious by manually trying it out)?

Other shaders fail since the subscript .yzw is out of range as the variable is declared as float rather than float4.

Thank you in advance!

1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc


My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com

(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)

Posted 07/11/2016 11:04 AM   
[quote]I see that ".w1" is defined 2 times. I checked this shader with the raw extracted one from "extracted" folder and indeed "w1" is defined 2 times there.[/quote] That will be a Decompiler bug that generated the duplicate w1. Without the ASM I can't say for sure how to fix it, but you'll want to just manually change the second one to a different variable like x1. Check the ASM to determine which one to change. This happens because the fxc compiler aggressively packs all variables into single inputs, even though there are plenty of available inputs and there is no performance penalty for unpacking them. I can likely fix that problem however once I get back to working on the Decompiler.
I see that ".w1" is defined 2 times. I checked this shader with the raw extracted one from "extracted" folder and indeed "w1" is defined 2 times there.

That will be a Decompiler bug that generated the duplicate w1. Without the ASM I can't say for sure how to fix it, but you'll want to just manually change the second one to a different variable like x1. Check the ASM to determine which one to change.

This happens because the fxc compiler aggressively packs all variables into single inputs, even though there are plenty of available inputs and there is no performance penalty for unpacking them.

I can likely fix that problem however once I get back to working on the Decompiler.

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

Posted 07/11/2016 11:35 AM   
Hi bo3b! Big thanks for that input! For this shader [code] // hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt // 3DMigoto: 6c06b15624741d0a | Unity headers extracted from Sh_PDfxLightcones_depthfade_ws_tex.shader // Shader "Playdead/FX/Lightcones Depthfade WS Smoke" { // Properties { // _Color ("Color", Color) = (0.573,0.774,1,1) // _Illum ("Illum", Range(0,10)) = 3 // _Power ("Gamma", Range(0,10)) = 2 // _InvFade ("Depth Fade Factor", Range(0.1,5)) = 1 // _OffsetTime ("Time Offset", Range(0,100)) = 0 // _OffsetX ("Speed X", Range(-4,4)) = 1 // _OffsetY ("Speed Y", Range(-4,4)) = 1 // _StretchX ("Stretch X (-2,2)", Range(-2,2)) = 1 // _StretchY ("Stretch Y (-2,2)", Range(-2,2)) = 1 // _MainTex ("Base Transparency (R)", 2D) = "white" { } // _Tex1 ("FallOffTex1 (beam) (RGB)", 2D) = "white" { } // _Tex2 ("FallOffTex2 (sphere) (RGB)", 2D) = "white" { } // _TextureBlend ("Texture Blend", Range(0,1)) = 0.5 // } // Fallback Off // SubShader 1/1 { // Tags { "QUEUE"="Transparent+1" } // Pass 1/1 { // Name "BASE" // Tags { "LIGHTMODE"="Always" "QUEUE"="Transparent+1" } // ZTest Less // ZWrite Off // Cull Off // Fog { Mode Off } // Blend One One // ColorMask RGB // GpuProgramID 47144 // Program "vp" { // SubProgram "d3d11 " { // Bind "vertex" Vertex // Bind "normal" Normal // Bind "texcoord" TexCoord0 // ConstBuffer "$Globals" 336 // Vector 96 [unity_FogStart] // Float 216 [_OffsetTime] // Float 220 [_OffsetX] // Float 224 [_OffsetY] // Float 228 [_StretchX] // Float 232 [_StretchY] // Vector 240 [_MainTex_ST] // ConstBuffer "UnityPerCamera" 144 // Vector 0 [_Time] // Vector 80 [_ProjectionParams] // ConstBuffer "UnityPerDraw" 336 // Matrix 0 [glstate_matrix_mvp] // Matrix 64 [glstate_matrix_modelview0] // Matrix 128 [glstate_matrix_invtrans_modelview0] // Matrix 192 [_Object2World] // ConstBuffer "UnityFog" 32 // Vector 16 [unity_FogParams] // BindCB "$Globals" 0 // BindCB "UnityPerCamera" 1 // BindCB "UnityPerDraw" 2 // BindCB "UnityFog" 3 // } // } // } // } // } // // Headers extracted with DarkStarSword's extract_unity_shaders.py // https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py // // Shader model vs_4_0 // ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:36 2016 cbuffer cb3 : register(b3) { float4 cb3[2]; } cbuffer cb2 : register(b2) { float4 cb2[16]; } cbuffer cb1 : register(b1) { float4 cb1[6]; } cbuffer cb0 : register(b0) { float4 cb0[16]; } // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : POSITION0, float4 v1 : TANGENT0, float3 v2 : NORMAL0, float4 v3 : TEXCOORD0, out float4 o0 : SV_POSITION0, out float4 o1 : TEXCOORD0, out float3 o2 : TEXCOORD1, out float p2 : TEXCOORD4, out float3 o3 : TEXCOORD2, out float p3 : TEXCOORD5, out float4 o4 : TEXCOORD3, out float3 o5 : TEXCOORD6, out float p5 : TEXCOORD7) { float4 r0,r1,r2,r3; uint4 bitmask, uiDest; float4 fDest; float4 stereo = StereoParams.Load(0); float separation = stereo.x, convergence = stereo.y, eye = stereo.z; r0.xyzw = cb2[1].xyzw * v0.yyyy; r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw; r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw; r0.xyzw = cb2[3].xyzw * v0.wwww + r0.xyzw; o0.xyzw = r0.xyzw; // Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py: // hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); } r1.xyz = cb2[13].xyz * v0.yyy; r1.xyz = cb2[12].xyz * v0.xxx + r1.xyz; r1.xyz = cb2[14].xyz * v0.zzz + r1.xyz; r1.xyz = cb2[15].xyz * v0.www + r1.xyz; r1.xyz = cb0[14].yzz * r1.xyz; r0.z = cb1[0].x + cb0[13].z; o1.xz = r0.zz * cb0[13].ww + r1.xx; o1.yw = r0.zz * cb0[14].xx + r1.yz; r1.xyz = cb2[9].xyz * v2.yyy; r1.xyz = cb2[8].xyz * v2.xxx + r1.xyz; r1.xyz = cb2[10].xyz * v2.zzz + r1.xyz; o2.xyz = r1.xyz; r2.xyz = cb2[5].xyz * v0.yyy; r2.xyz = cb2[4].xyz * v0.xxx + r2.xyz; r2.xyz = cb2[6].xyz * v0.zzz + r2.xyz; r2.xyz = cb2[7].xyz * v0.www + r2.xyz; r0.z = -cb0[6].x + -r2.z; p2.x = r0.z * cb3[1].z + 1; r0.z = dot(r2.xyz, r2.xyz); r2.w = sqrt(r0.z); o3.xyzw = r2.xyzw; r2.xyw = r2.xyz / r2.www; o4.z = -r2.z; r0.y = cb1[5].x * r0.y; r3.xzw = float3(0.5,0.5,0.5) * r0.xwy; o4.w = r0.w; o4.xy = r3.xw + r3.zz; r0.x = dot(r2.xyw, r1.xyz); r0.x = r0.x + r0.x; o5.xyz = r1.xyz * -r0.xxx + r2.xyw; p5.x = v3.y * cb0[15].y + cb0[15].w; return; } /****************************** COMPILE ERRORS ****************************** D:\Temp2\steamapps\common\INSIDE\ShaderFixes\6c06b15624741d0a-vs_replace.txt(152,3-9): error X3018: invalid subscript 'xyzw' compilation failed; no code produced ****************************** COMPILE ERRORS ******************************/ [/code] I don't know about this one though... Should I keed o3 as float3 and correct line 152 or should I make it a float4?
Hi bo3b!
Big thanks for that input!

For this shader
// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt
// 3DMigoto: 6c06b15624741d0a | Unity headers extracted from Sh_PDfxLightcones_depthfade_ws_tex.shader
// Shader "Playdead/FX/Lightcones Depthfade WS Smoke" {
// Properties {
// _Color ("Color", Color) = (0.573,0.774,1,1)
// _Illum ("Illum", Range(0,10)) = 3
// _Power ("Gamma", Range(0,10)) = 2
// _InvFade ("Depth Fade Factor", Range(0.1,5)) = 1
// _OffsetTime ("Time Offset", Range(0,100)) = 0
// _OffsetX ("Speed X", Range(-4,4)) = 1
// _OffsetY ("Speed Y", Range(-4,4)) = 1
// _StretchX ("Stretch X (-2,2)", Range(-2,2)) = 1
// _StretchY ("Stretch Y (-2,2)", Range(-2,2)) = 1
// _MainTex ("Base Transparency (R)", 2D) = "white" { }
// _Tex1 ("FallOffTex1 (beam) (RGB)", 2D) = "white" { }
// _Tex2 ("FallOffTex2 (sphere) (RGB)", 2D) = "white" { }
// _TextureBlend ("Texture Blend", Range(0,1)) = 0.5
// }
// Fallback Off
// SubShader 1/1 {
// Tags { "QUEUE"="Transparent+1" }
// Pass 1/1 {
// Name "BASE"
// Tags { "LIGHTMODE"="Always" "QUEUE"="Transparent+1" }
// ZTest Less
// ZWrite Off
// Cull Off
// Fog { Mode Off }
// Blend One One
// ColorMask RGB
// GpuProgramID 47144
// Program "vp" {
// SubProgram "d3d11 " {
// Bind "vertex" Vertex
// Bind "normal" Normal
// Bind "texcoord" TexCoord0
// ConstBuffer "$Globals" 336
// Vector 96 [unity_FogStart]
// Float 216 [_OffsetTime]
// Float 220 [_OffsetX]
// Float 224 [_OffsetY]
// Float 228 [_StretchX]
// Float 232 [_StretchY]
// Vector 240 [_MainTex_ST]
// ConstBuffer "UnityPerCamera" 144
// Vector 0 [_Time]
// Vector 80 [_ProjectionParams]
// ConstBuffer "UnityPerDraw" 336
// Matrix 0 [glstate_matrix_mvp]
// Matrix 64 [glstate_matrix_modelview0]
// Matrix 128 [glstate_matrix_invtrans_modelview0]
// Matrix 192 [_Object2World]
// ConstBuffer "UnityFog" 32
// Vector 16 [unity_FogParams]
// BindCB "$Globals" 0
// BindCB "UnityPerCamera" 1
// BindCB "UnityPerDraw" 2
// BindCB "UnityFog" 3
// }
// }
// }
// }
// }
//
// Headers extracted with DarkStarSword's extract_unity_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py

//
// Shader model vs_4_0

// ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:36 2016
cbuffer cb3 : register(b3)
{
float4 cb3[2];
}

cbuffer cb2 : register(b2)
{
float4 cb2[16];
}

cbuffer cb1 : register(b1)
{
float4 cb1[6];
}

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




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


void main(
float4 v0 : POSITION0,
float4 v1 : TANGENT0,
float3 v2 : NORMAL0,
float4 v3 : TEXCOORD0,
out float4 o0 : SV_POSITION0,
out float4 o1 : TEXCOORD0,
out float3 o2 : TEXCOORD1,
out float p2 : TEXCOORD4,
out float3 o3 : TEXCOORD2,
out float p3 : TEXCOORD5,
out float4 o4 : TEXCOORD3,
out float3 o5 : TEXCOORD6,
out float p5 : TEXCOORD7)
{
float4 r0,r1,r2,r3;
uint4 bitmask, uiDest;
float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

r0.xyzw = cb2[1].xyzw * v0.yyyy;
r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw;
r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw;
r0.xyzw = cb2[3].xyzw * v0.wwww + r0.xyzw;
o0.xyzw = r0.xyzw;

// Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

r1.xyz = cb2[13].xyz * v0.yyy;
r1.xyz = cb2[12].xyz * v0.xxx + r1.xyz;
r1.xyz = cb2[14].xyz * v0.zzz + r1.xyz;
r1.xyz = cb2[15].xyz * v0.www + r1.xyz;
r1.xyz = cb0[14].yzz * r1.xyz;
r0.z = cb1[0].x + cb0[13].z;
o1.xz = r0.zz * cb0[13].ww + r1.xx;
o1.yw = r0.zz * cb0[14].xx + r1.yz;
r1.xyz = cb2[9].xyz * v2.yyy;
r1.xyz = cb2[8].xyz * v2.xxx + r1.xyz;
r1.xyz = cb2[10].xyz * v2.zzz + r1.xyz;
o2.xyz = r1.xyz;
r2.xyz = cb2[5].xyz * v0.yyy;
r2.xyz = cb2[4].xyz * v0.xxx + r2.xyz;
r2.xyz = cb2[6].xyz * v0.zzz + r2.xyz;
r2.xyz = cb2[7].xyz * v0.www + r2.xyz;
r0.z = -cb0[6].x + -r2.z;
p2.x = r0.z * cb3[1].z + 1;
r0.z = dot(r2.xyz, r2.xyz);
r2.w = sqrt(r0.z);
o3.xyzw = r2.xyzw;
r2.xyw = r2.xyz / r2.www;
o4.z = -r2.z;
r0.y = cb1[5].x * r0.y;
r3.xzw = float3(0.5,0.5,0.5) * r0.xwy;
o4.w = r0.w;
o4.xy = r3.xw + r3.zz;
r0.x = dot(r2.xyw, r1.xyz);
r0.x = r0.x + r0.x;
o5.xyz = r1.xyz * -r0.xxx + r2.xyw;
p5.x = v3.y * cb0[15].y + cb0[15].w;
return;
}

/****************************** COMPILE ERRORS ******************************
D:\Temp2\steamapps\common\INSIDE\ShaderFixes\6c06b15624741d0a-vs_replace.txt(152,3-9): error X3018: invalid subscript 'xyzw'

compilation failed; no code produced
****************************** COMPILE ERRORS ******************************/


I don't know about this one though... Should I keed o3 as float3 and correct line 152 or should I make it a float4?

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 07/11/2016 11:39 AM   
I've been intending to switch the DX11 script over to use asm (now that I have that swanky asmtool and I've made it as simple as possible to write new DX11 asm patterns), but haven't quite got around to that yet. Mostly those errors will be ok to ignore - the script patches a lot of shaders that are not necessarily broken (e.g. it might move a reflection from surface depth to correct depth, but leaving it at surface depth would have been acceptable in most cases), and if any fail to compile it just names them ~failed to denote this. There is a possibility of rendering issues caused by decompiler bugs that still manage to compile, and with the script patching so many shaders the probability of these increases. For now you need to manually identify effects broken in this way and remove (or hand fix) the patched shader, but once I switch over to asm this problem should go away (there will still be the occasional effect that my script legitimately breaks, but the goal is to minimise the amount of manual effort required).
I've been intending to switch the DX11 script over to use asm (now that I have that swanky asmtool and I've made it as simple as possible to write new DX11 asm patterns), but haven't quite got around to that yet. Mostly those errors will be ok to ignore - the script patches a lot of shaders that are not necessarily broken (e.g. it might move a reflection from surface depth to correct depth, but leaving it at surface depth would have been acceptable in most cases), and if any fail to compile it just names them ~failed to denote this.

There is a possibility of rendering issues caused by decompiler bugs that still manage to compile, and with the script patching so many shaders the probability of these increases. For now you need to manually identify effects broken in this way and remove (or hand fix) the patched shader, but once I switch over to asm this problem should go away (there will still be the occasional effect that my script legitimately breaks, but the goal is to minimise the amount of manual effort required).

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/11/2016 12:08 PM   
Big thanks for the input guys! I will test it out and if required I will try to manually patch/unpatch the shaders needed! Big thank you again!
Big thanks for the input guys!

I will test it out and if required I will try to manually patch/unpatch the shaders needed!
Big thank you again!

1x Palit RTX 2080Ti Pro Gaming OC(watercooled and overclocked to hell)
3x 3D Vision Ready Asus VG278HE monitors (5760x1080).
Intel i9 9900K (overclocked to 5.3 and watercooled ofc).
Asus Maximus XI Hero Mobo.
16 GB Team Group T-Force Dark Pro DDR4 @ 3600.
Lots of Disks:
- Raid 0 - 256GB Sandisk Extreme SSD.
- Raid 0 - WD Black - 2TB.
- SanDisk SSD PLUS 480 GB.
- Intel 760p 256GB M.2 PCIe NVMe SSD.
Creative Sound Blaster Z.
Windows 10 x64 Pro.
etc


My website with my fixes and OpenGL to 3D Vision wrapper:
http://3dsurroundgaming.com

(If you like some of the stuff that I've done and want to donate something, you can do it with PayPal at tavyhome@gmail.com)

Posted 07/11/2016 02:40 PM   
[quote="helifax"]Hi bo3b! Big thanks for that input! For this shader [code] // hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt // 3DMigoto: 6c06b15624741d0a | Unity headers extracted from Sh_PDfxLightcones_depthfade_ws_tex.shader // Shader "Playdead/FX/Lightcones Depthfade WS Smoke" { // Properties { // _Color ("Color", Color) = (0.573,0.774,1,1) // _Illum ("Illum", Range(0,10)) = 3 // _Power ("Gamma", Range(0,10)) = 2 // _InvFade ("Depth Fade Factor", Range(0.1,5)) = 1 // _OffsetTime ("Time Offset", Range(0,100)) = 0 // _OffsetX ("Speed X", Range(-4,4)) = 1 // _OffsetY ("Speed Y", Range(-4,4)) = 1 // _StretchX ("Stretch X (-2,2)", Range(-2,2)) = 1 // _StretchY ("Stretch Y (-2,2)", Range(-2,2)) = 1 // _MainTex ("Base Transparency (R)", 2D) = "white" { } // _Tex1 ("FallOffTex1 (beam) (RGB)", 2D) = "white" { } // _Tex2 ("FallOffTex2 (sphere) (RGB)", 2D) = "white" { } // _TextureBlend ("Texture Blend", Range(0,1)) = 0.5 // } // Fallback Off // SubShader 1/1 { // Tags { "QUEUE"="Transparent+1" } // Pass 1/1 { // Name "BASE" // Tags { "LIGHTMODE"="Always" "QUEUE"="Transparent+1" } // ZTest Less // ZWrite Off // Cull Off // Fog { Mode Off } // Blend One One // ColorMask RGB // GpuProgramID 47144 // Program "vp" { // SubProgram "d3d11 " { // Bind "vertex" Vertex // Bind "normal" Normal // Bind "texcoord" TexCoord0 // ConstBuffer "$Globals" 336 // Vector 96 [unity_FogStart] // Float 216 [_OffsetTime] // Float 220 [_OffsetX] // Float 224 [_OffsetY] // Float 228 [_StretchX] // Float 232 [_StretchY] // Vector 240 [_MainTex_ST] // ConstBuffer "UnityPerCamera" 144 // Vector 0 [_Time] // Vector 80 [_ProjectionParams] // ConstBuffer "UnityPerDraw" 336 // Matrix 0 [glstate_matrix_mvp] // Matrix 64 [glstate_matrix_modelview0] // Matrix 128 [glstate_matrix_invtrans_modelview0] // Matrix 192 [_Object2World] // ConstBuffer "UnityFog" 32 // Vector 16 [unity_FogParams] // BindCB "$Globals" 0 // BindCB "UnityPerCamera" 1 // BindCB "UnityPerDraw" 2 // BindCB "UnityFog" 3 // } // } // } // } // } // // Headers extracted with DarkStarSword's extract_unity_shaders.py // https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py // // Shader model vs_4_0 // ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:36 2016 cbuffer cb3 : register(b3) { float4 cb3[2]; } cbuffer cb2 : register(b2) { float4 cb2[16]; } cbuffer cb1 : register(b1) { float4 cb1[6]; } cbuffer cb0 : register(b0) { float4 cb0[16]; } // 3Dmigoto declarations #define cmp - Texture1D<float4> IniParams : register(t120); Texture2D<float4> StereoParams : register(t125); void main( float4 v0 : POSITION0, float4 v1 : TANGENT0, float3 v2 : NORMAL0, float4 v3 : TEXCOORD0, out float4 o0 : SV_POSITION0, out float4 o1 : TEXCOORD0, out float3 o2 : TEXCOORD1, out float p2 : TEXCOORD4, out float3 o3 : TEXCOORD2, out float p3 : TEXCOORD5, out float4 o4 : TEXCOORD3, out float3 o5 : TEXCOORD6, out float p5 : TEXCOORD7) { float4 r0,r1,r2,r3; uint4 bitmask, uiDest; float4 fDest; float4 stereo = StereoParams.Load(0); float separation = stereo.x, convergence = stereo.y, eye = stereo.z; r0.xyzw = cb2[1].xyzw * v0.yyyy; r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw; r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw; r0.xyzw = cb2[3].xyzw * v0.wwww + r0.xyzw; o0.xyzw = r0.xyzw; // Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py: // hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); } r1.xyz = cb2[13].xyz * v0.yyy; r1.xyz = cb2[12].xyz * v0.xxx + r1.xyz; r1.xyz = cb2[14].xyz * v0.zzz + r1.xyz; r1.xyz = cb2[15].xyz * v0.www + r1.xyz; r1.xyz = cb0[14].yzz * r1.xyz; r0.z = cb1[0].x + cb0[13].z; o1.xz = r0.zz * cb0[13].ww + r1.xx; o1.yw = r0.zz * cb0[14].xx + r1.yz; r1.xyz = cb2[9].xyz * v2.yyy; r1.xyz = cb2[8].xyz * v2.xxx + r1.xyz; r1.xyz = cb2[10].xyz * v2.zzz + r1.xyz; o2.xyz = r1.xyz; r2.xyz = cb2[5].xyz * v0.yyy; r2.xyz = cb2[4].xyz * v0.xxx + r2.xyz; r2.xyz = cb2[6].xyz * v0.zzz + r2.xyz; r2.xyz = cb2[7].xyz * v0.www + r2.xyz; r0.z = -cb0[6].x + -r2.z; p2.x = r0.z * cb3[1].z + 1; r0.z = dot(r2.xyz, r2.xyz); r2.w = sqrt(r0.z); o3.xyzw = r2.xyzw; r2.xyw = r2.xyz / r2.www; o4.z = -r2.z; r0.y = cb1[5].x * r0.y; r3.xzw = float3(0.5,0.5,0.5) * r0.xwy; o4.w = r0.w; o4.xy = r3.xw + r3.zz; r0.x = dot(r2.xyw, r1.xyz); r0.x = r0.x + r0.x; o5.xyz = r1.xyz * -r0.xxx + r2.xyw; p5.x = v3.y * cb0[15].y + cb0[15].w; return; } /****************************** COMPILE ERRORS ****************************** D:\Temp2\steamapps\common\INSIDE\ShaderFixes\6c06b15624741d0a-vs_replace.txt(152,3-9): error X3018: invalid subscript 'xyzw' compilation failed; no code produced ****************************** COMPILE ERRORS ******************************/ [/code] I don't know about this one though... Should I keed o3 as float3 and correct line 152 or should I make it a float4?[/quote] For this one, you'd want to break the instruction into two pieces, so: [code]o3.xyz = r2.xyz; p3.w = r2.w;[/code] We can't change the input signature, because the data flows from this VS to the PS, and unless we change all PS usages of the inputs, we'd get a data mismatch. It's easiest to keep the input/output signatures unchanged as much as possible. No idea why fxc decided to break those up, probably has to do with how it's used in the PS.
helifax said:Hi bo3b!
Big thanks for that input!

For this shader
// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt
// 3DMigoto: 6c06b15624741d0a | Unity headers extracted from Sh_PDfxLightcones_depthfade_ws_tex.shader
// Shader "Playdead/FX/Lightcones Depthfade WS Smoke" {
// Properties {
// _Color ("Color", Color) = (0.573,0.774,1,1)
// _Illum ("Illum", Range(0,10)) = 3
// _Power ("Gamma", Range(0,10)) = 2
// _InvFade ("Depth Fade Factor", Range(0.1,5)) = 1
// _OffsetTime ("Time Offset", Range(0,100)) = 0
// _OffsetX ("Speed X", Range(-4,4)) = 1
// _OffsetY ("Speed Y", Range(-4,4)) = 1
// _StretchX ("Stretch X (-2,2)", Range(-2,2)) = 1
// _StretchY ("Stretch Y (-2,2)", Range(-2,2)) = 1
// _MainTex ("Base Transparency (R)", 2D) = "white" { }
// _Tex1 ("FallOffTex1 (beam) (RGB)", 2D) = "white" { }
// _Tex2 ("FallOffTex2 (sphere) (RGB)", 2D) = "white" { }
// _TextureBlend ("Texture Blend", Range(0,1)) = 0.5
// }
// Fallback Off
// SubShader 1/1 {
// Tags { "QUEUE"="Transparent+1" }
// Pass 1/1 {
// Name "BASE"
// Tags { "LIGHTMODE"="Always" "QUEUE"="Transparent+1" }
// ZTest Less
// ZWrite Off
// Cull Off
// Fog { Mode Off }
// Blend One One
// ColorMask RGB
// GpuProgramID 47144
// Program "vp" {
// SubProgram "d3d11 " {
// Bind "vertex" Vertex
// Bind "normal" Normal
// Bind "texcoord" TexCoord0
// ConstBuffer "$Globals" 336
// Vector 96 [unity_FogStart]
// Float 216 [_OffsetTime]
// Float 220 [_OffsetX]
// Float 224 [_OffsetY]
// Float 228 [_StretchX]
// Float 232 [_StretchY]
// Vector 240 [_MainTex_ST]
// ConstBuffer "UnityPerCamera" 144
// Vector 0 [_Time]
// Vector 80 [_ProjectionParams]
// ConstBuffer "UnityPerDraw" 336
// Matrix 0 [glstate_matrix_mvp]
// Matrix 64 [glstate_matrix_modelview0]
// Matrix 128 [glstate_matrix_invtrans_modelview0]
// Matrix 192 [_Object2World]
// ConstBuffer "UnityFog" 32
// Vector 16 [unity_FogParams]
// BindCB "$Globals" 0
// BindCB "UnityPerCamera" 1
// BindCB "UnityPerDraw" 2
// BindCB "UnityFog" 3
// }
// }
// }
// }
// }
//
// Headers extracted with DarkStarSword's extract_unity_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity_shaders.py

//
// Shader model vs_4_0

// ---- Created with 3Dmigoto v1.2.38 on Mon Jul 11 11:42:36 2016
cbuffer cb3 : register(b3)
{
float4 cb3[2];
}

cbuffer cb2 : register(b2)
{
float4 cb2[16];
}

cbuffer cb1 : register(b1)
{
float4 cb1[6];
}

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




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


void main(
float4 v0 : POSITION0,
float4 v1 : TANGENT0,
float3 v2 : NORMAL0,
float4 v3 : TEXCOORD0,
out float4 o0 : SV_POSITION0,
out float4 o1 : TEXCOORD0,
out float3 o2 : TEXCOORD1,
out float p2 : TEXCOORD4,
out float3 o3 : TEXCOORD2,
out float p3 : TEXCOORD5,
out float4 o4 : TEXCOORD3,
out float3 o5 : TEXCOORD6,
out float p5 : TEXCOORD7)
{
float4 r0,r1,r2,r3;
uint4 bitmask, uiDest;
float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

r0.xyzw = cb2[1].xyzw * v0.yyyy;
r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw;
r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw;
r0.xyzw = cb2[3].xyzw * v0.wwww + r0.xyzw;
o0.xyzw = r0.xyzw;

// Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /cygdrive/d/fxc.exe 6c06b15624741d0a-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

r1.xyz = cb2[13].xyz * v0.yyy;
r1.xyz = cb2[12].xyz * v0.xxx + r1.xyz;
r1.xyz = cb2[14].xyz * v0.zzz + r1.xyz;
r1.xyz = cb2[15].xyz * v0.www + r1.xyz;
r1.xyz = cb0[14].yzz * r1.xyz;
r0.z = cb1[0].x + cb0[13].z;
o1.xz = r0.zz * cb0[13].ww + r1.xx;
o1.yw = r0.zz * cb0[14].xx + r1.yz;
r1.xyz = cb2[9].xyz * v2.yyy;
r1.xyz = cb2[8].xyz * v2.xxx + r1.xyz;
r1.xyz = cb2[10].xyz * v2.zzz + r1.xyz;
o2.xyz = r1.xyz;
r2.xyz = cb2[5].xyz * v0.yyy;
r2.xyz = cb2[4].xyz * v0.xxx + r2.xyz;
r2.xyz = cb2[6].xyz * v0.zzz + r2.xyz;
r2.xyz = cb2[7].xyz * v0.www + r2.xyz;
r0.z = -cb0[6].x + -r2.z;
p2.x = r0.z * cb3[1].z + 1;
r0.z = dot(r2.xyz, r2.xyz);
r2.w = sqrt(r0.z);
o3.xyzw = r2.xyzw;
r2.xyw = r2.xyz / r2.www;
o4.z = -r2.z;
r0.y = cb1[5].x * r0.y;
r3.xzw = float3(0.5,0.5,0.5) * r0.xwy;
o4.w = r0.w;
o4.xy = r3.xw + r3.zz;
r0.x = dot(r2.xyw, r1.xyz);
r0.x = r0.x + r0.x;
o5.xyz = r1.xyz * -r0.xxx + r2.xyw;
p5.x = v3.y * cb0[15].y + cb0[15].w;
return;
}

/****************************** COMPILE ERRORS ******************************
D:\Temp2\steamapps\common\INSIDE\ShaderFixes\6c06b15624741d0a-vs_replace.txt(152,3-9): error X3018: invalid subscript 'xyzw'

compilation failed; no code produced
****************************** COMPILE ERRORS ******************************/


I don't know about this one though... Should I keed o3 as float3 and correct line 152 or should I make it a float4?

For this one, you'd want to break the instruction into two pieces, so:

o3.xyz = r2.xyz;
p3.w = r2.w;


We can't change the input signature, because the data flows from this VS to the PS, and unless we change all PS usages of the inputs, we'd get a data mismatch. It's easiest to keep the input/output signatures unchanged as much as possible.

No idea why fxc decided to break those up, probably has to do with how it's used in the PS.

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

Posted 07/12/2016 05:51 AM   
Well, I just discovered that there are two alternate IDs for some of the profile settings, which I've listed here: [url]http://wiki.bo3b.net/index.php?title=Driver_Profile_Settings#Notes_on_settings_with_multiple_IDs[/url] Interestingly it looks like a number of built in profiles (e.g. Biohazard 5, Civ5, RE5, SR3) ship with both the primary setting ID and one of the two possible alternate IDs. In this case, I believe the alternate ID will take precedence over the primary ID, *but* only one of the two possible alternate IDs can be used for a given game and I haven't quite worked out how to work out which it will be. I've updated my [url=https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/CustomSettingNames_en-EN.xml]CustomSettingNames_en-EN.xml[/url] with these additional IDs (note that this file is for the old version of NVIDIA Inspector, though will work with the new one at a pinch by removing the _en-EN from the filename. I'm working on polishing up a version to send upstream). Also, I am now getting quite convinced that the internal settings flag changes the encoding scheme of all the settings, but I don't know how yet. My reasoning is that StereoConvergence is clearly a floating point value for user profiles, but apparently garbage for built in profiles. Likewise, all the string properties that don't decode properly are the ones with the internal settings flag.
Well, I just discovered that there are two alternate IDs for some of the profile settings, which I've listed here:

http://wiki.bo3b.net/index.php?title=Driver_Profile_Settings#Notes_on_settings_with_multiple_IDs

Interestingly it looks like a number of built in profiles (e.g. Biohazard 5, Civ5, RE5, SR3) ship with both the primary setting ID and one of the two possible alternate IDs. In this case, I believe the alternate ID will take precedence over the primary ID, *but* only one of the two possible alternate IDs can be used for a given game and I haven't quite worked out how to work out which it will be.

I've updated my CustomSettingNames_en-EN.xml with these additional IDs (note that this file is for the old version of NVIDIA Inspector, though will work with the new one at a pinch by removing the _en-EN from the filename. I'm working on polishing up a version to send upstream).


Also, I am now getting quite convinced that the internal settings flag changes the encoding scheme of all the settings, but I don't know how yet. My reasoning is that StereoConvergence is clearly a floating point value for user profiles, but apparently garbage for built in profiles. Likewise, all the string properties that don't decode properly are the ones with the internal settings flag.

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/12/2016 05:45 PM   
[quote="DarkStarSword"]Also, I am now getting quite convinced that the internal settings flag changes the encoding scheme of all the settings, but I don't know how yet. My reasoning is that StereoConvergence is clearly a floating point value for user profiles, but apparently garbage for built in profiles. Likewise, all the string properties that don't decode properly are the ones with the internal settings flag.[/quote]I've worked out something pretty significant about the internal fields that explains *A LOT* of mysteries about the built in profiles, like why their values are so strange and don't match our documentation, and why NVIDIA Inspector can't be used to edit these without damaging them. I'm still missing a pretty key piece of information that I need to decode arbitrary settings...
DarkStarSword said:Also, I am now getting quite convinced that the internal settings flag changes the encoding scheme of all the settings, but I don't know how yet. My reasoning is that StereoConvergence is clearly a floating point value for user profiles, but apparently garbage for built in profiles. Likewise, all the string properties that don't decode properly are the ones with the internal settings flag.
I've worked out something pretty significant about the internal fields that explains *A LOT* of mysteries about the built in profiles, like why their values are so strange and don't match our documentation, and why NVIDIA Inspector can't be used to edit these without damaging them. I'm still missing a pretty key piece of information that I need to decode arbitrary settings...

2x Geforce GTX 980 in SLI provided by NVIDIA, i7 6700K 4GHz CPU, Asus 27" VG278HE 144Hz 3D Monitor, BenQ W1070 3D Projector, 120" Elite Screens YardMaster 2, 32GB Corsair DDR4 3200MHz RAM, Samsung 850 EVO 500G SSD, 4x750GB HDD in RAID5, Gigabyte Z170X-Gaming 7 Motherboard, Corsair Obsidian 750D Airflow Edition Case, Corsair RM850i PSU, HTC Vive, Win 10 64bit

Alienware M17x R4 w/ built in 3D, Intel i7 3740QM, GTX 680m 2GB, 16GB DDR3 1600MHz RAM, Win7 64bit, 1TB SSD, 1TB HDD, 750GB HDD

Pre-release 3D fixes, shadertool.py and other goodies: http://github.com/DarkStarSword/3d-fixes
Support me on Patreon: https://www.patreon.com/DarkStarSword or PayPal: https://www.paypal.me/DarkStarSword

Posted 07/12/2016 08:03 PM   
  60 / 88    
Scroll To Top