How to fix/disable shaders in games(DLL,guide and fixes).
160 / 167
[quote="lumpeh"]So i'm playing round with the debug and Killing Floor (UE 2.5 i think). Its dumping all the shaders and its code, but in game cycling through the shaders shows no changes. I've tried with and without UseRenderedShaders but nothing ever gets shut off. Any tips on what i could try?[/quote]Try changing OverrideMethod to 0, 1, or 2. That can sometimes help in situations like this.
If dumpall is working, but shader hunting is not, you can conceivably still find your shader using Tsaebeht's Binary Search Engine. Not sure of current state.
lumpeh said:So i'm playing round with the debug and Killing Floor (UE 2.5 i think). Its dumping all the shaders and its code, but in game cycling through the shaders shows no changes. I've tried with and without UseRenderedShaders but nothing ever gets shut off. Any tips on what i could try?
Try changing OverrideMethod to 0, 1, or 2. That can sometimes help in situations like this.
If dumpall is working, but shader hunting is not, you can conceivably still find your shader using Tsaebeht's Binary Search Engine. Not sure of current state.
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
[quote="bo3b"][quote="4everAwake"]How do I go about applying a convergence lock (for a fix)? I did a search and I heard mention that it could be done. But I was unable to find any further details regarding this. Do I just assign a really common texture to a preset index?[/quote]I'm not sure this has been documented anywhere.
The one game I know this works in Last Remnant: http://helixmod.blogspot.com/2013/09/the-last-remnant-new-version-update-0620.html
Take a look at that fix to see if that is what you need. If not, ping eqzitara by email, because I know he figured out how to do this.[/quote]
Thanks for that bo3b. I think that's how it's done- apply a preset index to a texture that's always on screen, like a HUD element. Also I know there are a few profiles that have convergence locks. Off of the top of my head, Crysis profile & Google Earth profile has one.
4everAwake said:How do I go about applying a convergence lock (for a fix)? I did a search and I heard mention that it could be done. But I was unable to find any further details regarding this. Do I just assign a really common texture to a preset index?
Take a look at that fix to see if that is what you need. If not, ping eqzitara by email, because I know he figured out how to do this.
Thanks for that bo3b. I think that's how it's done- apply a preset index to a texture that's always on screen, like a HUD element. Also I know there are a few profiles that have convergence locks. Off of the top of my head, Crysis profile & Google Earth profile has one.
[quote="bo3b"][quote="lumpeh"]So i'm playing round with the debug and Killing Floor (UE 2.5 i think). Its dumping all the shaders and its code, but in game cycling through the shaders shows no changes. I've tried with and without UseRenderedShaders but nothing ever gets shut off. Any tips on what i could try?[/quote]Try changing OverrideMethod to 0, 1, or 2. That can sometimes help in situations like this.
If dumpall is working, but shader hunting is not, you can conceivably still find your shader using Tsaebeht's Binary Search Engine. Not sure of current state.[/quote]
No such luck with OverrideMethod :( one thing i've noticed is that i get 102 vertex and 102 pixel shaders alldumped, but in game it only cycles through 50 of each even with UseRenderedShaders off. I shall check out Tsaebeht's utility.
*edit*
seems his dropbox mirror to the file is dead these days. Might be worth mirroring it on the helix blog ? [i]with[/i] Tsaebeht's permission of course! ;)
lumpeh said:So i'm playing round with the debug and Killing Floor (UE 2.5 i think). Its dumping all the shaders and its code, but in game cycling through the shaders shows no changes. I've tried with and without UseRenderedShaders but nothing ever gets shut off. Any tips on what i could try?
Try changing OverrideMethod to 0, 1, or 2. That can sometimes help in situations like this.
If dumpall is working, but shader hunting is not, you can conceivably still find your shader using Tsaebeht's Binary Search Engine. Not sure of current state.
No such luck with OverrideMethod :( one thing i've noticed is that i get 102 vertex and 102 pixel shaders alldumped, but in game it only cycles through 50 of each even with UseRenderedShaders off. I shall check out Tsaebeht's utility.
*edit*
seems his dropbox mirror to the file is dead these days. Might be worth mirroring it on the helix blog ? with Tsaebeht's permission of course! ;)
I tried the latest HelixMod with Killing Floor, and I get partial results. The shader hunting is partly working, in that I can see shaders go on and off, but it doesn't seem to hit every shader in the scene. But I'd also note that the game is pretty good by default in 3D. I didn't see much that needed fixing, what are you running across?
This might be one of those games that interacts badly with HelixMod.
You could try changing the settings to different levels, because that will typically use different shaders, but outside of that I'm not sure what to suggest.
I tried the latest HelixMod with Killing Floor, and I get partial results. The shader hunting is partly working, in that I can see shaders go on and off, but it doesn't seem to hit every shader in the scene. But I'd also note that the game is pretty good by default in 3D. I didn't see much that needed fixing, what are you running across?
This might be one of those games that interacts badly with HelixMod.
You could try changing the settings to different levels, because that will typically use different shaders, but outside of that I'm not sure what to suggest.
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
I was using a test level from the Workshop so i could meddle unmolested by Zeds. In order of beginner to complex;
(1)Add custom convergence presets bound to keys/set one for aimming (i could get this one done pretty quickly from what i've looked at)
(2)Fix skyboxes on some of the official maps. (not too bad on the whole but would be nice)
(3)Stereoize the Hud - Separate textures and make player tags comfortable and if necessary get rid of health tags for the commando class.
The last one is the most uncomfortable i think. I have come across and bound a console command to disable the entire HUD at will, but it means you lose the damage indicators which is awkward when a Clot sneaks up on you. If HelixMod can't do it, never mind. Hopefully KF2 will do better as its UE3.0 based i believe :)
I was using a test level from the Workshop so i could meddle unmolested by Zeds. In order of beginner to complex;
(1)Add custom convergence presets bound to keys/set one for aimming (i could get this one done pretty quickly from what i've looked at)
(2)Fix skyboxes on some of the official maps. (not too bad on the whole but would be nice)
(3)Stereoize the Hud - Separate textures and make player tags comfortable and if necessary get rid of health tags for the commando class.
The last one is the most uncomfortable i think. I have come across and bound a console command to disable the entire HUD at will, but it means you lose the damage indicators which is awkward when a Clot sneaks up on you. If HelixMod can't do it, never mind. Hopefully KF2 will do better as its UE3.0 based i believe :)
Sounds good.
You should be able to do 1, even with no shader hunting as it's independent of that.
You can very likely do 2, as long as you can find the skybox shader. Skybox fixes are generally pretty easy.
3 is hard and not likely if cannot find the tag or HUD shader. If you can find them, then pushing them deeper is pretty easy, as well as texture separation. Putting them to the 'proper' depth, attached to a character is generally quite hard, but just pushing them deeper (like 40% max depth) is very easy.
You should be able to do 1, even with no shader hunting as it's independent of that.
You can very likely do 2, as long as you can find the skybox shader. Skybox fixes are generally pretty easy.
3 is hard and not likely if cannot find the tag or HUD shader. If you can find them, then pushing them deeper is pretty easy, as well as texture separation. Putting them to the 'proper' depth, attached to a character is generally quite hard, but just pushing them deeper (like 40% max depth) is very easy.
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
I think short of an actual mod with a custom UTX pack for the hud, its kinda stuck. It wouldn't be client-side either. On the plus side i've found replacing an Aliase bind in the user.ini with;[code]Aliases[36]=(Command="showhud | IronSightZoomIn | onrelease IronSightZoomOut | onrelease showhud",Alias="Aiming")[/code] will get rid of it as long as you keep looking down the sights. Theres also a 'light hud' option and you can turn down the hud to 50% opaque. I've tried several official maps and no shader hunting success. Going to look at the convergence binds next! Won't be much of a 'real' fix though :(
I think short of an actual mod with a custom UTX pack for the hud, its kinda stuck. It wouldn't be client-side either. On the plus side i've found replacing an Aliase bind in the user.ini with;
will get rid of it as long as you keep looking down the sights. Theres also a 'light hud' option and you can turn down the hud to 50% opaque. I've tried several official maps and no shader hunting success. Going to look at the convergence binds next! Won't be much of a 'real' fix though :(
Does anyone have any advice on how to go about fixing broken ray-marched volumetric light effects?
I've been playing around with the shaders involved for one of these in Dreamfall for a couple of hours with limited success - I can do the easy fix for the texcoord outputs from the vertex shaders easily enough (at least - the two that are used when the camera is outside the volume), but I'm still left with a halo in the left eye. If the camera is inside the volume I also get a left-eye only halo (from inside it's rendered as a full screen quad, so the VS doesn't use the MVP).
From a distance the entire volume moves off to the side in the left eye as well, which would seem to be related.
I've been playing around with adjustments inside the pixel shaders that only apply when StereoParams.z == -1 (left eye), and so far I've managed to distort the halo in weird and wonderful ways, but I don't really feel like I'm getting closer to a solution...
I've stuck all the shaders that play a role in this effect under here, with headers re-attached from the unity assets files:
http://darkstarsword.net/dreamfall-broken-shaders/LightShafts/
(The various pixel shaders in Final Interpolation are used from different camera angles around and within the volume, probably related to the direction of light, and the three folders seem to be different layers/passes).
The particular effect is not far into the game - it's at the end of the dark tunnel for the second dreamer that needs help - talk to the dreamer and turn on at least one of the street lights for it to appear (it becomes brighter once the second light is on).
EDIT: Updated URL
Does anyone have any advice on how to go about fixing broken ray-marched volumetric light effects?
I've been playing around with the shaders involved for one of these in Dreamfall for a couple of hours with limited success - I can do the easy fix for the texcoord outputs from the vertex shaders easily enough (at least - the two that are used when the camera is outside the volume), but I'm still left with a halo in the left eye. If the camera is inside the volume I also get a left-eye only halo (from inside it's rendered as a full screen quad, so the VS doesn't use the MVP).
From a distance the entire volume moves off to the side in the left eye as well, which would seem to be related.
I've been playing around with adjustments inside the pixel shaders that only apply when StereoParams.z == -1 (left eye), and so far I've managed to distort the halo in weird and wonderful ways, but I don't really feel like I'm getting closer to a solution...
(The various pixel shaders in Final Interpolation are used from different camera angles around and within the volume, probably related to the direction of light, and the three folders seem to be different layers/passes).
The particular effect is not far into the game - it's at the end of the dark tunnel for the second dreamer that needs help - talk to the dreamer and turn on at least one of the street lights for it to appear (it becomes brighter once the second light is on).
EDIT: Updated URL
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
I did some searching and I'm pretty sure this is the broken effect they are using, which is public domain with the source code available - now to study how this effect works:
https://github.com/robertcupisz/LightShafts
I did some searching and I'm pretty sure this is the broken effect they are using, which is public domain with the source code available - now to study how this effect works:
https://github.com/robertcupisz/LightShafts
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
Great find! Great approach! Going at the fix from the top down is a whole new avenue.
Taking a quick look at the github code, his code already supports multiple cameras, and was added as a way to support Oculus Rift. You could conceivably use the same mechanism for a 3D fix.
Check his commit here: [url]https://github.com/robertcupisz/LightShafts/commit/d61c849f3f45641287f6811277fde24366757a7d[/url]
He modifies it from the m_MainCamera to a more general m_CurrentCamera.
I can't correlate your ASM code back to the shader you reference there, but it's always possible that DreamFall picked up an older version before he made it multi-camera aware.
If you think the shader API itself is the same, same input/output, you can conceivably just drop in the latest version and have it compiled on the fly. The HelixMod supports both ASM and HLSL compilation, with the flag UseAsm=false/true. If you set it to false, it in theory will compile HLSL. I don't believe anyone has ever done this before, so it might be interesting to try.
Great find! Great approach! Going at the fix from the top down is a whole new avenue.
Taking a quick look at the github code, his code already supports multiple cameras, and was added as a way to support Oculus Rift. You could conceivably use the same mechanism for a 3D fix.
He modifies it from the m_MainCamera to a more general m_CurrentCamera.
I can't correlate your ASM code back to the shader you reference there, but it's always possible that DreamFall picked up an older version before he made it multi-camera aware.
If you think the shader API itself is the same, same input/output, you can conceivably just drop in the latest version and have it compiled on the fly. The HelixMod supports both ASM and HLSL compilation, with the flag UseAsm=false/true. If you set it to false, it in theory will compile HLSL. I don't believe anyone has ever done this before, so it might be interesting to try.
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
I don't think the support for the second camera really helps us unless Dreamfall starts using the Unity plugin to use two cameras for 3D Vision (and the fact that the first comment on that plugin is "this doesn't work", doesn't really inspire me with much confidence).
The commit you pointed to only alters the C# code, not the HLSL (or actually something called Cg, which is subtly different to HLSL). As for compiling it - I'm able to get the free version of Unity to do that if I remove the Hidden keyword so it shows up in the UI, and I've proved that the compiled code can replace the shaders dumped from Helix mod, so long as none of the inputs or outputs from the program change. I'm not sure if it is possible to use anything other than Unity to compile it - certainly their surface shaders need the magic inside UnityShaderCompiler.exe to handle the #pragma surface.
Additional inputs can be defined in Cg tied to specific registers that will be passed in from Helix mod. I'm actually wondering if it might be worth exploring the possibility of using the same techniques Unity modders do which might allow us to replace shaders in the .asset files and add whatever extra inputs we like...
Back to the problem at hand,
In addition to stereoising the texcoord output of the vertex shaders, I've worked out that the _LightPos input to the pixel shaders is the mono screen coordinates of the light source, so I stereoised that and suddenly all the light shafts popped into 3D - which looked great, other than the horribly distorted halo that now appears in both eyes.
I've worked out that the issue is the coordinates being read from s1 (_DepthEpi). That texture is written from the Coords.shader, which also takes _LightPos as an input. I can apply the same correction to it in that shader and the distorted halo lines up with the character again - at least in the eye that originally didn't have a halo in the first place. The rays remain 3D with this correction here as well, so I'm pretty confident that this is the right place to do it.
The problem seems to be that Coords.shader is only used for a mono render target - adding a test to conditionally disable the output based on the StereoParams.x being less or more than 0 only disabled it when StereoParams.x > 0, which would explain why I can fix the halo in the right eye only.
So, I'm trying to work out how to force it to be stereoised, but not having much luck yet. This is what I have:
[code]
// Fixes shadow placement. The fact that this worked was a surprise to me - I
// thought the driver's default was for square render targets to be mono
DefSquareSurfaceMode = 2
// Stereoize the _DepthEpi surface used for volumetric light shafts, which is
// written from the Hidden/Coord shader and read from the Hidden/Final
// Interpolation shader.
SurfaceCreationModeList = 0;
[SF0]
DefMode = 1
Format = 114
Width = 1024
Height = 1024
Usage = 1
Pool = 0
Levels = 1
[PS8415AC69]
GetSampler1FromReg = 1
[PS4C517B70]
GetSampler1FromReg = 1
[/code]
Which is based on this output from the log file, as well as decoding the DDS header in the Tex1.dds dumped out with F12:
[code]
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 0 nIndex 1, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 0 nIndex 2, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 34f1b060 shad 8415ac69
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 3, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 4, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 5, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 6, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 7, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 8, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 9, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 10, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 11, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 12, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 13, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 14, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720c0a00 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 15, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 16, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 17, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 18, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720c0a00 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 19, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 20, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
[/code]
Does that look correct?
Earlier I also tried setting DefSquareSurfaceMode = 1, which broke shadows, but didn't seem to change anything on this effect :(
Also, is there anything special that needs to happen in the texld instruction when sampling a stereoised texture? How does it know which to sample - does the driver automatically sample the one that matches the current eye being drawn?
I guess what I'm asking is how is this supposed to work?
I don't think the support for the second camera really helps us unless Dreamfall starts using the Unity plugin to use two cameras for 3D Vision (and the fact that the first comment on that plugin is "this doesn't work", doesn't really inspire me with much confidence).
The commit you pointed to only alters the C# code, not the HLSL (or actually something called Cg, which is subtly different to HLSL). As for compiling it - I'm able to get the free version of Unity to do that if I remove the Hidden keyword so it shows up in the UI, and I've proved that the compiled code can replace the shaders dumped from Helix mod, so long as none of the inputs or outputs from the program change. I'm not sure if it is possible to use anything other than Unity to compile it - certainly their surface shaders need the magic inside UnityShaderCompiler.exe to handle the #pragma surface.
Additional inputs can be defined in Cg tied to specific registers that will be passed in from Helix mod. I'm actually wondering if it might be worth exploring the possibility of using the same techniques Unity modders do which might allow us to replace shaders in the .asset files and add whatever extra inputs we like...
Back to the problem at hand,
In addition to stereoising the texcoord output of the vertex shaders, I've worked out that the _LightPos input to the pixel shaders is the mono screen coordinates of the light source, so I stereoised that and suddenly all the light shafts popped into 3D - which looked great, other than the horribly distorted halo that now appears in both eyes.
I've worked out that the issue is the coordinates being read from s1 (_DepthEpi). That texture is written from the Coords.shader, which also takes _LightPos as an input. I can apply the same correction to it in that shader and the distorted halo lines up with the character again - at least in the eye that originally didn't have a halo in the first place. The rays remain 3D with this correction here as well, so I'm pretty confident that this is the right place to do it.
The problem seems to be that Coords.shader is only used for a mono render target - adding a test to conditionally disable the output based on the StereoParams.x being less or more than 0 only disabled it when StereoParams.x > 0, which would explain why I can fix the halo in the right eye only.
So, I'm trying to work out how to force it to be stereoised, but not having much luck yet. This is what I have:
// Fixes shadow placement. The fact that this worked was a surprise to me - I
// thought the driver's default was for square render targets to be mono
DefSquareSurfaceMode = 2
// Stereoize the _DepthEpi surface used for volumetric light shafts, which is
// written from the Hidden/Coord shader and read from the Hidden/Final
// Interpolation shader.
SurfaceCreationModeList = 0;
[SF0]
DefMode = 1
Format = 114
Width = 1024
Height = 1024
Usage = 1
Pool = 0
Levels = 1
Which is based on this output from the log file, as well as decoding the DDS header in the Tex1.dds dumped out with F12:
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 0 nIndex 1, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 0 nIndex 2, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 34f1b060 shad 8415ac69
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 3, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 4, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 5, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 6, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 7, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 8, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 9, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 10, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 11, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 34f1b060 nIndex 12, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 13, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 14, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720c0a00 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 15, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 16, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 17, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720bf9c0 nIndex 18, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720c0a00 shad 4c517b70
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 19, Mode 1
D3DUSAGE_RENDERTARGET/D3DUSAGE_DEPTHSTENCIL Height 1024 Width 1024 Usage 1 Format 114 Pool 0 Levels 1 texptr 720c0a00 nIndex 20, Mode 1
GetSampler1FromReg GetTexture lpTex h 1024 w 1024 u 1 t 1 f 114 tex 720bf9c0 shad 4c517b70
Does that look correct?
Earlier I also tried setting DefSquareSurfaceMode = 1, which broke shadows, but didn't seem to change anything on this effect :(
Also, is there anything special that needs to happen in the texld instruction when sampling a stereoised texture? How does it know which to sample - does the driver automatically sample the one that matches the current eye being drawn?
I guess what I'm asking is how is this supposed to work?
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
The latest update for Sims 4 finally introduced swimming pools (hurray!). But this also brought back the issues with refraction Sims 2 and Sims 3 already had. For these games the solution was very simple as the issue was fixed by the adequate profile (Aion, later The Sims 3 profile itself). For Sims 4 these profiles also fix the water issue but in addition mess up the HUD completely and also cause issues with ambient occlusion. So I guess the only solution is to fix the water shaders. Unfortunately I have no idea how to fix refraction issues and hope that You can give me some hints.
The issue looks like this:
http://photos.3dvisionlive.com/3d4dd/image/54638154d475fef77800018f/
There is a shift between the parts above and under the water surface depending on the distance. The reflections are also messed up but can be disabled by the game settings.
I think this should be the relevant PS:
Hey guys, just wanted to post here and tell you all that you do amazing work!
What would we do without the shader tweaks? I'm enjoying my games so much more with all the patches. I hope 3D vision lives long and prosper!
I do not manage to convert V1.1 vertex shader to V3.0.
I tried to make it manually and with the shader converter tool, but I got crash with the game (RoF) with the modified shader.
Here is the original shader
If dumpall is working, but shader hunting is not, you can conceivably still find your shader using Tsaebeht's Binary Search Engine. Not sure of current state.
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
Thanks for that bo3b. I think that's how it's done- apply a preset index to a texture that's always on screen, like a HUD element. Also I know there are a few profiles that have convergence locks. Off of the top of my head, Crysis profile & Google Earth profile has one.
Dual boot Win 7 x64 & Win 10 (1809) | Geforce Drivers 417.35
My implementation of shader hunting have worked all the time. As far as can tell.
Thanks to everybody using my assembler it warms my heart.
To have a critical piece of code that everyone can enjoy!
What more can you ask for?
donations: ulfjalmbrant@hotmail.com
No such luck with OverrideMethod :( one thing i've noticed is that i get 102 vertex and 102 pixel shaders alldumped, but in game it only cycles through 50 of each even with UseRenderedShaders off. I shall check out Tsaebeht's utility.
*edit*
seems his dropbox mirror to the file is dead these days. Might be worth mirroring it on the helix blog ? with Tsaebeht's permission of course! ;)
This might be one of those games that interacts badly with HelixMod.
You could try changing the settings to different levels, because that will typically use different shaders, but outside of that I'm not sure what to suggest.
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
(1)Add custom convergence presets bound to keys/set one for aimming (i could get this one done pretty quickly from what i've looked at)
(2)Fix skyboxes on some of the official maps. (not too bad on the whole but would be nice)
(3)Stereoize the Hud - Separate textures and make player tags comfortable and if necessary get rid of health tags for the commando class.
The last one is the most uncomfortable i think. I have come across and bound a console command to disable the entire HUD at will, but it means you lose the damage indicators which is awkward when a Clot sneaks up on you. If HelixMod can't do it, never mind. Hopefully KF2 will do better as its UE3.0 based i believe :)
You should be able to do 1, even with no shader hunting as it's independent of that.
You can very likely do 2, as long as you can find the skybox shader. Skybox fixes are generally pretty easy.
3 is hard and not likely if cannot find the tag or HUD shader. If you can find them, then pushing them deeper is pretty easy, as well as texture separation. Putting them to the 'proper' depth, attached to a character is generally quite hard, but just pushing them deeper (like 40% max depth) is very easy.
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
I've been playing around with the shaders involved for one of these in Dreamfall for a couple of hours with limited success - I can do the easy fix for the texcoord outputs from the vertex shaders easily enough (at least - the two that are used when the camera is outside the volume), but I'm still left with a halo in the left eye. If the camera is inside the volume I also get a left-eye only halo (from inside it's rendered as a full screen quad, so the VS doesn't use the MVP).
From a distance the entire volume moves off to the side in the left eye as well, which would seem to be related.
I've been playing around with adjustments inside the pixel shaders that only apply when StereoParams.z == -1 (left eye), and so far I've managed to distort the halo in weird and wonderful ways, but I don't really feel like I'm getting closer to a solution...
I've stuck all the shaders that play a role in this effect under here, with headers re-attached from the unity assets files:
http://darkstarsword.net/dreamfall-broken-shaders/LightShafts/
(The various pixel shaders in Final Interpolation are used from different camera angles around and within the volume, probably related to the direction of light, and the three folders seem to be different layers/passes).
The particular effect is not far into the game - it's at the end of the dark tunnel for the second dreamer that needs help - talk to the dreamer and turn on at least one of the street lights for it to appear (it becomes brighter once the second light is on).
EDIT: Updated URL
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
https://github.com/robertcupisz/LightShafts
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
Taking a quick look at the github code, his code already supports multiple cameras, and was added as a way to support Oculus Rift. You could conceivably use the same mechanism for a 3D fix.
Check his commit here: https://github.com/robertcupisz/LightShafts/commit/d61c849f3f45641287f6811277fde24366757a7d
He modifies it from the m_MainCamera to a more general m_CurrentCamera.
I can't correlate your ASM code back to the shader you reference there, but it's always possible that DreamFall picked up an older version before he made it multi-camera aware.
If you think the shader API itself is the same, same input/output, you can conceivably just drop in the latest version and have it compiled on the fly. The HelixMod supports both ASM and HLSL compilation, with the flag UseAsm=false/true. If you set it to false, it in theory will compile HLSL. I don't believe anyone has ever done this before, so it might be interesting to try.
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
The commit you pointed to only alters the C# code, not the HLSL (or actually something called Cg, which is subtly different to HLSL). As for compiling it - I'm able to get the free version of Unity to do that if I remove the Hidden keyword so it shows up in the UI, and I've proved that the compiled code can replace the shaders dumped from Helix mod, so long as none of the inputs or outputs from the program change. I'm not sure if it is possible to use anything other than Unity to compile it - certainly their surface shaders need the magic inside UnityShaderCompiler.exe to handle the #pragma surface.
Additional inputs can be defined in Cg tied to specific registers that will be passed in from Helix mod. I'm actually wondering if it might be worth exploring the possibility of using the same techniques Unity modders do which might allow us to replace shaders in the .asset files and add whatever extra inputs we like...
Back to the problem at hand,
In addition to stereoising the texcoord output of the vertex shaders, I've worked out that the _LightPos input to the pixel shaders is the mono screen coordinates of the light source, so I stereoised that and suddenly all the light shafts popped into 3D - which looked great, other than the horribly distorted halo that now appears in both eyes.
I've worked out that the issue is the coordinates being read from s1 (_DepthEpi). That texture is written from the Coords.shader, which also takes _LightPos as an input. I can apply the same correction to it in that shader and the distorted halo lines up with the character again - at least in the eye that originally didn't have a halo in the first place. The rays remain 3D with this correction here as well, so I'm pretty confident that this is the right place to do it.
The problem seems to be that Coords.shader is only used for a mono render target - adding a test to conditionally disable the output based on the StereoParams.x being less or more than 0 only disabled it when StereoParams.x > 0, which would explain why I can fix the halo in the right eye only.
So, I'm trying to work out how to force it to be stereoised, but not having much luck yet. This is what I have:
Which is based on this output from the log file, as well as decoding the DDS header in the Tex1.dds dumped out with F12:
Does that look correct?
Earlier I also tried setting DefSquareSurfaceMode = 1, which broke shadows, but didn't seem to change anything on this effect :(
Also, is there anything special that needs to happen in the texld instruction when sampling a stereoised texture? How does it know which to sample - does the driver automatically sample the one that matches the current eye being drawn?
I guess what I'm asking is how is this supposed to work?
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
The issue looks like this:
http://photos.3dvisionlive.com/3d4dd/image/54638154d475fef77800018f/
There is a shift between the parts above and under the water surface depending on the distance. The reflections are also messed up but can be disabled by the game settings.
I think this should be the relevant PS:
This is the VS:
Any suggestions are welcome ;)
My original display name is 3d4dd - for some reason Nvidia changed it..?!
What would we do without the shader tweaks? I'm enjoying my games so much more with all the patches. I hope 3D vision lives long and prosper!
I tried to make it manually and with the shader converter tool, but I got crash with the game (RoF) with the modified shader.
Here is the original shader
and the modified shader (by converter tool)
if someone can help...