Add engine-debug-tools and fix critter animation rendering bugs
build / build (push) Successful in 2m52s
build / build (push) Successful in 2m52s
- engine-debug-tools/: a debug dump hotkey + dump2png to inspect decoded critter frames independent of the renderer (see root README.md's "Debugging" section). - engine-patches/04,05: fix critter sprite scale and an OpenGL texture cache collision, found using that tooling. - mdlp: fix encodeFrames RLE-diffing upscaled frames against a previous-frame reference the real RSD8 decoder never implements (verified against Night Dive's original Mac source down to the 68K assembly) - was rendering as scattered static in-game. - Upscale pipeline: better color quantization (dithering, pure-ramp exclusion) and per-resource model selection.
This commit is contained in:
@@ -21,23 +21,43 @@ RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl gosu patch python3 python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN pip3 install --no-cache-dir onnxruntime pillow numpy
|
||||
RUN pip3 install --no-cache-dir onnxruntime pillow numpy scipy
|
||||
|
||||
# The AI upscaler model for mdlp's upscale mod type (see ../README.md
|
||||
# section 4): RealESRGAN_x4plus_anime_6B, a 6-block RRDBNet ONNX-exported
|
||||
# from xinntao/Real-ESRGAN's anime-illustration checkpoint (BSD-3-Clause).
|
||||
# It's trained on flat-color line art, so it keeps hard sprite edges rather
|
||||
# than smoothing them the way a photo- or video-denoising model would. A
|
||||
# mod's own "model" field (upscaleDef in ../src/mdlp/upscale.go) is not
|
||||
# consulted; every resource goes through this one model. upscale_batch.py
|
||||
# resizes its fixed native 4x output down to whatever scale a mod actually
|
||||
# asks for.
|
||||
ARG UPSCALE_MODEL_URL=https://huggingface.co/skillsafe-ai/realesrgan-x4plus-anime-6b/resolve/main/model.onnx
|
||||
RUN mkdir -p /opt/upscale-model \
|
||||
&& curl -sSL -o /opt/upscale-model/model.onnx "$UPSCALE_MODEL_URL"
|
||||
# The AI upscaler models for mdlp's upscale mod type (see ../README.md
|
||||
# section 4), selected per mod by a bitmaps/*.json file's own "model" field
|
||||
# (upscaleDef in ../src/mdlp/upscale.go) - upscale_batch.py resolves a name
|
||||
# straight to $UPSCALE_MODELS_DIR/<name>.onnx, and picks tiled or single-pass
|
||||
# inference based on each model's own declared ONNX input shape (fixed vs
|
||||
# dynamic height/width), so adding another model here needs no code change.
|
||||
# Each model's RGB output is re-quantized to SS1's fixed 256-color palette
|
||||
# with Floyd-Steinberg dithering (imageToBitmap in ../src/mdlp/upscale.go),
|
||||
# not a plain nearest-color map - without it, any model's smooth gradients
|
||||
# can land on a visibly wrong, much darker palette entry in a solid patch
|
||||
# rather than unnoticeable dithering noise.
|
||||
# All three are BSD-3-Clause ONNX exports of xinntao/Real-ESRGAN checkpoints:
|
||||
# - realesrgan-x4plus-anime: a 6-block RRDBNet trained on flat-color
|
||||
# illustration, keeping hard sprite edges rather than smoothing them the
|
||||
# way a photo- or video-denoising model would. Dynamic input shape. Default
|
||||
# choice - sharpest result on most sprites.
|
||||
# - realesrgan-x4plus: the general-purpose photo checkpoint (16.7M-param
|
||||
# RRDBNet). Fixed 128x128 input, needs tiling for anything larger, and
|
||||
# much slower than the other two. Worth trying when the anime model
|
||||
# mis-renders a specific sprite, but can itself mis-render different ones.
|
||||
# - realesr-general-x4v3: a compact 1.2M-param SRVGGNet, dynamic input
|
||||
# shape, ~100x faster than realesrgan-x4plus. Noticeably softer than
|
||||
# either RRDBNet model, but the most robust against both models' failure
|
||||
# modes - the model to reach for on a specific sprite neither RRDBNet
|
||||
# model renders cleanly, not as a blanket replacement.
|
||||
ARG UPSCALE_MODEL_ANIME_URL=https://huggingface.co/skillsafe-ai/realesrgan-x4plus-anime-6b/resolve/main/model.onnx
|
||||
ARG UPSCALE_MODEL_GENERAL_URL=https://huggingface.co/qualcomm/Real-ESRGAN-x4plus/resolve/6f5749d5adff39de0127e42bc45c8ec8e6f76a66/Real-ESRGAN-x4plus.onnx
|
||||
ARG UPSCALE_MODEL_COMPACT_URL=https://huggingface.co/jonathanst29/tinier-upscale-models/resolve/main/realesr-general-x4v3.onnx
|
||||
RUN mkdir -p /opt/upscale-models \
|
||||
&& curl -sSL -o /opt/upscale-models/realesrgan-x4plus-anime.onnx "$UPSCALE_MODEL_ANIME_URL" \
|
||||
&& curl -sSL -o /opt/upscale-models/realesrgan-x4plus.onnx "$UPSCALE_MODEL_GENERAL_URL" \
|
||||
&& curl -sSL -o /opt/upscale-models/realesr-general-x4v3.onnx "$UPSCALE_MODEL_COMPACT_URL"
|
||||
COPY mdlp-image/upscale_batch.py /usr/local/bin/upscale_batch.py
|
||||
RUN chmod 755 /usr/local/bin/upscale_batch.py
|
||||
ENV UPSCALE_MODEL_PATH=/opt/upscale-model/model.onnx
|
||||
ENV UPSCALE_MODELS_DIR=/opt/upscale-models
|
||||
|
||||
RUN curl -sSLO "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
|
||||
&& tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" \
|
||||
|
||||
Reference in New Issue
Block a user