Special K includes a render toolkit that allows for various forms of investigating or manipulating rendering aspects of the game. The capabilities of the render toolkit differs between APIs, though it is the most powerful in D3D11.
This is based on the Steam guide D3D11 HUD Hunting: Introduction to Render Mods.
Special K has a D3D11 render state tracker capable of detecting when a game is rendering specific game elements. Commonly this functionality is used to disable post-processing effects that a user dislikes such as bloom, depth of field or motion blur in games that do not give the option of turning these things off.
The state tracker requires user-defined shader configuration before any of this advanced functionality applies to a game. This guide will familiarize you with the tools and concepts required to configure Special K’s render state tracker and will teach you how to toggle HUD visibility and take advantage of HUDless screenshots in any D3D11-based game.
This giant cluster of buttons may be intimidating at first, but is actually quite usable if you have a specific task in mind. The entire set of tools needed to find and remember HUD shaders is confined to the “Live Shader View” sub-tool shown below.
The best place to begin searching for HUD shaders is the list of vertex shaders because a single vertex shader will often be used for multiple post-process and screenspace render passes.
If lucky, you may identify all of the shaders a game uses to draw its HUD with only 1 or 2 vertex shaders versus 5 or 6 different pixel shaders. If unlucky your 1 or 2 vertex shaders are being used for more than drawing the HUD and you will have to narrow your search to pixel shaders (more on this later) to avoid removing more than a game’s HUD from your screenshots.
Search Space | Description |
---|---|
Vertex Shaders | Often shared between mutliple materials on the same type of object, this is a non-optional shader stage meaning anything a game draws has a vertex shader as part of its render state. Vertex shaders are highly reusable and rarely make good search candidates if you are looking to eliminate a very specific type of effect such as motion blur. |
Pixel Shaders | Often unique to post-processing passes or individual light sources. These are also required to draw anything in D3D11, but are much more likely than vertex shaders to identify a specific effect you are trying to isolate. |
Geometry Shaders | Largely a forgotten relic with few real-world applications, if you do encounter these they are usually used by some kind of effect framework middleware such as NVIDIA GameWorks and not typically an effect you would want to disable or alter. |
Domain and Hull Shaders | Part of your GPU’s tessellation engine and often used to increase the detail level on hair or terrain |
Compute Shaders | Can do a bit of everything including lock-up the graphics driver if supplied bad input data – please exercise caution when fiddling with compute shaders, the first sign something is wrong is usually the driver terminating your game because it was taking too long to do something. |
To reiterate, game HUDs are drawn using only two types of shaders (Vertex and Pixel), and you are looking for broad coverage (i.e. catch all HUD draws using the smallest set of shaders possible). Other types of searches, such as finding and eliminating FXAA demand a narrow set of matching shaders with little to no sharing between other effects.
Please refer to the table above and try to rationalize which set of shaders each of these searches should focus on prior to advancing to the next section of this guide.
At the top of each shader view, you will find a row labeled “Tracked Shader,” with several check-boxes that control the appearance of objects drawn using the currently selected shader.
When looking for HUD shaders, it is suggested that you apply “Draw in Wireframe” and “Blink” to the tracked shader state. These shaders are already drawn on top of everything else in the scene, so “Draw on Top” is useless and HUD elements are usually simple rectangles built from two triangles, so the easiest thing to look for would be blinking triangle wireframes.
To navigate the shader list quicker, use the ] and [ keys while hovering the list with your mouse cursor. When you come across part of the HUD that was previously solid begin blinking in wireframe, you have found a HUD shader and should mark it as such using “Shader Belongs to HUD”.
If all went well, the HUD (and nothing else) will show / hide itself each time you toggle the HUD. If more than the HUD disappears you will have to go back and find the shader responsible using the process described above.
Sometimes you will exhaust the entire list of vertex shaders and still not have a completely functional HUD toggle, or your first search produces a list of over-utilized and under-specialized vertex shaders shared among multiple unrelated render tasks. If this happens to you, then continue your search using a different search pool (i.e. search the pixel shader list).
Pro Tip:
Geometry, Domain, Hull and Compute Shaders are never used for HUD rendering; ignore them.
When you have successfully identified all HUD shaders, you need to save your work by clicking the “Store Shader State” button. This assigns a “HUD” property to the shaders you identified in a file called “d3d11_shaders.ini,” later tutorials will cover that file in more detail.
Finished HUD Identification for GreedFall
[DrawState.Vertex] 67ce30e8=HUD c672a35c=HUD [DrawState.Pixel] 14d0a5bd=HUD
As discussed earlier, there are a few HUD-related draws that can only be identified by the active pixel shader. Technically these draws do use a specific vertex shader, but that vertex shader is shared with other non-HUD tasks and that makes the vertex shader unsuitable to identify render tasks.
This scenario, where a shader is used in multiple unrelated render tasks, is the reason you may need to go back and remove the “Belongs to HUD” property from certain shaders after testing Special K’s HUD toggle.
If you identify a vertex shader that is used for more than HUD rendering, chances are you will only be able to catch those HUD draws in isolation by searching through pixel shaders. This is precisely what happened in GreedFall, with a vertex shader (aacc3228) used for color correction post-processing and HUD rendering. Distinguishing the color correction post-process and HUD render passes can only be done by looking at the different pixel shaders for these render passes; pixel shader 14d0a5bd is the distinguishing HUD shader in this case.