Bo3b's School For Shaderhackers
  30 / 87    
Performance should be fine, though reloading shaders with F10 might take longer. If there's that many though I would seriously consider trying to force them to render in mono instead (unless doing so looks bad)
Performance should be fine, though reloading shaders with F10 might take longer. If there's that many though I would seriously consider trying to force them to render in mono instead (unless doing so looks bad)

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 03/19/2015 11:25 AM   
First of all I want to apologize that I didn't contribute to game fixes the last months - I had not much time for playing and the games I have played had much content to offer (MMORPGs, FF XIII). So I didn't have a look at new games (and fixes). But now the kickstarter project Woolfe was released and after making a fix for the demo (https://forums.geforce.com/default/topic/787005/3d-vision/woolfe-beautiful-2-5d-platformer-with-promising-s3d-potential/) I would like to offer a fix for the release version. I want to include a fix for dynamic shadows and hope that You can give me some hints how to do that. The game uses the UR3 engine and there are several fixes for dynamic shadows in UR3 games. So I hope that it is quite simple to find a solution. If there is already a tutorial how to fix shadows please tell me where I can find it. I have already tried to use the PSscript.lua (e.g. from Zeno Clash 2) and ShaderH3dFixer.jar (from Mind Path to Thalamus). It changed the PS for the shadow but didn't fix it. This is the original PS (I hope that I hunted the correct one): [code]// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float3 FalloffParameters; // float2 InvRandomAngleTextureSize; // float4 LightPosition; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // float4x4 ScreenToWorld; // sampler2D ShadowDepthTexture; // float4 ShadowModulateColor; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ScreenToWorld c22 4 // ShadowModulateColor c26 1 // LightPosition c27 1 // FalloffParameters c28 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 2, -1, 1, 0.125 def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 rcp r0.x, v0.w mul r0.yz, r0.x, v0.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r1.x, r2.w mul r1.zw, r1.x, r2.xyxy min r3.z, r2.z, c3.z mad r2.zw, v0.xyxy, r0.x, c3.y mul r2.zw, r2, c0.xyxy mul r2.zw, r2, c3.w texld r4, r2.zwzw, s2 mad_pp r4, r4.yxyx, c4.x, c4.y mul_pp r5, r4.wzwz, c4.zyzy mad r6, r5.zwzw, c18.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r1.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r1.z, r0.x, c4.w add r1.w, -r0.x, c5.x add r0.x, r0.x, c5.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r1.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r1.x, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r1.x, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r1.x, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c5.z, -r1.z mad_pp r1.z, r0.x, c5.w, r1.z endif mul r2.xyz, r0.z, c23 mad r0.xyz, c22, r0.y, r2 mad r0.xyz, c24, r0.w, r0 add r0.xyz, r0, c25 add r0.xyz, -r0, c27 mul r0.xyz, r0, c27.w dp3 r0.x, r0, r0 rsq r0.x, r0.x rcp r0.x, r0.x mad r0.x, r0.x, c28.y, c28.z max r1.x, r0.x, c3.x mad r0.x, r1.x, -r1.x, c3.y max r1.x, r0.x, c3.x pow_pp r0.x, r1.x, c28.x add r2, -r1.y, c26 mad_pp r0, r0.x, r2, c3.y mul_pp r1.x, r1.z, r1.z mul_pp r1.x, r1.z, r1.x add_pp r2, -r0, c3.y mad_pp oC0, r1.x, r2, r0 // approximately 150 instruction slots used (43 texture, 107 arithmetic) [/code] This is the changed shader by ShaderH3dFixer.jar (that didn't work): [code]// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float3 FalloffParameters; // float2 InvRandomAngleTextureSize; // float4 LightPosition; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // float4x4 ScreenToWorld; // sampler2D ShadowDepthTexture; // float4 ShadowModulateColor; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ScreenToWorld c22 4 // ShadowModulateColor c26 1 // LightPosition c27 1 // FalloffParameters c28 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 2, -1, 1, 0.125 def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 def c200, 0.5, 0, 0.0625, 0 dcl_2d s13 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 rcp r0.x, v0.w mul r0.yz, r0.x, v0.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 texldl r16, c200.z, s13 add r16.y, r1.w, -r16.y mul r16.x, r16.x, r16.y add r0.y, r0.y, -r16.x mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r1.x, r2.w mul r1.zw, r1.x, r2.xyxy min r3.z, r2.z, c3.z mad r2.zw, v0.xyxy, r0.x, c3.y mul r2.zw, r2, c0.xyxy mul r2.zw, r2, c3.w texld r4, r2.zwzw, s2 mad_pp r4, r4.yxyx, c4.x, c4.y mul_pp r5, r4.wzwz, c4.zyzy mad r6, r5.zwzw, c18.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r1.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r1.z, r0.x, c4.w add r1.w, -r0.x, c5.x add r0.x, r0.x, c5.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r1.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r1.x, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r1.x, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r1.x, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c5.z, -r1.z mad_pp r1.z, r0.x, c5.w, r1.z endif mul r2.xyz, r0.z, c23 mad r0.xyz, c22, r0.y, r2 mad r0.xyz, c24, r0.w, r0 add r0.xyz, r0, c25 add r0.xyz, -r0, c27 mul r0.xyz, r0, c27.w dp3 r0.x, r0, r0 rsq r0.x, r0.x rcp r0.x, r0.x mad r0.x, r0.x, c28.y, c28.z max r1.x, r0.x, c3.x mad r0.x, r1.x, -r1.x, c3.y max r1.x, r0.x, c3.x pow_pp r0.x, r1.x, c28.x add r2, -r1.y, c26 mad_pp r0, r0.x, r2, c3.y mul_pp r1.x, r1.z, r1.z mul_pp r1.x, r1.z, r1.x add_pp r2, -r0, c3.y mad_pp oC0, r1.x, r2, r0 // approximately 150 instruction slots used (43 texture, 107 arithmetic) [/code] The depth of the shadow seems to be correct if You look at the square You get when hunting the PS: http://photos.3dvisionlive.com/3d4dd/image/550b2406e7e564b43a00020c/ Only the outlines are wrong and also suffer from halo like issues: http://photos.3dvisionlive.com/3d4dd/image/550b243ee7e564894f00008b/ Do You have a suggestion how to fix the shader...?
First of all I want to apologize that I didn't contribute to game fixes the last months - I had not much time for playing and the games I have played had much content to offer (MMORPGs, FF XIII). So I didn't have a look at new games (and fixes).
But now the kickstarter project Woolfe was released and after making a fix for the demo (https://forums.geforce.com/default/topic/787005/3d-vision/woolfe-beautiful-2-5d-platformer-with-promising-s3d-potential/) I would like to offer a fix for the release version. I want to include a fix for dynamic shadows and hope that You can give me some hints how to do that. The game uses the UR3 engine and there are several fixes for dynamic shadows in UR3 games. So I hope that it is quite simple to find a solution. If there is already a tutorial how to fix shadows please tell me where I can find it. I have already tried to use the PSscript.lua (e.g. from Zeno Clash 2) and ShaderH3dFixer.jar (from Mind Path to Thalamus). It changed the PS for the shadow but didn't fix it.
This is the original PS (I hope that I hunted the correct one):
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float3 FalloffParameters;
// float2 InvRandomAngleTextureSize;
// float4 LightPosition;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// float4x4 ScreenToWorld;
// sampler2D ShadowDepthTexture;
// float4 ShadowModulateColor;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ScreenToWorld c22 4
// ShadowModulateColor c26 1
// LightPosition c27 1
// FalloffParameters c28 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 2, -1, 1, 0.125
def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2
rcp r0.x, v0.w
mul r0.yz, r0.x, v0.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r1.x, r2.w
mul r1.zw, r1.x, r2.xyxy
min r3.z, r2.z, c3.z
mad r2.zw, v0.xyxy, r0.x, c3.y
mul r2.zw, r2, c0.xyxy
mul r2.zw, r2, c3.w
texld r4, r2.zwzw, s2
mad_pp r4, r4.yxyx, c4.x, c4.y
mul_pp r5, r4.wzwz, c4.zyzy
mad r6, r5.zwzw, c18.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r1.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r1.z, r0.x, c4.w
add r1.w, -r0.x, c5.x
add r0.x, r0.x, c5.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r1.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r1.x, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r1.x, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r1.x, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c5.z, -r1.z
mad_pp r1.z, r0.x, c5.w, r1.z
endif
mul r2.xyz, r0.z, c23
mad r0.xyz, c22, r0.y, r2
mad r0.xyz, c24, r0.w, r0
add r0.xyz, r0, c25
add r0.xyz, -r0, c27
mul r0.xyz, r0, c27.w
dp3 r0.x, r0, r0
rsq r0.x, r0.x
rcp r0.x, r0.x
mad r0.x, r0.x, c28.y, c28.z
max r1.x, r0.x, c3.x
mad r0.x, r1.x, -r1.x, c3.y
max r1.x, r0.x, c3.x
pow_pp r0.x, r1.x, c28.x
add r2, -r1.y, c26
mad_pp r0, r0.x, r2, c3.y
mul_pp r1.x, r1.z, r1.z
mul_pp r1.x, r1.z, r1.x
add_pp r2, -r0, c3.y
mad_pp oC0, r1.x, r2, r0

// approximately 150 instruction slots used (43 texture, 107 arithmetic)

This is the changed shader by ShaderH3dFixer.jar (that didn't work):
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float3 FalloffParameters;
// float2 InvRandomAngleTextureSize;
// float4 LightPosition;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// float4x4 ScreenToWorld;
// sampler2D ShadowDepthTexture;
// float4 ShadowModulateColor;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ScreenToWorld c22 4
// ShadowModulateColor c26 1
// LightPosition c27 1
// FalloffParameters c28 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 2, -1, 1, 0.125
def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
def c200, 0.5, 0, 0.0625, 0
dcl_2d s13
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2
rcp r0.x, v0.w
mul r0.yz, r0.x, v0.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15
texldl r16, c200.z, s13
add r16.y, r1.w, -r16.y
mul r16.x, r16.x, r16.y
add r0.y, r0.y, -r16.x
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r1.x, r2.w
mul r1.zw, r1.x, r2.xyxy
min r3.z, r2.z, c3.z
mad r2.zw, v0.xyxy, r0.x, c3.y
mul r2.zw, r2, c0.xyxy
mul r2.zw, r2, c3.w
texld r4, r2.zwzw, s2
mad_pp r4, r4.yxyx, c4.x, c4.y
mul_pp r5, r4.wzwz, c4.zyzy
mad r6, r5.zwzw, c18.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r1.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r1.z, r0.x, c4.w
add r1.w, -r0.x, c5.x
add r0.x, r0.x, c5.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r1.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r1.x, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r1.x, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r1.x, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c5.z, -r1.z
mad_pp r1.z, r0.x, c5.w, r1.z
endif
mul r2.xyz, r0.z, c23
mad r0.xyz, c22, r0.y, r2
mad r0.xyz, c24, r0.w, r0
add r0.xyz, r0, c25
add r0.xyz, -r0, c27
mul r0.xyz, r0, c27.w
dp3 r0.x, r0, r0
rsq r0.x, r0.x
rcp r0.x, r0.x
mad r0.x, r0.x, c28.y, c28.z
max r1.x, r0.x, c3.x
mad r0.x, r1.x, -r1.x, c3.y
max r1.x, r0.x, c3.x
pow_pp r0.x, r1.x, c28.x
add r2, -r1.y, c26
mad_pp r0, r0.x, r2, c3.y
mul_pp r1.x, r1.z, r1.z
mul_pp r1.x, r1.z, r1.x
add_pp r2, -r0, c3.y
mad_pp oC0, r1.x, r2, r0

// approximately 150 instruction slots used (43 texture, 107 arithmetic)

The depth of the shadow seems to be correct if You look at the square You get when hunting the PS: http://photos.3dvisionlive.com/3d4dd/image/550b2406e7e564b43a00020c/ Only the outlines are wrong and also suffer from halo like issues: http://photos.3dvisionlive.com/3d4dd/image/550b243ee7e564894f00008b/

Do You have a suggestion how to fix the shader...?

My original display name is 3d4dd - for some reason Nvidia changed it..?!

Posted 03/19/2015 07:43 PM   
This is the pattern I've been using to fix shadows in UE3 games - I wasn't aware of ShaderH3dFixer.jar, but I did study Mind to find this: https://github.com/DarkStarSword/3d-fixes/commit/b3654fabe988589ee660a3c02da3fa5e67569c5a I'd bet the only reason the script didn't work is because it was looking for UE3's usual stereo correction to find where to insert the correction for v0, but for whatever reason that shader is missing it. I reckon if you add that correction near the top of the shader (between the dcl's and the rcp) it will probably do the trick (you will still need the uncorrection before ScreenToShadowMatrix that the script already added for you).
This is the pattern I've been using to fix shadows in UE3 games - I wasn't aware of ShaderH3dFixer.jar, but I did study Mind to find this:

https://github.com/DarkStarSword/3d-fixes/commit/b3654fabe988589ee660a3c02da3fa5e67569c5a

I'd bet the only reason the script didn't work is because it was looking for UE3's usual stereo correction to find where to insert the correction for v0, but for whatever reason that shader is missing it. I reckon if you add that correction near the top of the shader (between the dcl's and the rcp) it will probably do the trick (you will still need the uncorrection before ScreenToShadowMatrix that the script already added for you).

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 03/19/2015 11:48 PM   
Thank You for Your hint! I tried to transfer Your method and used this code: [code]// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float3 FalloffParameters; // float2 InvRandomAngleTextureSize; // float4 LightPosition; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // float4x4 ScreenToWorld; // sampler2D ShadowDepthTexture; // float4 ShadowModulateColor; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ScreenToWorld c22 4 // ShadowModulateColor c26 1 // LightPosition c27 1 // FalloffParameters c28 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 2, -1, 1, 0.125 def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 def c220, 0, 1, 0.0625, 0.5 dcl_2d s13 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 // Stereoise v0 texldl r31, c220.z, s13 mov r30.xyw, v0 add r31.w, r30.w, -r31.y mad r30.x, r31.w, r31.x, r30.x // rcp r0.x, v0.w // mul r0.yz, r0.x, v0.xxyw rcp r0.x, r30.w mul r0.yz, r0.x, r30.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 // Unstereoise before ScreenToShadowMatrix add r31.w, r0.x, -r31.y mad r0.y, -r31.w, r31.x, r0.y mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r1.x, r2.w mul r1.zw, r1.x, r2.xyxy min r3.z, r2.z, c3.z // mad r2.zw, v0.xyxy, r0.x, c3.y mad r2.zw, r30.xyxy, r0.x, c3.y mul r2.zw, r2, c0.xyxy mul r2.zw, r2, c3.w texld r4, r2.zwzw, s2 mad_pp r4, r4.yxyx, c4.x, c4.y mul_pp r5, r4.wzwz, c4.zyzy mad r6, r5.zwzw, c18.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r1.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r1.z, r0.x, c4.w add r1.w, -r0.x, c5.x add r0.x, r0.x, c5.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r1.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r1.x, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r1.x, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r1.x, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c5.z, -r1.z mad_pp r1.z, r0.x, c5.w, r1.z endif mul r2.xyz, r0.z, c23 mad r0.xyz, c22, r0.y, r2 mad r0.xyz, c24, r0.w, r0 add r0.xyz, r0, c25 add r0.xyz, -r0, c27 mul r0.xyz, r0, c27.w dp3 r0.x, r0, r0 rsq r0.x, r0.x rcp r0.x, r0.x mad r0.x, r0.x, c28.y, c28.z max r1.x, r0.x, c3.x mad r0.x, r1.x, -r1.x, c3.y max r1.x, r0.x, c3.x pow_pp r0.x, r1.x, c28.x add r2, -r1.y, c26 mad_pp r0, r0.x, r2, c3.y mul_pp r1.x, r1.z, r1.z mul_pp r1.x, r1.z, r1.x add_pp r2, -r0, c3.y mad_pp oC0, r1.x, r2, r0 // approximately 150 instruction slots used (43 texture, 107 arithmetic) [/code] Unfortunately it didn't fix the shadows but made it worse (outlines moved away from the character). I also wasn't sure about line 78 if I should replace v0 with r30 after the unstereoisation. Anyway it didn't work either with v0 nor r30 in line 78. Can You see a mistake in my code or is the shader too different from the shadow shaders used in other UR3 games?
Thank You for Your hint! I tried to transfer Your method and used this code:
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float3 FalloffParameters;
// float2 InvRandomAngleTextureSize;
// float4 LightPosition;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// float4x4 ScreenToWorld;
// sampler2D ShadowDepthTexture;
// float4 ShadowModulateColor;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ScreenToWorld c22 4
// ShadowModulateColor c26 1
// LightPosition c27 1
// FalloffParameters c28 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 2, -1, 1, 0.125
def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
def c220, 0, 1, 0.0625, 0.5
dcl_2d s13
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2
// Stereoise v0
texldl r31, c220.z, s13
mov r30.xyw, v0
add r31.w, r30.w, -r31.y
mad r30.x, r31.w, r31.x, r30.x
// rcp r0.x, v0.w
// mul r0.yz, r0.x, v0.xxyw
rcp r0.x, r30.w
mul r0.yz, r0.x, r30.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15
// Unstereoise before ScreenToShadowMatrix
add r31.w, r0.x, -r31.y
mad r0.y, -r31.w, r31.x, r0.y
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r1.x, r2.w
mul r1.zw, r1.x, r2.xyxy
min r3.z, r2.z, c3.z
// mad r2.zw, v0.xyxy, r0.x, c3.y
mad r2.zw, r30.xyxy, r0.x, c3.y
mul r2.zw, r2, c0.xyxy
mul r2.zw, r2, c3.w
texld r4, r2.zwzw, s2
mad_pp r4, r4.yxyx, c4.x, c4.y
mul_pp r5, r4.wzwz, c4.zyzy
mad r6, r5.zwzw, c18.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r1.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r1.z, r0.x, c4.w
add r1.w, -r0.x, c5.x
add r0.x, r0.x, c5.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r1.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r1.x, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r1.x, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r1.x, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c5.z, -r1.z
mad_pp r1.z, r0.x, c5.w, r1.z
endif
mul r2.xyz, r0.z, c23
mad r0.xyz, c22, r0.y, r2
mad r0.xyz, c24, r0.w, r0
add r0.xyz, r0, c25
add r0.xyz, -r0, c27
mul r0.xyz, r0, c27.w
dp3 r0.x, r0, r0
rsq r0.x, r0.x
rcp r0.x, r0.x
mad r0.x, r0.x, c28.y, c28.z
max r1.x, r0.x, c3.x
mad r0.x, r1.x, -r1.x, c3.y
max r1.x, r0.x, c3.x
pow_pp r0.x, r1.x, c28.x
add r2, -r1.y, c26
mad_pp r0, r0.x, r2, c3.y
mul_pp r1.x, r1.z, r1.z
mul_pp r1.x, r1.z, r1.x
add_pp r2, -r0, c3.y
mad_pp oC0, r1.x, r2, r0

// approximately 150 instruction slots used (43 texture, 107 arithmetic)

Unfortunately it didn't fix the shadows but made it worse (outlines moved away from the character). I also wasn't sure about line 78 if I should replace v0 with r30 after the unstereoisation. Anyway it didn't work either with v0 nor r30 in line 78.
Can You see a mistake in my code or is the shader too different from the shadow shaders used in other UR3 games?

My original display name is 3d4dd - for some reason Nvidia changed it..?!

Posted 03/20/2015 07:17 PM   
I was working on another UE3 game tonight (Viscera Cleanup Detail), so I decided to add the UE3 shadow fix to my shadertool.py - you can run it from the windows command prompt with something like this: c:\Python34\python.exe c:\...\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed Dumps\AllShaders\PixelShader\* As usual you can grab the latest version from my 3d-fixes repository on github. The pattern it uses to fix the shadows does not depend on the Unreal stereo correction (in fact, if it exists it will actively disable it), so there's a good chance it will work for the shadows in Woolfe. [s]Edit: If that pattern didn't work by hand then this script probably won't do any better.[/s]
I was working on another UE3 game tonight (Viscera Cleanup Detail), so I decided to add the UE3 shadow fix to my shadertool.py - you can run it from the windows command prompt with something like this:

c:\Python34\python.exe c:\...\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed Dumps\AllShaders\PixelShader\*

As usual you can grab the latest version from my 3d-fixes repository on github. The pattern it uses to fix the shadows does not depend on the Unreal stereo correction (in fact, if it exists it will actively disable it), so there's a good chance it will work for the shadows in Woolfe.

Edit: If that pattern didn't work by hand then this script probably won't do any better.

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 03/20/2015 07:27 PM   
I see the problem: [quote="3d4dd"][code]... // ScreenToShadowMatrix c14 4 ... mul r2, r0.z, c15 // Unstereoise before ScreenToShadowMatrix add r31.w, r0.x, -r31.y mad r0.y, -r31.w, r31.x, r0.y mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 ...[/code][/quote] The problem here is that the x, y and w components don't quite match up with the example I posted - you need to look at what it is using in the matrix multiply to work this out - since ScreenToShadowMatrix starts in c14, then you look at the line with that in it to find what it is using for X. Then add 2 to c14 to get c16 to and look at where that is used to find W. So here you will need to use r0.w as w (you're using r0.x), and r0.y as x. My shadertool.py script does this automatically - if you use it, please let me know if it worked for you :)
I see the problem:
3d4dd said:
...
// ScreenToShadowMatrix c14 4

...

mul r2, r0.z, c15
// Unstereoise before ScreenToShadowMatrix
add r31.w, r0.x, -r31.y
mad r0.y, -r31.w, r31.x, r0.y
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
...


The problem here is that the x, y and w components don't quite match up with the example I posted - you need to look at what it is using in the matrix multiply to work this out - since ScreenToShadowMatrix starts in c14, then you look at the line with that in it to find what it is using for X. Then add 2 to c14 to get c16 to and look at where that is used to find W.

So here you will need to use r0.w as w (you're using r0.x), and r0.y as x.

My shadertool.py script does this automatically - if you use it, please let me know if it worked for you :)

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 03/20/2015 07:36 PM   
This script sounds very interesting!!! Unfortunately it didn't work for me - but the reason is most likely that I didn't use it correctly ;) I have downloaded and installed Python 3.4.3 (https://www.python.org/downloads/) in C:\Python34. I copied the content from https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/shadertool.py to notepad++ and saved it as shadertool.py. Than I have made a folder C:\shaderfix and placed shadertool.py there. I have also made a folder C:\shaderfix\PixelShader and placed PixelShader_33_CRC32_952E819A.txt inside this folder. In the comand line I wrote c:\Python34\python.exe c:\shaderfix\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed PixelShader\* After getting this error message [code]Traceback (most recent call last): File "c:\shaderfix\shadertool.py", line 5, in <module> import shaderutil ImportError: No module named 'shaderutil'[/code] I also placed shaderutil.py (from https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/shaderutil.py) in c:\shaderfix\ When I entered the command line again I got no (error) message but the shader was unchanged and I only could find shaderutil.cpython-34.pyc in C:\shaderfix\__pycache__ Edit: I have manually replaced r0.x with r0.w in the shader and the shadows are perfect now :) But it would be great to be able to use Your shadertool for other games!
This script sounds very interesting!!!
Unfortunately it didn't work for me - but the reason is most likely that I didn't use it correctly ;)
I have downloaded and installed Python 3.4.3 (https://www.python.org/downloads/) in C:\Python34. I copied the content from https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/shadertool.py to notepad++ and saved it as shadertool.py. Than I have made a folder C:\shaderfix and placed shadertool.py there. I have also made a folder C:\shaderfix\PixelShader and placed PixelShader_33_CRC32_952E819A.txt inside this folder. In the comand line I wrote c:\Python34\python.exe c:\shaderfix\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed PixelShader\*
After getting this error message
Traceback (most recent call last):
File "c:\shaderfix\shadertool.py", line 5, in <module>
import shaderutil
ImportError: No module named 'shaderutil'

I also placed shaderutil.py (from https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/shaderutil.py) in c:\shaderfix\
When I entered the command line again I got no (error) message but the shader was unchanged and I only could find shaderutil.cpython-34.pyc in C:\shaderfix\__pycache__

Edit: I have manually replaced r0.x with r0.w in the shader and the shadows are perfect now :) But it would be great to be able to use Your shadertool for other games!

My original display name is 3d4dd - for some reason Nvidia changed it..?!

Posted 03/20/2015 08:28 PM   
Oh yeah, I forgot to mention that it won't overwrite a shader that is already in the ShaderOverride folder unless you specify both --install and --force (to make sure it won't accidentally overwrite a manual fix). I used to make it print out a message saying that it needed --force to overwrite a shader, but I removed it for Life Is Strange where the act of printing out that message 3,000 times was starting to take a significant amount of time. It will still print it if you specify --verbose, but I think I'll bring it back as the default and add a --quiet to suppress it instead. You can also use --in-place to fix a shader without copying it anywhere (say, to fix something already in ShaderOverride), but my intention is that the script would usually be run on the original shaders in Dumps and copied to ShaderOverride with --install (it may not always do what you expect if you run it on a shader that already has the stereo sampler or other fix applied). If you run the script with --help it will tell you all the other options it supports.
Oh yeah, I forgot to mention that it won't overwrite a shader that is already in the ShaderOverride folder unless you specify both --install and --force (to make sure it won't accidentally overwrite a manual fix).

I used to make it print out a message saying that it needed --force to overwrite a shader, but I removed it for Life Is Strange where the act of printing out that message 3,000 times was starting to take a significant amount of time. It will still print it if you specify --verbose, but I think I'll bring it back as the default and add a --quiet to suppress it instead.

You can also use --in-place to fix a shader without copying it anywhere (say, to fix something already in ShaderOverride), but my intention is that the script would usually be run on the original shaders in Dumps and copied to ShaderOverride with --install (it may not always do what you expect if you run it on a shader that already has the stereo sampler or other fix applied). If you run the script with --help it will tell you all the other options it supports.

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 03/21/2015 01:36 AM   
[quote="DarkStarSword"]I think I'll bring it back as the default and add a --quiet to suppress it instead.[/quote]This is done. It will now also print out an error if you don't pass it any arguments to tell it what to do with the result (like if you forget --install)
DarkStarSword said:I think I'll bring it back as the default and add a --quiet to suppress it instead.
This is done. It will now also print out an error if you don't pass it any arguments to tell it what to do with the result (like if you forget --install)

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 03/21/2015 03:34 AM   
Hi 3d4dd. Thanks for taking a look at this game. Try this for the dynamic shadows: VS 952E819A [code]// shadows (high setting) // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float3 FalloffParameters; // float2 InvRandomAngleTextureSize; // float4 LightPosition; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // float4x4 ScreenToWorld; // sampler2D ShadowDepthTexture; // float4 ShadowModulateColor; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ScreenToWorld c22 4 // ShadowModulateColor c26 1 // LightPosition c27 1 // FalloffParameters c28 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 2, -1, 1, 0.125 def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 def c50, 0.5, 0, 0, 0 dcl vPos.xy def c220, 0, 1, 0.0625, 0.5 dcl_2d s13 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 mov r16.xyw, v0 texldl r31, c220.z, s13 add r31.w, r16.w, -r31.y mad r16.x, r31.w, r31.x, r16.x rcp r0.x, r16.w //v0.w mul r0.yz, r0.x, r16.xxyw //v0.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 add r31.w, r0.w, -r31.y mad r0.y, r31.w, -r31.x, r0.y mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r1.x, r2.w mul r1.zw, r1.x, r2.xyxy min r3.z, r2.z, c3.z mad r2.zw, v0.xyxy, r0.x, c3.y mul r2.zw, r2, c0.xyxy mul r2.zw, r2, c3.w texld r4, r2.zwzw, s2 mad_pp r4, r4.yxyx, c4.x, c4.y mul_pp r5, r4.wzwz, c4.zyzy mad r6, r5.zwzw, c18.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r1.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r1.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r1.z, r0.x, c4.w add r1.w, -r0.x, c5.x add r0.x, r0.x, c5.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r1.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r1.x, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r1.x, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r1.x, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r1.x, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c5.z, -r1.z mad_pp r1.z, r0.x, c5.w, r1.z endif mul r2.xyz, r0.z, c23 mad r0.xyz, c22, r0.y, r2 mad r0.xyz, c24, r0.w, r0 add r0.xyz, r0, c25 add r0.xyz, -r0, c27 mul r0.xyz, r0, c27.w dp3 r0.x, r0, r0 rsq r0.x, r0.x rcp r0.x, r0.x mad r0.x, r0.x, c28.y, c28.z max r1.x, r0.x, c3.x mad r0.x, r1.x, -r1.x, c3.y max r1.x, r0.x, c3.x pow_pp r0.x, r1.x, c28.x add r2, -r1.y, c26 mad_pp r0, r0.x, r2, c3.y mul_pp r1.x, r1.z, r1.z mul_pp r1.x, r1.z, r1.x add_pp r2, -r0, c3.y mad_pp oC0, r1.x, r2, r0 // approximately 150 instruction slots used (43 texture, 107 arithmetic) [/code]
Hi 3d4dd. Thanks for taking a look at this game. Try this for the dynamic shadows:

VS 952E819A
// shadows (high setting)
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float3 FalloffParameters;
// float2 InvRandomAngleTextureSize;
// float4 LightPosition;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// float4x4 ScreenToWorld;
// sampler2D ShadowDepthTexture;
// float4 ShadowModulateColor;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ScreenToWorld c22 4
// ShadowModulateColor c26 1
// LightPosition c27 1
// FalloffParameters c28 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 2, -1, 1, 0.125
def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
def c50, 0.5, 0, 0, 0
dcl vPos.xy
def c220, 0, 1, 0.0625, 0.5
dcl_2d s13
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2
mov r16.xyw, v0
texldl r31, c220.z, s13
add r31.w, r16.w, -r31.y
mad r16.x, r31.w, r31.x, r16.x
rcp r0.x, r16.w //v0.w
mul r0.yz, r0.x, r16.xxyw //v0.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15
add r31.w, r0.w, -r31.y
mad r0.y, r31.w, -r31.x, r0.y
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r1.x, r2.w
mul r1.zw, r1.x, r2.xyxy
min r3.z, r2.z, c3.z
mad r2.zw, v0.xyxy, r0.x, c3.y
mul r2.zw, r2, c0.xyxy
mul r2.zw, r2, c3.w
texld r4, r2.zwzw, s2
mad_pp r4, r4.yxyx, c4.x, c4.y
mul_pp r5, r4.wzwz, c4.zyzy
mad r6, r5.zwzw, c18.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r1.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r1.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r1.z, r0.x, c4.w
add r1.w, -r0.x, c5.x
add r0.x, r0.x, c5.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r1.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r1.x, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r1.x, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r1.x, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r1.x, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c5.z, -r1.z
mad_pp r1.z, r0.x, c5.w, r1.z
endif
mul r2.xyz, r0.z, c23
mad r0.xyz, c22, r0.y, r2
mad r0.xyz, c24, r0.w, r0
add r0.xyz, r0, c25
add r0.xyz, -r0, c27
mul r0.xyz, r0, c27.w
dp3 r0.x, r0, r0
rsq r0.x, r0.x
rcp r0.x, r0.x
mad r0.x, r0.x, c28.y, c28.z
max r1.x, r0.x, c3.x
mad r0.x, r1.x, -r1.x, c3.y
max r1.x, r0.x, c3.x
pow_pp r0.x, r1.x, c28.x
add r2, -r1.y, c26
mad_pp r0, r0.x, r2, c3.y
mul_pp r1.x, r1.z, r1.z
mul_pp r1.x, r1.z, r1.x
add_pp r2, -r0, c3.y
mad_pp oC0, r1.x, r2, r0

// approximately 150 instruction slots used (43 texture, 107 arithmetic)

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

Posted 03/21/2015 03:57 AM   
I need help. I'm trying to disable the hud in a game using the Helix mod. I want to toggle the hud on/off with a key press. I've been through bo3b's shaderhacker tutorial, but I have a problem. I copy the shader into the Shaderoverride/vertexshaders folder and rename it correctly. When I run the game, the effect is automatically disabled before I've edited anything in the shader. Why is that happening? I need to be able to turn it on and off. Guts of the shader: [code]// vs_2_0 dcl_position v0 dcl_color v1 dcl_color1 v2 dp4 oPos.x, v0, c0 dp4 oPos.y, v0, c1 dp4 oT0.x, v0, c2 dp4 oT0.y, v0, c3 mov oPos.zw, v0 mov oD0, v1.zyxw mov oD1, v2.zyxw // approximately 7 instruction slots used[/code]
I need help.

I'm trying to disable the hud in a game using the Helix mod. I want to toggle the hud on/off with a key press.

I've been through bo3b's shaderhacker tutorial, but I have a problem.


I copy the shader into the Shaderoverride/vertexshaders folder and rename it correctly. When I run the game, the effect is automatically disabled before I've edited anything in the shader. Why is that happening? I need to be able to turn it on and off.

Guts of the shader:
//

vs_2_0
dcl_position v0
dcl_color v1
dcl_color1 v2
dp4 oPos.x, v0, c0
dp4 oPos.y, v0, c1
dp4 oT0.x, v0, c2
dp4 oT0.y, v0, c3
mov oPos.zw, v0
mov oD0, v1.zyxw
mov oD1, v2.zyxw

// approximately 7 instruction slots used

Posted 03/21/2015 04:25 AM   
@ hudfreegamer The shader needs to be converted to VS_3_0 [code] vs_3_0 dcl_position o10 dcl_texcoord o0.xy dcl_color o8 dcl_color1 o9 dcl_position v0 dcl_color v1 dcl_color1 v2 dp4 o10.x, v0, c0 dp4 o10.y, v0, c1 dp4 o0.x, v0, c2 dp4 o0.y, v0, c3 mov o10.zw, v0 mov o8, v1.zyxw mov o9, v2.zyxw[/code] DarkStarSword has a good tool to convert VS 2.0 to 3.0: [url]https://github.com/DarkStarSword/3d-fixes#shadertoolpy[/url] Also, TsaebehT has a program for this (ShaderConverter), but I can't locate the link for it at the moment.
@ hudfreegamer

The shader needs to be converted to VS_3_0

vs_3_0
dcl_position o10
dcl_texcoord o0.xy
dcl_color o8
dcl_color1 o9
dcl_position v0
dcl_color v1
dcl_color1 v2
dp4 o10.x, v0, c0
dp4 o10.y, v0, c1
dp4 o0.x, v0, c2
dp4 o0.y, v0, c3
mov o10.zw, v0
mov o8, v1.zyxw
mov o9, v2.zyxw


DarkStarSword has a good tool to convert VS 2.0 to 3.0: https://github.com/DarkStarSword/3d-fixes#shadertoolpy

Also, TsaebehT has a program for this (ShaderConverter), but I can't locate the link for it at the moment.

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

Posted 03/21/2015 05:24 AM   
How do I use that python shader converter? I get syntax errors. I just want a straight conversion from v2_0 to v_3_0. This is what I tried (I entered the first line, the rest was generated by the program): [code]>>> python shadertool.py 0B3F4AB7.txt File "<stdin>", line 1 python shadertool.py 0B3F4AB7.txt ^ SyntaxError: invalid syntax [/code] I tried different combinations of brackets and quote marks, but I keep getting the same error.
How do I use that python shader converter? I get syntax errors. I just want a straight conversion from v2_0 to v_3_0.

This is what I tried (I entered the first line, the rest was generated by the program):

>>> python shadertool.py 0B3F4AB7.txt
File "<stdin>", line 1
python shadertool.py 0B3F4AB7.txt
^
SyntaxError: invalid syntax


I tried different combinations of brackets and quote marks, but I keep getting the same error.

Posted 03/21/2015 08:02 PM   
@hudfreegamer: I guess You have to enter the path for python.exe, the path for shadertool.py, different arguments (like --install --auto-fix-unreal-shadows etc., see --help) and the path where the pixel shaders are stored (I had to enter the complete path to get the tool to work e.g. C:\test\ShaderOverride\PixelShaders\*). So it should look like this: c:\Python34\python.exe c:\shaderfix\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* @4everAwake,DarkStarSword: Thanks to Your hints PS 952E819A is fixed now (using the tool or doing it manually). Now I have stumbled across another PS which is responsible for dynamic shadows in a sunset scenario. It is very similar to PS 952E819A but in this case using the tool didn't fix the shader. This is the original code for PS 1341BDFB: [code]// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float2 InvRandomAngleTextureSize; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // sampler2D ShadowDepthTexture; // float ShadowFadeFraction; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ShadowFadeFraction c22 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 def c5, 2, -1, 1, 0.125 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 rcp r0.x, v0.w mul r0.yz, r0.x, v0.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r0.y, r2.w mul r0.zw, r0.y, r2.xyxy min r3.z, r2.z, c3.z mad r1.xz, v0.xyyw, r0.x, c3.y mul r1.xz, r1, c0.xyyw mul r1.xz, r1, c3.w texld r4, r1.xzzw, s2 mad_pp r4, r4.yxyx, c5.x, c5.y mul_pp r5, r4.wzwz, c5.zyzy mad r6, r5.zwzw, c18.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r0.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r0.z, r0.x, c5.w add r0.w, -r0.x, c4.x add r0.x, r0.x, c4.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r0.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r0.y, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r0.y, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r0.y, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c4.z, -r0.z mad_pp r0.z, r0.x, c4.w, r0.z endif mul_pp r0.x, r0.z, r0.z mul_pp r0.x, r0.z, r0.x mad r0.x, r0.x, r0.x, -c3.y mad_pp r0.x, c22.x, r0.x, r1.y rsq_pp r0.x, r0.x rcp_pp oC0, r0.x // approximately 134 instruction slots used (43 texture, 91 arithmetic) [/code] This is the fixed code by the tool (shadows still broken): [code]// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4 EdgeSampleOffsets[4]; // float2 InvRandomAngleTextureSize; // float4 MinZ_MaxZRatio; // sampler2D RandomAngleTexture; // float4 RefiningSampleOffsets[6]; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // float4x4 ScreenToShadowMatrix; // sampler2D ShadowDepthTexture; // float ShadowFadeFraction; // // // Registers: // // Name Reg Size // ------------------------- ----- ---- // InvRandomAngleTextureSize c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // RefiningSampleOffsets c8 6 // ScreenToShadowMatrix c14 4 // EdgeSampleOffsets c18 4 // ShadowFadeFraction c22 1 // SceneColorTexture s0 1 // ShadowDepthTexture s1 1 // RandomAngleTexture s2 1 // ps_3_0 def c3, 0, 1, 0.999000013, 0.5 def c4, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988 def c5, 2, -1, 1, 0.125 dcl_texcoord v0.xyw dcl_2d s0 dcl_2d s1 dcl_2d s2 def c220, 0, 1, 0.0625, 0.5 dcl_2d s13 // Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py: // shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\1341BDFB.txt texldl r9, c220.z, s13 mov r8.xyw, v0 add r9.w, r8.w, -r9.y mad r8.x, r9.w, r9.x, r8.x rcp r0.x, r8.w mul r0.yz, r0.x, r8.xxyw mad r1.xy, r0.yzzw, c1, c1.wzzw mov r1.zw, c3.x texldl r1, r1, s0 mov r1.y, c3.y add r0.w, r1.y, -c2.y add r0.w, -r0.w, r1.w rcp r0.w, r0.w mul r0.w, r0.w, -c2.x mul r0.yz, r0.w, r0 mul r2, r0.z, c15 // Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py: // shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\1341BDFB.txt add r9.w, r0.w, -r9.y mad r0.y, -r9.w, r9.x, r0.y mad r2, c14, r0.y, r2 mad r2, c16, r0.w, r2 add r2, r2, c17 rcp r0.y, r2.w mul r0.zw, r0.y, r2.xyxy min r3.z, r2.z, c3.z mad r1.xz, r8.xyyw, r0.x, c3.y mul r1.xz, r1, c0.xyyw mul r1.xz, r1, c3.w texld r4, r1.xzzw, s2 mad_pp r4, r4.yxyx, c5.x, c5.y mul_pp r5, r4.wzwz, c5.zyzy mad r6, r5.zwzw, c18.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c18.yyww, r6 mul r3.xyw, r6.xyzx, c3.yyzx texldl_pp r7, r3, s1 mul r3.xyw, r6.zwzx, c3.yyzx texldl r6, r3, s1 add_pp r0.x, r6.x, r7.x mad r6, r5.zwzw, c19.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c19.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r6, r5.zwzw, c20.xxzz, r0.zwzw mad_pp r6, r4.zwzw, c20.yyww, r6 mov_pp r3.xy, r6 texldl r7, r3, s1 add_pp r0.x, r0.x, r7.x mov_pp r3.xy, r6.zwzw texldl r6, r3, s1 add_pp r0.x, r0.x, r6.x mad r5, r5, c21.xxzz, r0.zwzw mad_pp r4, r4, c21.yyww, r5 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mul_pp r0.z, r0.x, c5.w add r0.w, -r0.x, c4.x add r0.x, r0.x, c4.y cmp r0.x, r0.x, c3.x, c3.y cmp r0.x, r0.w, c3.x, r0.x if_ne r0.x, -r0.x mad_pp r4, r2.xyxy, r0.y, c8 mov_pp r3.xy, r4 texldl_pp r5, r3, s1 mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r4.x, r5.x mad_pp r4, r2.xyxy, r0.y, c9 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c10 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c11 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r4, r2.xyxy, r0.y, c12 mov_pp r3.xy, r4 texldl r5, r3, s1 add_pp r0.x, r0.x, r5.x mov_pp r3.xy, r4.zwzw texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mad_pp r2, r2.xyxy, r0.y, c13 mov_pp r3.xy, r2 texldl r4, r3, s1 add_pp r0.x, r0.x, r4.x mov_pp r3.xy, r2.zwzw texldl r2, r3, s1 add_pp r0.x, r0.x, r2.x mad r0.x, r0.x, c4.z, -r0.z mad_pp r0.z, r0.x, c4.w, r0.z endif mul_pp r0.x, r0.z, r0.z mul_pp r0.x, r0.z, r0.x mad r0.x, r0.x, r0.x, -c3.y mad_pp r0.x, c22.x, r0.x, r1.y rsq_pp r0.x, r0.x rcp_pp oC0, r0.x // approximately 134 instruction slots used (43 texture, 91 arithmetic) [/code] Any idea why it worked for PS 952E819A but not for PS 1341BDFB? Both look very similar to me. And disabling PS 1341BDFB removed the broken shadows so I think that I hunted the right shader...
@hudfreegamer: I guess You have to enter the path for python.exe, the path for shadertool.py, different arguments (like --install --auto-fix-unreal-shadows etc., see --help) and the path where the pixel shaders are stored (I had to enter the complete path to get the tool to work e.g. C:\test\ShaderOverride\PixelShaders\*). So it should look like this:
c:\Python34\python.exe c:\shaderfix\shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\*

@4everAwake,DarkStarSword: Thanks to Your hints PS 952E819A is fixed now (using the tool or doing it manually). Now I have stumbled across another PS which is responsible for dynamic shadows in a sunset scenario. It is very similar to PS 952E819A but in this case using the tool didn't fix the shader.
This is the original code for PS 1341BDFB:
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float2 InvRandomAngleTextureSize;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// sampler2D ShadowDepthTexture;
// float ShadowFadeFraction;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ShadowFadeFraction c22 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
def c5, 2, -1, 1, 0.125
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2
rcp r0.x, v0.w
mul r0.yz, r0.x, v0.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15
mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r0.y, r2.w
mul r0.zw, r0.y, r2.xyxy
min r3.z, r2.z, c3.z
mad r1.xz, v0.xyyw, r0.x, c3.y
mul r1.xz, r1, c0.xyyw
mul r1.xz, r1, c3.w
texld r4, r1.xzzw, s2
mad_pp r4, r4.yxyx, c5.x, c5.y
mul_pp r5, r4.wzwz, c5.zyzy
mad r6, r5.zwzw, c18.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r0.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r0.z, r0.x, c5.w
add r0.w, -r0.x, c4.x
add r0.x, r0.x, c4.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r0.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r0.y, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r0.y, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r0.y, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c4.z, -r0.z
mad_pp r0.z, r0.x, c4.w, r0.z
endif
mul_pp r0.x, r0.z, r0.z
mul_pp r0.x, r0.z, r0.x
mad r0.x, r0.x, r0.x, -c3.y
mad_pp r0.x, c22.x, r0.x, r1.y
rsq_pp r0.x, r0.x
rcp_pp oC0, r0.x

// approximately 134 instruction slots used (43 texture, 91 arithmetic)

This is the fixed code by the tool (shadows still broken):
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4 EdgeSampleOffsets[4];
// float2 InvRandomAngleTextureSize;
// float4 MinZ_MaxZRatio;
// sampler2D RandomAngleTexture;
// float4 RefiningSampleOffsets[6];
// sampler2D SceneColorTexture;
// float4 ScreenPositionScaleBias;
// float4x4 ScreenToShadowMatrix;
// sampler2D ShadowDepthTexture;
// float ShadowFadeFraction;
//
//
// Registers:
//
// Name Reg Size
// ------------------------- ----- ----
// InvRandomAngleTextureSize c0 1
// ScreenPositionScaleBias c1 1
// MinZ_MaxZRatio c2 1
// RefiningSampleOffsets c8 6
// ScreenToShadowMatrix c14 4
// EdgeSampleOffsets c18 4
// ShadowFadeFraction c22 1
// SceneColorTexture s0 1
// ShadowDepthTexture s1 1
// RandomAngleTexture s2 1
//

ps_3_0
def c3, 0, 1, 0.999000013, 0.5
def c4, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
def c5, 2, -1, 1, 0.125
dcl_texcoord v0.xyw
dcl_2d s0
dcl_2d s1
dcl_2d s2

def c220, 0, 1, 0.0625, 0.5
dcl_2d s13


// Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py:
// shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\1341BDFB.txt
texldl r9, c220.z, s13
mov r8.xyw, v0
add r9.w, r8.w, -r9.y
mad r8.x, r9.w, r9.x, r8.x

rcp r0.x, r8.w
mul r0.yz, r0.x, r8.xxyw
mad r1.xy, r0.yzzw, c1, c1.wzzw
mov r1.zw, c3.x
texldl r1, r1, s0
mov r1.y, c3.y
add r0.w, r1.y, -c2.y
add r0.w, -r0.w, r1.w
rcp r0.w, r0.w
mul r0.w, r0.w, -c2.x
mul r0.yz, r0.w, r0
mul r2, r0.z, c15

// Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py:
// shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\1341BDFB.txt
add r9.w, r0.w, -r9.y
mad r0.y, -r9.w, r9.x, r0.y

mad r2, c14, r0.y, r2
mad r2, c16, r0.w, r2
add r2, r2, c17
rcp r0.y, r2.w
mul r0.zw, r0.y, r2.xyxy
min r3.z, r2.z, c3.z
mad r1.xz, r8.xyyw, r0.x, c3.y
mul r1.xz, r1, c0.xyyw
mul r1.xz, r1, c3.w
texld r4, r1.xzzw, s2
mad_pp r4, r4.yxyx, c5.x, c5.y
mul_pp r5, r4.wzwz, c5.zyzy
mad r6, r5.zwzw, c18.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c18.yyww, r6
mul r3.xyw, r6.xyzx, c3.yyzx
texldl_pp r7, r3, s1
mul r3.xyw, r6.zwzx, c3.yyzx
texldl r6, r3, s1
add_pp r0.x, r6.x, r7.x
mad r6, r5.zwzw, c19.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c19.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r6, r5.zwzw, c20.xxzz, r0.zwzw
mad_pp r6, r4.zwzw, c20.yyww, r6
mov_pp r3.xy, r6
texldl r7, r3, s1
add_pp r0.x, r0.x, r7.x
mov_pp r3.xy, r6.zwzw
texldl r6, r3, s1
add_pp r0.x, r0.x, r6.x
mad r5, r5, c21.xxzz, r0.zwzw
mad_pp r4, r4, c21.yyww, r5
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mul_pp r0.z, r0.x, c5.w
add r0.w, -r0.x, c4.x
add r0.x, r0.x, c4.y
cmp r0.x, r0.x, c3.x, c3.y
cmp r0.x, r0.w, c3.x, r0.x
if_ne r0.x, -r0.x
mad_pp r4, r2.xyxy, r0.y, c8
mov_pp r3.xy, r4
texldl_pp r5, r3, s1
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r4.x, r5.x
mad_pp r4, r2.xyxy, r0.y, c9
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c10
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c11
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r4, r2.xyxy, r0.y, c12
mov_pp r3.xy, r4
texldl r5, r3, s1
add_pp r0.x, r0.x, r5.x
mov_pp r3.xy, r4.zwzw
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mad_pp r2, r2.xyxy, r0.y, c13
mov_pp r3.xy, r2
texldl r4, r3, s1
add_pp r0.x, r0.x, r4.x
mov_pp r3.xy, r2.zwzw
texldl r2, r3, s1
add_pp r0.x, r0.x, r2.x
mad r0.x, r0.x, c4.z, -r0.z
mad_pp r0.z, r0.x, c4.w, r0.z
endif
mul_pp r0.x, r0.z, r0.z
mul_pp r0.x, r0.z, r0.x
mad r0.x, r0.x, r0.x, -c3.y
mad_pp r0.x, c22.x, r0.x, r1.y
rsq_pp r0.x, r0.x
rcp_pp oC0, r0.x

// approximately 134 instruction slots used (43 texture, 91 arithmetic)

Any idea why it worked for PS 952E819A but not for PS 1341BDFB? Both look very similar to me. And disabling PS 1341BDFB removed the broken shadows so I think that I hunted the right shader...

My original display name is 3d4dd - for some reason Nvidia changed it..?!

Posted 03/21/2015 08:39 PM   
4everAwake showed me how to toggle shaders here: [url]https://forums.geforce.com/default/topic/513190/3d-vision/how-to-fix-disable-shaders-in-games-dll-guide-and-fixes-/post/4491727/#4491727[/url]

Posted 03/22/2015 12:47 AM   
  30 / 87    
Scroll To Top