In order to edit this wiki, you must register and verify your account.

Graphic packs creation

From Cemu Wiki
Jump to:navigation Jump to:search

graphic packs behave like graphic mods. Anyone can make one (assuming they have the necessary know-how) and users can download and install them. In the options of Cemu individual graphic packs can then be enabled or disabled. Additionally, multiple graphic packs can be active for the same game as long as they don't interfere with each other. You can mix and match according to your own personal preference. By default, Cemu will come with a bunch of graphic packs already pre-installed. We tried to cover as many popular requests as possible, but ultimately the idea behind graphic packs is that they are created and maintained by the community.

What graphic packs can potentially do:

  • Change the game's internal resolution
  • Increase the resolution and quality of shadows
  • Modify or remove post-processing effects
  • Workarounds for graphic bugs until we find a proper solution
  • Change lighting related aspects of the game
  • Add or change any visual aspect of the already existing materials
  • Custom Anti-Aliasing

From a technical standpoint, graphic packs allow the following:

  • Overwrite certain texture properties (like the resolution)
  • Overwrite shaders (very powerful since everything uses shaders)
  • Not yet supported but planned for the future: Custom textures and some more complex control over drawcalls

However, there are some limitations as well. Graphic packs intercept at the rendering level, so they can't alter the logic of the game. For example, using just graphic packs it's not possible to upgrade a 30FPS game to 60FPS.

Create a graphic pack

A graphic pack is a folder with the the name of the game, without spaces and at the end the resolution. For example:NameOfGame_1080p

Resolutions are for example:

  • 360p
  • 540p
  • 720p
  • 1080p
  • 2160p
  • 2880p
  • 4320p
  • 5760p

In this folder are the txt file rules.txt. Click here to learn how to install a graphic pack

rules.txt

rules.txt contains information about the graphic pack, the games it is applied to and one or multiple rules that can modify texture properties. Everything after a # character is considered a comment.

Note: While not necessary, knowledge about engines, rendering concepts, graphic effects etc. is helpful when trying to create your own graphic packs.

Here is a example of a rules.txt

[Definition]
titleIds = 000500001010ec00,0005000e1010ed00,0005000e1010eb00
name = "Mario Kart 8 - 2160p (4K)"

[TextureRedefine]
width = 1280
height = 720
formatsExcluded = 0x41A # exclude the intro background texture
overwriteWidth = 3840
overwriteHeight = 2160

There are the two Section [Definition] and [TextureRedefine] and under this section are some variables that can be changed

Section: [Definition]

Variables in the section [Definition]
variable description
titleIds
List of one or multiple titleIds (unique game indentifier) which are used to determine for which games this pack is active.
name
Name which appears in Cemu's "Graphic packs" window. We recommend a "gamename - effect" style naming scheme. E.g. "Mario Kart 8 - 1080p resolution".

Section: [TextureRedefine]

After the [Definition] section one or multiple texture rules can follow. Currently there is only one type of rule supported, called 'TextureRedefine'. Below is a description of what it does and how it works.

This rule type can be used to overwrite certain texture properties, like the resolution or format. There are two parts to each 'TextureRedefine' rule:
The filter settings. The rule will only apply to textures when the original texture properties match the values given by the filter settings. The overwrite settings. If a texture matches the filter, these properties are applied. The idea is that via these rules you can tell Cemu which textures to modify and how to modify them.

Note that texture rules are applied upon creation of the texture. Multiple rules can apply to the same textures as long as they don't interfere with each other (e.g. one rule to set the width/height and another rule to set the format)

Filter settings

Variable: width
Variable: height
Variable: formats

Texture format must match any of these ('0x' prefix denotes hexadecimal format, can contain multiple formats separated by comma)

Variable: formatsExcluded

If any of the filter settings above are omitted they are not evaluated. This allows you to write a rule that, for example, only filters for the width of a texture but not the height.

Variable: overwriteWidth

Like filter settings you can omit individual overwrite settings. This allows to selectively overwrite the width but not the height etc.

Variable: overwriteHeight

Like filter settings you can omit individual overwrite settings. This allows to selectively overwrite the width but not the height etc.

Common use case example:

Many games run in 1280x720 resolution and we would like to use a textureRule to upscale those games to 1920x1080.
Here is how it would look:

[TextureRedefine]
width = 1280
height = 720
overwriteWidth = 1920
overwriteHeight = 1080 

This rule applies to all textures that have a resolution of 1280x720 and overwrites their resolution to be 1920x1080. Depending on the game, this might suffice for simple upscaling. However, since the filter settings in this example are very loose (only width and height is checked) the rule might catch unwanted textures. Some games use background or splash screen textures that have the same resolution as the intended screen resolution. Since Cemu resets the contents of a texture if any rule is applied, you would end up with a black background. A workaround for this is to use the texture dump feature of Cemu and figure out more exact filters.

Shader replacement

Wii U's GPU supports a fully programmable pipeline. Meaning each drawcall is associated with a vertex and pixel shader and an optional geometry shader. Cemu's graphic pack feature allows to overwrite individual shaders giving control over many aspects of a game's render pipeline. For an example see the 'TheWindWaker_reducedBloom' graphic pack.

In order to get access to the shaders that are used by Cemu you can enable the debug option 'Dump shaders' before or while a game is running. Make sure to delete the contents of the shaderCache/ dirctory first as Cemu will not dump shaders that are already cached. Since the shaders generated by Cemu are translated from low-level binary instructions they contain little to no human-readable information. You likely won't be able to figure out what a shader does just by looking at it's source. Therefore it is recommended to use third-party tools like NVIDIA's NSIGHT or AMD's GPU PerfStudio to do realtime graphics debugging while a game is running in Cemu. (Again make sure to delete the contents of shaderCache/ beforehand)

Once you have located a shader that you want to edit, you can copy it from the dump/shaders/ directory into your graphics pack. You then can make any adjustments you want to the shader source. Any GLSL compilation errors will be written to log.txt