AM2R Modding Wiki
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Shaders

This subsection documents the various shaders used in AM2R. Shader assets have the prefix sh.

todo! TODO:
Am2r 1.0 used a shader for gravity suit. document that one more
todo! TODO:
document more on how to use them as a developer? maybe in a seperate page?
AM2R 1.0 uses a shader internally known as shReplaceColor. Not much is known about it, but Rivals of Aether also has a similar if not the same shader. It seems to originate from GMLscripts.com, but it also could’ve been a shader shipped with old GameMaker versions or from GMC. DoctorM64 did not write it himself.

This shader was originally used in AM2R 1.0 to palette swap the Varia Suit sprites to Gravity Suit. However, since many GPUs had issues running the shader, thus leaving Gravity Suit to look the same as Varia Suit, it went unused in 1.1 in favour of prerendered sprites. Not much documentation has been done in looking into how exactly the shader worked, on neither a code side, nor a dev-usage side.

The Community Updates uses two shaders:

Pixelated Pope’s Retro Palette Swapper

Internally known as shPaletteSwap. It can be found for free here: https://pixelatedpope.itch.io/retro-palette-swapper. Note that for the versions 1.5.5 and lower, you want to use the Retro Pal Swapper 2.1 for GMS1 asset.

The shader is used on desktop machines as an extra to palette swap Samus and Metroids. It is disabled on Android systems. However, despite that, similar to the early 1.0 color repalce shader, it also has issues running on many GPUs, especially laptop or other lower-end ones. The Metroid palettes are applied by default on Fusion Mode to make the Metroids more Fusion-themed. You can find them in mods/palettes/monsters in the asset directory. In there, there’s also a config.ini file to determine whether the palettes should always be applied, or only on Fusion Mode. The Samus palettes are applied from mods/palettes/suits in the asset directory. These only get applied if the Fusion Suit variant in Extras is not set to M:SR. Note that the M:SR variant also uses the palette shader.

The user is able to modify the Metroid and Samus palettes. The image needs to be 2 pixels wide and can be any pixels high. The second color in a row determines what all instances of the first color should be replaced with.

PixHammer’s GameBoy Shader

Internally known as shGameBoy. It can be bought for 2$ here: https://pixhammer.itch.io/gameboy-shader.

The shader is used as an extra to limit the whole screen to 4 colors, similar to the GameBoy. The available default available presets are these:

Olive
Olive
Blue
Blue
Black&White
Black&White
Virtualtroid
Virtualtroid
Green
Green
Custom, with default values in modifiers.ini
Custom, with default values in modifiers.ini
Custom, with default values if the keys in modifier.ini are missing
Custom, with default values if the keys in modifier.ini are missing

The values are harcoded several places:

  • The set_8bit_shader script for Olive to Green
  • The modifiers.ini file for one Custom variant
  • the scr_load_scripts script for the other Custom variant

The user is able to modify the Custom variant in the modifiers.ini, by changing the keys CustomColorXValueY, where X is a number from 1 to 4, and Y is a number from 1 to 3. The colors are sorted from darkest to brightest (CustomColor1ValueY is darkest, CustomColor4ValueY is brightest), and then by red, green and blue values (CustomColorXValue1 is the red component, CustomColorXValue3 is the blue component). The values can take in numbers from 0 to 255.