styledev.rt

(HackPrinceton 2018) Game asset style transfer for easily extensible fan mods and creations.

About

Style Transfer is a relatively new subfield in machine learning that allows for the quantification of image "styles," typically thought of as "brush patterns" or other local geometry in an image. By training a neural network to quantify such styles, it's possible to "transfer" the style of one image onto another, creating a variety of interesting results, including "Deep Fakes' and other forms of content.

However, while these algorithms have been adapted to video content, including some working demos on live video feeds, such techniques often remain computationally infeasible, requiring anywhere from seconds to minutes to process a single frame on typical hardware. In this project, we offer true real-time style transfer through pre-computed "style transferred" modified game assets, rendering such assets in real time with the original game engine.

Screenshots

Base Style: Base Style Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

Demo

To run our modded first level of "Paper Mario: The Thousand Year Door":

  • Install Dolphin Emulator
  • Clone this repo, and copy "demo/modded_textures" to "Your Documents Folder/Dolphin Emulator/Load/Textures"
  • Under Dolphin/Graphics Settings/Advanced, tick "Load Custom Textures"
  • Run TTYD from Dolphin

Requirements

(For recomputing results/changing paramters/textures, etc.) Running this project depends on the following packages (available through conda or pip)

  • torch, torch.nn, numpy
  • torch.optim
  • PIL, PIL.Image,
  • torchvision.transforms
  • torchvision.models

Usage

  1. Tick "dump textures" under Dolphin/Graphics/Advanced. Then play through the desired level(s) that you wish to mod/style transfer onto.
  2. Run python run_this.py in your terminal of choice. By default, this uses the textures listed in demo/dumped_textures to determine which textures to replace/style on, searching through all the files listed in demo/base_textures and replacing them in-place. The style to be used is computed from "demo/style.jpg." After doing this, follow the instructions for running the demo.

Future Extensions

  • Style transferring 3D assets, using UV projection information for preservation of spatial features
  • Application to other games/engines
  • Other neural style transfer algorithms

Credits

Thanks to The Dolphin Community TTYD Texture pack, Alexis Jacq et. al, and the Dolphin Team.

Share this project:

Updates