Dolphin, the GameCube and Wii emulator - Forums

Full Version: Shader fixing/disabling for 2D and 3D thread, using 3Dmigoto
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
(10-04-2015, 07:25 PM)sckyless Wrote: [ -> ]Does this work with OpenGL or just D3D? Just asking because of the D3D files, but no OpenGL dll that I saw.

Just D3D (preferably if you have 3D Vision, as many of the modifications I released only work with it. Exceptions are Zelda OOT and Zelda FSA, for example). And the shader modifications I made are specifically for the DX11 backend of the Ishiiruka builds. However, the latest Ishiiruka build (436) made many shaders' CRC change, so many of the things I did are mostly useless in the newest Ishiiruka build. I don't know if I'll have the patience to redo it all again. They are still working with builds equal or older than Ishiiruka 427.

Maybe it would be better to modify Action Replay codes for many aspect ratios, and then just correct the HUD elements with shader modifications. It would be easier to redo instead of correcting every 3D geometry shader every time.

Some games would still need the old way, like Zelda FSA or Baten Kaitos, because of the 2D backgrounds.
Hello, thanks for this exciting work.

When I load Mario Sunshine, although in 3D, the heat shimmer is still not disabled (I also get some shadowing around mario on the select file screen, almost as if the 3D vision frequency of the monitor and glasses are not synchronised properly).

I have tried Ishiiruka build 391 and 422, I have enabled per pixel lighting, copied your files into the installation folder, and copied the txt files into the ShaderFixes folder. I am using a 3Dvision monitor and D3D11. Does anyone have any further tips?
(01-25-2016, 07:58 AM)fray_bentos Wrote: [ -> ]I have tried Ishiiruka build 391 and 422, I have enabled per pixel lighting, copied your files into the installation folder, and copied the txt files into the ShaderFixes folder. I am using a 3Dvision monitor and D3D11. Does anyone have any further tips?

For that game, which only has one shader to disable (unless you also want to disable water refraction, which is one or two more shaders), my advise is that it's better if you do it yourself. There's even the possibility that the shaders Dolphin generates are different for every user. Once ubershaders are available, I guess universal fixes will have more chances of working for everyone.

I'm going to tell you how to disable the shaders (preferably pixel shaders) you want (I just did it in a pair of minutes):

1- Download the latest 3Dmigoto release from here: https://github.com/bo3b/3Dmigoto/releases (1.2.27 at this moment). Fortunately, shader hunting is now possible even if you don't have 3D Vision.
2- Extract the files that you will find in the "x64" folder in the root of the Dolphin build you are using (use the newest build or whatever build you want).
3- Load the game and be using the D3D video backend. You will see a green overlay with text and numbers. That means that the shader hunting mode is enabled ("hunting=1" in the "d3dx.ini" file).
4- You will basically navigate through two types of shaders: pixel shaders and vertex shaders. Navigating through them will disable them, so keep going until you see the heatwave disappear. Controls are these (except the F1-F12 keys, everything is in the numpad):
    - 1 and 2 are previous and next pixel shader. 3 dumps the current pixel shader. You will find it in the "ShaderFixes" folder that will be automatically created.
    - 4 and 5 are previous and next vertex shader. 6 dumps the current vertex shader. You will find it in the "ShaderFixes" folder that will be automatically created.
    - 7 to 9 is for the same as the others but for geometry shaders. You won't need to use them.
    - 0 disables/enables the hunting overlay. It will also disable/enable the real time navigation of shaders, so you can toggle this for an on/off effect of the shader you're viewing.
    - The plus key ("+") reloads the list of shaders in use. It's a good idea to press this periodically, so that unneeded shaders don't make the list bigger.
    - F10 reloads the shaders that are in the ShaderFixes folder, so you can edit them and see the changes without closing and opening Dolphin.
    - Holding F9 disables the effect of the shaders in the ShaderFixes folder. However, this is also a Dolphin hotkey (screenshots, I think).
5- If the shader was dumped correctly, you will hear a "beep" (not the "boop" that sounds when something went wrong). Open the file that appeared in the ShaderFixes folder. If it's a pixel shader (this is recommended for just disabling, and I have just tried it with Super Mario Sunshine), it will be called something like "340e1f25f93a9aad-ps_replace.txt".
6- Look for the words "void main( - multiple lines of text -)". Immediately after the following "{" character, or at least before any "r0=" of similars, insert the line "discard;" (without the quotes, and with semicolon).
7- Save the changes, go back to the game, press "+" (in case you were still viewing the shader) and press F10. The shader should be disabled (and you will hear another "beep").
8- Repeat for any other shaders you want to disable.
9- After you are done, close Dolphin, open the "d3dx.ini" file and search for the line "hunting=1". Change it to "hunting=0". Now the overlay won't appear ingame (it won't use lots of extra RAM and VRAM, compared to when you were hunting) and the effects will be disabled.
10- Remember that other games may use those same shaders. When you are not playing that game, rename the ShaderFixes folder, for example.


It looks like a long explanation, but once you get used to it, you will be doing it in like a minute. For vertex shaders, the changes you have to make are different. You will have to look for the o0, o1, o2, etc variables and put them to "o0=0;", "o1=0;", etc. And this may not have the same effect as navigating through the shader.
Very many thanks for the detailed explanation (and rapid response!); I will give it a shot for Mario Sunshine. The slightly sad thing might be what you note below, meaning that it might not be possible for other users out there to enjoy all your hard work across numerous games!

(01-26-2016, 04:45 AM)masterotaku Wrote: [ -> ]There's even the possibility that the shaders Dolphin generates are different for every user.

Another thought, I am using the NTSC version of Mario Sunshine, are your shader definitions for the PAL version (hence explaining why said shaders are not disabled)?
(01-26-2016, 05:01 AM)fray_bentos Wrote: [ -> ]Very many thanks for the detailed explanation (and rapid response!);

You're welcome!

(01-26-2016, 05:01 AM)fray_bentos Wrote: [ -> ]Another thought, I am using the NTSC version of Mario Sunshine, are your shader definitions for the PAL version (hence explaining why said shaders are not disabled)?

PAL or NTSC may use shaders of different names. In the case of the shaders I uploaded for Super Mario Sunshine, I don't remember the region :p. Probably NTSC but I'm not sure. But it maybe you needed different shaders, or the exact Dolphin build I was using... I don't know.
How would I go about setting the shaders to disable and re-enable when pressing a hotkey? I'm trying to disable the HUD in a game and can get the the HUD to go away but can't figure out how to toggle it on and off.
(01-31-2016, 01:27 AM)ThisIsMyDogKyle Wrote: [ -> ]How would I go about setting the shaders to disable and re-enable when pressing a hotkey? I'm trying to disable the HUD in a game and can get the the HUD to go away but can't figure out how to toggle it on and off.

You should be able to use this (quoting from above) "- Holding F9 disables the effect of the shaders in the ShaderFixes folder." However, it does also take a Dolphin screenshot at the same time.

Update: I have now used Migoto to disable heat blur, water reflections and the grey 4:3 shaded overlay in Mario Sunshine; a big improvement when playing playing with 3D vision + Swiss widescreen hack. I have a feeling that I am going to use Migoto to tweak a lot of games for Dolphin and beyond in the future. It took a bit of getting used to but I did it (realising that only the *number pad* keys worked to scroll through shaders with Migoto was the first hurdle that took me while to work out!), Next up I am going to try and change the depth (or failing that, disable) the screen-depth recticle in Starfox Assault.

Qaazavaca Qaanic

Isn't shader disabling (and postprocessing effects, 3D, etc.) better suited as a Dolphin function, than relying on third-party tools?

Dolphin code is native (can be ported to any OS and backend), and doesn't rely on third-party hooking, heuristics, and detection. It operates directly on GC/Wii GPU shaders, instead of compiled shaders, and (I assume) can be made to not break with version changes. Also, Dolphin knows which game is running, so can block specific shaders only when a particular game is running.
(01-31-2016, 06:07 AM)jimbo1qaz Wrote: [ -> ]Isn't shader disabling (and postprocessing effects, 3D, etc.) better suited as a Dolphin function, than relying on third-party tools?

Dolphin code is native (can be ported to any OS and backend), and doesn't rely on third-party hooking, heuristics, and detection. It operates directly on GC/Wii GPU shaders, instead of compiled shaders, and (I assume) can be made to not break with version changes. Also, Dolphin knows which game is running, so can block specific shaders only when a particular game is running.

Absolutely, but as yet, there is not an option to disable shaders in Dolphin natively (incoming feature?).
(01-31-2016, 04:59 AM)fray_bentos Wrote: [ -> ]You should be able to use this (quoting from above) "- Holding F9 disables the effect of the shaders in the ShaderFixes folder." However, it does also take a Dolphin screenshot at the same time.

You can change both the Dolphin and 3Dmigoto hotkeys if you want. In the "d3dx.ini" file, search the line "show_original=VK_F9" and change it to something else. But that F9 hotkey in 3Dmigoto only works when hunting mode is enabled. For proper ingame hotkeys, you need to enable a constant in the "[Constants]" section. For example, "x=0". After that zone, you will see commented examples called "[Key1]", "[Key2]", etc. The code you would need is this, for example (for the k key):

Code:
[Key1]
Key = k
type = toggle
x = 1

You can also set the type to hold or cycle (you can see examples in the file). Now comes the hard part. You need to edit the shaders which you need the hotkey to affect. If you are using "discard;" in a pixel shader, you can do something like this in it:

Code:
float4 iniparams = IniParams.Load(0);
if (iniparams.x==1)
{
 discard;
}

That way the shader will be disabled when the "k" key toggles the value of "x" to "1".

(01-31-2016, 04:59 AM)fray_bentos Wrote: [ -> ]Next up I am going to try and change the depth

You will have lots of problems there. 3Dmigoto can't use the depth and convergence variables with the 3D Vision mode of Dolphin (and you will see that the 3D Vision hotkeys to alter depth and convergence don't work). And if you disable 3D Vision in Dolphin and rely on the automatic 3D Vision, there is a visual glitch that makes the games unplayable (the ground near the camera is at more depth depending on the camera angle. A weird issue), although you would be able to fix water reflections and other things. See my last post here with screenshots: https://forums.dolphin-emu.org/Thread-a-second-perspective-an-in-depth-history-of-stereoscopy-in-dolphin?page=4

By the way, I don't know if you know that disabling 3D Vision in the Dolphin profile in Nvidia Inspector makes performance a lot better. Without doing it, 3D increases GPU load by 4 instead of by 2 (approximately) because it's like 3D is enabled twice. Use this as a guide (the "Undefined" section. You will need to set some values to 0):

[Image: Pj4GiW.png]

jimbo1qaz Wrote:Isn't shader disabling (and postprocessing effects, 3D, etc.) better suited as a Dolphin function, than relying on third-party tools?

Yes, it would be ideal. Having cheat codes would be better than external shader mods, like the one to disable bloom in Zelda TP. But sadly, I don't have the knowlegde to create codes of that kind, and even less to implement shader modification features in Dolphin.

I just hope the 3D migoto devs and Dolphin devs can get in touch to at least somehow integrate 3Dmigoto with Dolphin, making the shader modifications be per game and being able to use the depth and convergence values.
Pages: 1 2 3 4 5