Using The Shader DebuggerWhat is the shader debugger?
The shader debugger is a feature in the RE0Proxy that enables manipulating the games pixel and vertex shaders. It allows you to step through each shader in the game disabling their effect to visually see what it effects. The shader dumper also includes the ability to dump shaders (individual shaders or all of them) as well as the ability to load modified shaders.Shader Debugger Configurations
You can find the shader debugger configurations inside of the d3dproxy.ini file under the section 'Use_ShaderFeatures'.
Here is a more in-depth explanation of each option.
[/font][/b] - A boolean that determines if the shader features of RE0Proxy are enabled or not. If set to true, this enables the other options being able to be used.debugger
- A boolean that determines if the shader debugger feature is enabled or not. If set to true, the shader debugger will be preset while playing the game. This can add additional stress to the game and cause lag/slowdowns. It is not recommended to leave this on while playing. (Only use for finding shaders, disable while you want to actually play.)dumpall
- A boolean that determines if the shader debugger should dump all shaders as they are loaded. Resident Evil 0 does not cache their shaders, so they are loaded as-needed throughout the game. In order to find certain shaders you will need to play upto the part where you want to override a shader for it to be dumped.pskeydec
- Sets the virtual key code to be used to decrease the current selected pixel shader index.pskeyinc
- Sets the virtual key code to be used to increase the current selected pixel shader index.pskeydump
- Sets the virtual key code to be used to dump the current selected pixel shader.vskeydec
- Sets the virtual key code to be used to decrease the current selected vertex shader index.vskeyinc
- Sets the virtual key code to be used to increase the current selected vertex shader index.vskeydump
- Sets the virtual key code to be used to dump the current selected vertex shader.
You can find the needed virtual key code values here:msdn.microsoft.com/en-us/library/windows/desktop/dd375731
Be sure that you convert the hex value to decimal for use with RE0Proxy.
[/ul]Shader Debugger Usage
Once you have the shader debugger configurations setup, you can begin working with the shader debugger. The first step is to make it to the part of the game where you want to effect the shaders. Keep in mind a shader can be used in other places in the game, so editing it in one scene of the game can edit it in a lot of other parts as well. Editing a shader can effect other things as well as what you originally edited it for, so edit with care!
You will see the shader debuggers information at the top-left of the screen:
This is in the format of:
PS (Pixel Shader): T(Total Shader Count)=? C(Current Selected Shader)=? H=(Current Selected Shader Hash)
VS (Vertex Shader): T(Total Shader Count)=? C(Current Selected Shader)=? H=(Current Selected Shader Hash)
With the default configurations, you can edit the selected pixel shader using numpad 1 and numpad 2.
With the default configurations, you can edit the selected vertex shader using numpad 4 and numpad 5.
Once you have found the shader you wish to dump and edit, you can use the numpad 3 button to dump a pixel shader, and numpad 4 to dump a vertex shader.
Dumped shaders will be saved to:
A folder will be made for both pixel shaders and vertex shaders. Shaders are dumped from their disassembled form. They are not the real original shader text format. So you will need to understand the HLSL shader assembly language in order to make edits to them.Overriding Shaders
Another feature with the shader features enabled is the ability to override shaders. This can be used to remove effects from the game.
After you have found and dumped a shader you wish to edit, you can find that shader within the dumped shaders folder.
Edit the shader as you see fit and save it.
Next you need to create a new folder and move that shader into it to allow the d3d9proxy to use it as an override shader. To do that, you need to make a folder structure like this:
If your edited shader is a pixel shader, place it in the pixelshaders directory within the shaderoverrides folder.
If your edited shader is a pixel shader, place it in the vertexshaders directory within the shaderoverrides folder.
Files must keep the hash in the first of the file name. This is used to determine the shader to override while the game is playing. Without this, the shader will do nothing. You can add other things to the name of the file to be able to remember what the shader is for, such as:
E86DCFA0.Removes Foggy Haze In Train.txt
As long as the hash is at the start, it should work fine.Live Editing Shaders
RE0Proxy allows you to live edit shaders so you do not need to restart the game to test edits. Once you have dumped, edited, and placed the shader you wish to use in the correct folder, simply press F12
on your keyboard to reload the override shaders. (This reloads all overrides, so this may take a moment to work on slower machines.)Example Shader Edit
When you first start the game you are placed inside of a train car. There is a faint fog/haze in the train car casted by the lighting.
This shader is done by the pixel shader with the hash of: E86DCFA0
You can edit this shader and disable it by forcing the end result pixel to be transparent. To do that we look for a defined constant register with a value of 0. In this case we have c0 which is defined as:
def c0, 0.00392156886, 0, 0, 0
At the end of this shader, before the last comment, we can add the following to set the pixel result to transparent:
mov oC0.xyzw, c0.wwww
Now when this shader is loaded as an override it will cause the pixel to be transparent.Tips, Tricks, Tools to Use
RE0Proxy offers some debug output while using the shader debugger. This output is done using the system-wide debug message protocol.
You can view these messages using a tool called DebugView. You can download DbgView here:technet.microsoft.com/en-us/sysinternals/debugview.aspx
To edit shaders, I recommend that you use Notepad++ which you can download here:notepad-plus-plus.org/
Please note while editing shaders, there is a null character at the end of the file. This MUST be there when you use the shader as an override! Do not delete this part of the file while editing the shader! Failing to leave that byte in the file can cause it to not load.
To learn more about the HLSL shader assembly language, check out:msdn.microsoft.com/en-us/library/windows/desktop/bb219840(v=vs.85).aspxmsdn.microsoft.com/en-us/library/windows/desktop/bb219845(v=vs.85).aspxmsdn.microsoft.com/en-us/library/windows/desktop/bb172930(v=vs.85).aspxmsdn.microsoft.com/en-us/library/windows/desktop/bb147365(v=vs.85).aspx
Resident Evil 0 uses pixel shader version 3.0 and vertex shader version 3.0. However you can use other versions as well. The game will work with them.