Files
2026-10-31 22:30:03 -07:00

312 lines
20 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SkinRecolor — recolor any Mycopunk skin, synced in multiplayer
A BepInEx 5 mod for Mycopunk. Press **F8** in-game and recolor every skin you're wearing: your character,
Weapon 1, Weapon 2 and other gear, either all together or each slot on its own. Works on every skin.
- **Hue** as a **color code** (type `#E0302F` and the skin's main color turns that color) or as a rotation
(typed to 0.1°), **Tint**, **Accent** (trim) color, **Glow**, **Shine**, **Neon**, and the
game's own effects (**Desaturate**, Contrast, Negative, Spectral, Color cycling/tossing, Pixelated,
Coppertone, Bloodmetal, Pool party, Chroma).
- **Texture**: whole-texture **Brightness / Contrast / Saturation / Midtones** sliders, plus **color regions**:
every color area of the skin's texture (white panels, trim stripes, dark parts, visor...) gets its own color,
with scratches, edges and shading kept.
- **Shader settings**: every property of the skin shader (including ones the game never rolls), each with a
slider / typed value / hex code.
- **Menu previews** show your colors live: the character in the loadout / gear details / character select
screens, the gear model in gear details, and hat previews.
- Every color takes a hex code (plus R/G/B sliders with typed 0–255 values), every slider takes a typed value.
- Other players running SkinRecolor see your exact colors and you see theirs, **whoever hosts** (synced
through Steam lobby data).
- Players **without** the mod can see your **hue** too, on skins that have a Hue modifier (see below).
## How it works
- **Hue**: Mycopunk's skin shader already has a `_HueShift` property (it's what the game's own "Hue" skin
modifier rolls; 0–1 is one full turn, the 0–100 in tooltips is display only). The mod rotates it.
- *Shift* mode adds your rotation on top of whatever hue the skin rolled. 0° = untouched skin.
- *Override* mode ignores the skin's rolled hue and uses exactly your rotation.
- *Color code* mode works the rotation out for you: the mod analyzes the skin's texture, finds the part you
picked (default: its most prominent color) and rotates so that part comes out in your color's hue. Sent as
an Override rotation, so modded friends and players without the mod see it like any other hue. Re-worked
out automatically when you change skins.
- **Tint**: multiplies the skin shader's base/shadow color properties (`_Color`, `_ShadowColor` by default)
by a color you pick. Works on top of hue, so you can get colors a pure hue rotation can't (darker, paler,
black, white-ish), and it's the only way to color white/gray parts (white has no hue to rotate). On models
with several materials, each skin material is tinted on its own (outlines, visors and other non-skin
materials are left alone).
- **Accent / Glow / Shine / Neon / effects**: the same skin-shader properties the game's own skin modifiers
write (`_Trim`/`_TrimColor`/`_TrimSpecular`/`_InvertTrim`/`_AlphaTrim`, `_EnableEmission`/`_EmissionColor`,
`_SpecularColor`/`_Smoothness`, `_NeonRed`..., `_Saturation`, `_Contrast`, `_Negative`, `_Spectral`,
`_CycledColors`, `_TossedColors`, `_Pixeled`, `_Coppertone`, `_Bloodmetal`, `_PoolParty`, `_Colorchroma`).
Each one, when on, overrides whatever the skin rolled; off = the skin's own value.
- **Texture regions**: the mod reads each skin texture you're wearing back from the GPU (capped at 2048 px),
splits it into its main color regions (k-means, deterministic), and builds a recolored copy on a background
thread: every pixel moves with its region, at its own brightness, so scratches/shading/edges survive and
regions don't bleed into each other. The copy is swapped in through the skin material's property block; the
game's textures and materials are never modified. Only the small "this color becomes that" list is synced,
so modded friends rebuild the same texture on their side from their own game files. The config keeps region
colors for every texture you've ever set (up to 1024 per section); only the ones the textures you're wearing
right now use are shared (up to 64 per gear slot).
The whole-texture sliders run in the same pass: pixels still find their region by their original color, regions
you colored get exactly your color, everything else is the pixel through the sliders.
- **Shader settings**: lists every non-texture property of the skin's shader(s) at runtime (`Shader.GetPropertyCount`
and friends). A ticked property is written into the same per-material property block, after everything else,
so it wins. Synced as a hash of the property name plus the value: one table for all slots, where a list that's
the same on several slots (Character colors on all gear) is sent once; up to 112 values in all.
- **Saved looks**: every recolor setting (all four slots, texture, effects, shader settings) saved as a small text
file in `BepInEx/config/SkinRecolor Looks/` and loaded back in one click.
- **Menu previews**: the character model in menus is a `MenuRig` with normal renderers, tracked like your own
character. Gear models and hats in menus are drawn with `Graphics.RenderMesh`; a Harmony prefix attaches the
property block to those draws while the gear details window / menu rig is drawing (nothing else is touched).
- **Exact color codes** (on by default): the shader rotates hue *after* tint/accent/glow/shine, so a red tint
at 250° hue comes out purple. The mod pre-rotates those colors by the opposite amount so the hex code you
type is what you see. Turn it off to let the hue rotation shift them too.
- Colors are applied with a `MaterialPropertyBlock` right before each frame renders. Game materials are never
modified, so the game's own skin swaps, previews and effects keep working. Skins that animate their own
hue keep animating.
- **Multiplayer, modded players**: each player writes their colors into their own slot of the Steam lobby's
member data (a few hundred bytes); every modded player reads everyone's slots. Steam relays it, so the
**host doesn't need the mod**. If the host does run it, colors also go over the game's own Netcode session
(a named message) and whichever copy is newer wins.
- **Multiplayer, players without the mod**: their game only ever hears "this player wears skin X with seed
Y" and re-rolls the look from the seed. So the mod looks for another seed of the *same* skin whose Hue roll
lands on your color while every other roll (neon, trim, overlay, texture, emissive, hat size, crab eye...)
comes out identical, and sends that seed instead of yours.
- It checks "identical" by replaying the skin on throwaway materials exactly like the game's own skin
preview does, and comparing every shader value, not just the tooltip.
- Your own copy of the game, your save and your inventory keep your real roll. Nothing is written anywhere.
- Only skins you own and wear, on your character and your weapons. Forced/default skins are left alone.
- Search runs a little each frame once you stop dragging the slider (usually well under a second, worst
case ~30 s), then the mod re-sends your skins.
- Modded players are told "that roll is really this exact hue", so they still see your exact color.
- The mod is tagged client-side (`ModFlags.IsClientSide`), same as other cosmetic mods.
## Requirements
- Mycopunk with **BepInExPack_Mycopunk** (r2modman / Thunderstore Mod Manager, or manual install).
- To build: **.NET SDK 8** (or newer).
## Install the .NET SDK
macOS (zsh/bash):
```bash
brew install --cask dotnet-sdk
```
Linux (Ubuntu, bash):
```bash
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0
```
Windows (PowerShell or Command Prompt — same command in both):
```powershell
winget install Microsoft.DotNet.SDK.8
```
## Build
Run these from the `SkinRecolor` folder (the one with `SkinRecolor.csproj`).
**Windows, game installed in the default Steam folder** (PowerShell or Command Prompt — identical in both):
```powershell
dotnet build -c Release
```
**Windows, game in another Steam library** — PowerShell:
```powershell
dotnet build -c Release -p:MycopunkDir="D:\SteamLibrary\steamapps\common\Mycopunk"
```
Command Prompt:
```bat
dotnet build -c Release -p:MycopunkDir="D:\SteamLibrary\steamapps\common\Mycopunk"
```
**macOS or Linux** (no game install needed; pulls the stripped game DLLs from NuGet) — bash/zsh:
```bash
dotnet build -c Release -p:UseGameLibs=true
```
The same `-p:UseGameLibs=true` flag works on Windows too if you'd rather not point at your install.
Output: `bin/Release/SkinRecolor.dll`. The build prints which game DLLs it compiled against.
**Build and copy straight into your r2modman profile** (Windows) — PowerShell:
```powershell
dotnet build -c Release -p:PluginsDir="$env:APPDATA\r2modmanPlus-local\Mycopunk\profiles\Default\BepInEx\plugins"
```
Command Prompt:
```bat
dotnet build -c Release -p:PluginsDir="%APPDATA%\r2modmanPlus-local\Mycopunk\profiles\Default\BepInEx\plugins"
```
## Install
Put `SkinRecolor.dll` in your BepInEx `plugins` folder. Swap `Default` for your profile name if you use another.
r2modman profile — PowerShell:
```powershell
Copy-Item .\bin\Release\SkinRecolor.dll "$env:APPDATA\r2modmanPlus-local\Mycopunk\profiles\Default\BepInEx\plugins\"
```
r2modman profile — Command Prompt:
```bat
copy bin\Release\SkinRecolor.dll "%APPDATA%\r2modmanPlus-local\Mycopunk\profiles\Default\BepInEx\plugins\"
```
Thunderstore Mod Manager profile — PowerShell:
```powershell
Copy-Item .\bin\Release\SkinRecolor.dll "$env:APPDATA\Thunderstore Mod Manager\DataFolder\Mycopunk\profiles\Default\BepInEx\plugins\"
```
Manual BepInEx install in the game folder — PowerShell:
```powershell
Copy-Item .\bin\Release\SkinRecolor.dll "C:\Program Files (x86)\Steam\steamapps\common\Mycopunk\BepInEx\plugins\"
```
Linux (Steam + Proton, r2modman) — bash:
```bash
cp bin/Release/SkinRecolor.dll ~/.config/r2modmanPlus-local/Mycopunk/profiles/Default/BepInEx/plugins/
```
Linux (manual BepInEx in the game folder) — bash:
```bash
cp bin/Release/SkinRecolor.dll ~/.local/share/Steam/steamapps/common/Mycopunk/BepInEx/plugins/
```
macOS: Mycopunk is Windows-only, so either build on the Windows PC directly (simplest), or build on the Mac
with `-p:UseGameLibs=true`, move `bin/Release/SkinRecolor.dll` to the PC any way you like, and use one of the
Windows copy commands above.
Friends who want your exact colors (and tint) need the same DLL. The host doesn't. Friends without it see your
hue on skins that have a Hue modifier.
## Use
- **F8** opens/closes the window (change it in the config). The mouse is freed and look/fire are locked
while it's open, and the game's menus behind it ignore the mouse and menu keys (no hover, clicks, scrolling or
drag-rotating; Esc doesn't close them either). Close the window to use them again; the menu previews keep showing
your edits. Untick "Game menus behind this window can't be clicked..." to only block while the mouse is over the
window. While you type in a field, movement / weapon / chat keys are off too.
- Tick **Recolor Character**, drag the hue slider. Done — that recolors everything if "Use Character colors for
weapons & gear" is on (default). Untick that to set Weapon 1 / Weapon 2 / Other Gear separately.
- Sections fold open with **[+]**; a section that's doing something says **on**.
- Typed values apply as soon as they're complete (a hex code at its 6th digit). A box turns **pink** while what's
in it isn't applied (incomplete or invalid code); clicking away puts the real value back.
- **Tint**: tick it, type a hex code (or drag/type R/G/B, or click a swatch), adjust strength.
- **Texture**: open the section, tick it.
- **Whole texture**: Brightness (−100% black … +100% white), Contrast, Saturation (0% = grayscale), Midtones.
They affect everything except regions you've colored.
- **Color regions**: each texture you're wearing is listed with its regions: color now → new color, hex field,
share of the texture, **Edit** (full color picker) and **Reset**. More **Regions** = finer split (2–16).
- Easiest way to get exactly the look you want; open the loadout screen to watch it change live.
- **Saved looks** (near the bottom of the window): type a name, **Save**. **Load** puts that whole look back,
**Delete** asks once more before removing it. Saving under an existing name overwrites it. The files are plain
text, so you can share them: a friend drops one into the same folder and it shows up in their list.
- **Shader settings**: tick any property to take it over (it starts at the skin's current value), then slide,
type, or enter a hex code. HDR colors get an Intensity slider. "Show hidden properties" lists the ones the
shader hides from its own inspector. **Reset all shader settings** puts everything back.
**Apply to** picks what the settings change: every part of the skin, or one part: one material of one model
("Body, material 2", first-person arms, ...; the one marked "(face light)" glows when you talk). A part is
only that material on that model, so a face light setting never touches your first-person arms. Per-part
settings win over every-part ones, e.g. tick `_Color` on the face light part and make it red to get a red face
glow without touching anything else. Body parts are listed even in first person, when that model is hidden.
- **White skin with red accents**: Texture regions → set the panel regions to white and the trim regions to
red. (Or: Effects → Desaturate 100% + Accent red.)
- **Hue → Color code**: type a hex code (or use R/G/B / swatches). Under it, click which part of the skin should
become that color (swatches as they look now), or leave **Auto**. "You get" shows the actual result: hue
can't change how light or vivid a color is, so a dark brown part typed `#FF0000` becomes dark red. For exact
shades (or white/black) use Texture regions.
- **Hue → Shift / Override**: type an exact rotation like `252.5`, or use the slider / -10 -1 -0.1 +0.1 +1 +10 / presets.
- **Multiplayer** section shows the sync status, which players have the mod, and for each skin you wear what
players without the mod see ("visible (exact)", "searching...", or why it can't).
Gear slots follow the game's gear order: slot 1 = Weapon 1, slot 2 = Weapon 2, slot 3+ = Other Gear.
## Config
`BepInEx/config/redlintu16.skinrecolor.cfg` (also editable live through ModSettingsMenu's F10 window if you
have it, or BepInEx ConfigurationManager).
| Section | Key | Default | What |
|---|---|---|---|
| General | Toggle Key | `F8` | Input System key name (`F9`, `Backquote`, `Insert`, ...) |
| General | Block Game Menus While Open | `true` | Game menus behind the window ignore mouse and menu keys (`false` = only under the window) |
| General | Window Scale | `0` | `0` = auto (1.0 at 1080p, 2.0 at 4K), or a fixed size like `1.5` |
| General | Character Settings Apply To All Gear | `true` | One color for everything |
| Character / Weapon 1 / Weapon 2 / Other Gear | Enabled, Hue Mode (Shift/Override/Color), Hue Degrees, Hue Color, Hue Color Part, Tint Enabled/Color/Strength | off, Shift, `0`, `#E0302F`, empty (auto) | Per-slot hue and tint |
| (same sections) | Accent Enabled/Color/Amount, Accent Shine Matches Accent, Accent Shine Color, Accent Flip Areas, Accent Alternate Mask | off, `#D91A1F` | Trim/accent color |
| (same sections) | Glow Enabled/Color/Intensity, Shine Enabled/Color/Smoothness | off | Emission and highlights |
| (same sections) | Neon Enabled, Neon Red/Green/Blue/Yellow/Magenta | off | The game's Neon effect |
| (same sections) | `<Effect> Enabled`, `<Effect> Amount` for Desaturate, Contrast, Negative, Spectral, Color Cycling, Color Tossing, Pixelated, Coppertone, Bloodmetal, Pool Party, Chroma | off | The game's skin effects |
| (same sections) | Texture Regions Enabled/Count/Map | off, `6`, empty | Per-region texture colors (`TextureName\|RRGGBB>RRGGBB;...`, set from the window) |
| (same sections) | Exact Color Codes | `true` | Hex codes show as typed despite hue rotation |
| Multiplayer | Share My Colors | `true` | Send your colors to modded players (Steam lobby + host relay) |
| Multiplayer | Show My Hue To Players Without The Mod | `true` | Swap in a matching roll of your skin so vanilla players see your hue |
| Multiplayer | Show Other Players Colors | `true` | Display other players' colors |
| Advanced | Tint Color Properties | `_Color,_ShadowColor` | Shader color properties Tint multiplies |
| Advanced | Log Skin Shader Properties | `true` | Logs the skin shader's real property list once |
| (each slot) | Texture Brightness / Contrast / Saturation / Midtones | `0`, `1`, `1`, `1` | Whole-texture sliders (need Texture Regions Enabled) |
| (each slot) | Shader Settings | empty | Raw shader values (`name=f:0.5;name=c:r,g,b,a;...`, `name@tp0#2=...` = one part; set from the window) |
## Troubleshooting
- **Nothing happens at all**: check `BepInEx/LogOutput.log` for `SkinRecolor 2.6.1 loaded`. If it's not there
the DLL isn't in the right `plugins` folder / profile.
- **Hue works, tint or an effect does nothing**: with tint/effects on, the log gets lines like
`tint + effects on 'Body' (2 material(s) written). Materials: ...` for the first dozen renderers, listing
which materials are skin materials and which color properties they have. If a skin's materials don't list
`_Color`, put the right names (from the `Skin shader '...' properties` line) into
`[Advanced] Tint Color Properties`. An effect only shows on materials whose shader has that property.
- **A hex color looks different than typed**: make sure "Color codes are exact" is on. Tint multiplies, so it's
only exact on white parts; accent/glow/shine replace the color, so they're exact everywhere they show.
- **Upgrading from 1.0.0**: the old `[Advanced] Hue Units Per Full Turn` entry is ignored now (it was wrong:
the shader uses 0–1 per turn). You can delete that line from the .cfg.
- **Texture regions list says "Reading texture..." forever / "Couldn't read this texture"**: check the log for
`Couldn't read texture` warnings. Regions need your character spawned (hub or mission).
- **A per-part shader setting (face light) also changed my first-person arms / other models**: that was 2.6.0,
where "Part n" meant material n of every model. 2.6.1 rewrites those settings once you're spawned (log:
`2.6.0 part numbers updated to model parts`): the one that was marked face light moves to the real face light
part, the others to the body model. Saved looks from 2.6.0 get the same fix when you load them.
- **Modded friends don't see my colors**: best if you're all on 2.6.1. It reads every 2.2+ player, and sends the
oldest format that holds what you use: v4 without sliders / shader settings, v6 (2.5.0+) with them, v7
(2.6.1+) only while a per-part shader setting is on. Older versions log "Ignoring unreadable SkinRecolor
lobby data" and see nothing from you until they update. Both need
`Share My Colors` / `Show Other Players Colors` on. The window says "In a Steam lobby. Synced with N..."
when lobby sync works.
- **Vanilla friends don't see my hue**: look at "What players without the mod see" in the window. It says per
skin whether it worked and why not. Common reasons: the skin has no Hue modifier; the skin's Hue curve can't
reach that color (it tells you the range, pick a hue in it, Override mode helps); or the skin has rare
modifiers that make an identical roll too hard to find.
## Limits
- Menu previews show your own colors only. The character preview always uses your **Character** colors (even
when previewing another character); a gear preview uses the slot that gear is equipped in.
- Other menus that draw skins their own way (the lottery machine, the couch, pet rock) aren't recolored.
- The drop pod isn't touched.
- Players without the mod: hue only (never tint, accent, glow or other effects), only on skins with a Hue modifier, only within the hues
that skin's Hue roll can produce, accurate to about 2.5° (7° at worst). They see the change after the
search finishes and your skins are re-sent (each re-send makes their game re-apply your skin, like when you
change skins).
- About 150 of the game's ~230 skins have a Hue modifier. The rest can only be recolored for modded players.
- A few skins with a Hue modifier still can't be done for vanilla players because the mod can't prove another
roll looks identical (for example skins that roll a random hat). The window names the reason per skin.