- C++ 95.8%
- CMake 4%
- C 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- CMakeLists: link ws2_32/iphlpapi on WIN32 for tinyosc and targets - osc_receiver: WSAStartup, closesocket/ioctlsocket, winsock error handling via sock_strerror, WSAECONNRESET-tolerant drain loop - osc_receiver: bind to local IP on VTS subnet instead of INADDR_ANY (GetAdaptersAddresses on Windows, getifaddrs on POSIX) to fix multi-interface machines; add UDP diagnostic counters - main.cpp: use FindFirstFileA for .psd dir scan on Windows - init_command: 1-arg mkdir on Windows - run_command: closesocket on Windows - logger: flush after each log line - add .gitattributes (* text=auto) to normalize line endings - misc: default VTS port 21413, brow surprised threshold 0.40 |
||
| docs | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
| README.zh.md | ||
live-png
A lightweight, cross-platform command-line VTuber PNG renderer.
Requirements
- C++17 compiler (GCC 8+, Clang 7+)
- CMake 3.16+
- SDL3 (system-installed or built manually)
Build
# Install SDL3 (Ubuntu/Debian)
sudo apt install libsdl3-dev
# Or build SDL3 from source to a local directory
git clone https://github.com/libsdl-org/SDL.git --branch release-3.2.0
cd SDL && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local
make -j$(nproc) install
# Build live-png
cd live-png
mkdir build && cd build
cmake .. -DCMAKE_PREFIX_PATH=$HOME/.local # if SDL3 is installed locally
make -j$(nproc)
./live-png --help
Usage
Asset preprocessing: init
Converts Photoshop PSD files into cropped PNG collections and a config file.
# Auto-detect .psd files in the current directory
./live-png init
# Specify a PSD file
./live-png init avatar.psd
# Specify output directory and scale
./live-png init avatar.psd -o ./assets --scale 0.5
The --scale parameter proportionally scales the canvas and all layers (default 1.0, range 0.0 ~ 4.0).
Live rendering: run
Opens a transparent window and listens for face tracking data to render in real time.
# Use default port 9000
./live-png run ./assets
# Specify a port
./live-png run ./assets -p 9001
PSD Layer Naming Convention
The tool classifies assets by layer name and Photoshop group structure. All names are case-insensitive.
Layer Groups (Photoshop Groups)
| Group | Type | Supported Layers |
|---|---|---|
eyes |
Dynamic | normal, smile, closed, half, down, surprised |
brows |
Dynamic | normal, surprised, sad, angry |
mouth |
Dynamic | normal, smile, closed, half, open, o, e, u, i, a, curl, smirk, sad |
face |
Dynamic | normal, half, open, puff, smile |
| (none) | Static | body, hair, hat, etc. — any name |
Left/Right Convention
_l: Left side of the screen (viewer's left)_r: Right side of the screen (viewer's right)
Eyes/Brows: If a layer has no _l/_r suffix, the tool automatically splits it along the canvas centerline, producing left and right halves. If the suffix is already present, the layer is used as-is.
Smirk/Curl: Without a _l/_r suffix, the tool defaults to _r and automatically generates a mirrored _l. Both share the same texture; _l is rendered with a horizontal flip.
Mouth/Face: _l/_r suffixes are generally not needed; just place layers inside the group.
Naming Example
PSD Structure:
├── Group: eyes
│ ├── normal ← auto-split into eyes_normal_l.png / eyes_normal_r.png
│ ├── smile ← auto-split into eyes_smile_l.png / eyes_smile_r.png
│ └── closed ← same as above
├── Group: mouth
│ ├── normal ← mouth_normal.png
│ ├── open ← mouth_open.png
│ ├── smirk ← auto-generates smirk_r + mirrored smirk_l
│ └── ...
├── Group: face
│ ├── normal
│ └── puff
├── body ← body.png (static)
└── hair ← hair.png (static)
Face Tracking Data Source
The engine receives ARKit 52 Blendshape data via UDP in OSC format on the default port 9000. Compatible with mainstream face tracking software such as VTubeStudio (VTS) and FaceMotion3D (FM3D).
mapping_config.json (Optional)
Place this in the asset directory to override default thresholds and behavior:
{
"global": {
"debounce_ms": 60,
"ema_alpha": 0.3
},
"eyes": {
"debounce_ms": 20,
"force_symmetry": false,
"symmetry_source": "left",
"thresholds": {
"closed": { "eyeBlinkLeft": 0.75 }
}
},
"mouth": {
"thresholds": {
"o": { "mouthFunnel": 0.4, "jawOpen": 0.1 }
}
},
"custom_params": [
{ "osc_address": "/avatar/parameters/customParam", "index": 64 }
]
}
ema_alpha: 0.0 = no response, 1.0 = no smoothingforce_symmetry: force left-right symmetry (overrides network data)custom_params: map non-standard OSC addresses to extended blendshape indices (52-127)
All fields are optional; missing fields use hardcoded defaults.
Known Limitations
- Only 8-bit RGB PSD files are supported
- ASCII-only paths (non-ASCII characters may fail on Linux)
- No hot-reload — re-run
initafter modifying the PSD - No keyboard shortcut to exit
run(close the window to quit)