How do I run MMD on Linux? Does MikuMikuDance run on Linux? How do I run MMD using Wine on Linux? Can I use MME on Linux? How do I use DXVK with MMD? How do I run MMD on Ubuntu?
How to run MikuMikuDance in Linux using Wine and DXVK
Hey everyone, it is parkeerwacht here! It has been a while since I have written for the pages here at LearnMMD! But I am back with a special tutorial. How to run MMD in Linux! And “no”, not some alternate version of MMD: run the full 64-bit Windows version (9.32 as of this writing) including MME!
EDITOR’S NOTE 7/17/2024:
A reader left a comment:
Hello!
I was able to run it using Bottles. I simply created a new “gaming” profile bottle and the default settings. I did however copy the MMD program folder into the “c:” drive of the bottle just in case. I was able to run MMD as if it was nothing.
The only caveat is that the fonts look terrible.
Ok, so a little story before we begin: Since I have always been interested in the technical aspect of MMD, and also computers in general, I like challenges! So I switched to Linux as my main operating system about a year ago, as of writing this. I have a problem however: I can no longer use MMD! MikuMikuDance only runs on Windows. Because I can play my Windows games using DirectX just fine, using Wine and DXVK, I thought could I do the same for MMD? And the answer is YES!
For this tutorial, I searched the internet and found multiple sources (I will cite these)… I combined them into this one guide for MMD specifically. Also I found a script on a Japanese website. I looked into its code and I did some testing. I wrote my own script based of that one. I also found a resource to do it manually. The script only automates things. ANYWAY enough rambling about… LET’S GET STARTED!!!
Also lets put some credit to the people who helped me with the information:
- Midnight Express Ginga81(ginga81)
- petite philosophie (YouTube, Twitter, Nicovideo (www.nicovideo.jp/user/52346055)
Without them I would not have been able to write this.
Now a little thing before we begin, I need to start with a disclaimer:
We are going to mess around with the Linux terminal. Make sure you know what you are doing! All the scripts I listed are provided “as is”. If for some reason they do not work, try to troubleshoot them yourself. This is due to the constant updates to wine, winetricks and DXVK. If it is completely broken let me know and I will update them. Use this tutorial and the scripts at your own risk. This guide only works for MMD+MME. It is not compatible with PMXe!
ALSO NOTE: IF YOU ARE SENSITIVE TO FLASHING IMAGES DO NOT USE MMD IN LINUX. FLASHING ARTIFACTS MAY OCCUR!!!
The following instructions are written for Ubuntu (and derived distro’s) IF you run something else follow the instructions for your distro instead. For my install script, I listed all the commands so you can follow them for your distro.
First of all check if your system is compatible with the requirements for MMD, Vulkan and DXVK
Requirements:
- 64-bit System.
- Operating system: Ubuntu 18.04 or newer, I recommend 20.04
(Note: Other Linux distro’s will probably work fine if they are debian based. However I have done my testing on Ubuntu 20.04) - an AMD or Nvidia Graphics card that supports Vulkan. (here is a list of supported cards: https://en.wikipedia.org/wiki/Vulkan_(API)#Compatibility )
- Recommended: at least 2 monitors (I will explain why later)
- Knowledge of the Linux terminal
Here is a screenshot of my install:
Step 1 Setting up Vulkan.
Note: If you already got all the drivers and software installed to run Vulkan applications on your system you can skip this step.
What is Vulkan?
Vulkan is a graphical computing API much like DirectX and OpenGL etc. (very simplified) Now since Linux does not support DirectX, we need to find another way. Vulkan has less latency than OpenGL, and is generally more efficient. It is also compatible across multiple platforms.
1. Installing Drivers
Before we can use Vulkan we need to install some drivers first. PLEASE FOLLOW INSTRUCTIONS CAREFULLY!!!!!!!
DO NOT FORGET THE FOLLOWING COMMAND:
We need to set up the system so it accepts x86 packages. Do this via:
sudo dpkg --add-architecture i386
For AMD cards
Make sure you are running either AMDVLK or AMDGPU-pro (DO NOT INSTALL BOTH)
I recommend using AMDVLK. I had the best experiences with this driver. The AMDGPU-pro package from AMD tends to break some games/applications using Vulkan. I have not tested AMDGPU-pro drivers , only AMDVLK.
Follow the instructions on this page under install with pre-build driver:
https://github.com/GPUOpen-Drivers/AMDVLK#install-with-pre-built-driver
For Nvidia cards
see instructions below for installing Vulkan dependencies
2. Installing Vulkan dependencies
To install Vulkan on your system I highly suggest following the steps on this page for your version of Ubuntu (or other distro) and GPU.
here is the link: https://github.com/lutris/docs/blob/master/InstallingDrivers.md
Step 2 Installing Wine
NOTE: If you already have the latest wine-staging version on your system you can skip this step.
What is Wine?
Wine stands for Wine Is Not an Emulator. It is a compatibility layer that is able to run Windows programs on other operating systems, like Linux and macOS. This has a huge performance boost compared to running a virtual machine. It translates all the Windows API calls on the fly so Linux can understand these. This saves a lot of memory usage and performance hits. Plus you can integrate Windows applications in your desktop environment [source]
We need this program so we can run Windows programs on Linux. MMD is a Windows only program.
Installing Wine
We need to install Wine-staging (latest version) to be able to run MMD with DXVK.
Note: If you already got the latest version of wine-staging installed, you can skip this step. If you have a different variant of Wine installed, uninstall it and reinstall with wine-staging
MAKE SURE TO INSTALL THE STAGING BRANCH!!
Before you setup anything, run this command if you haven’t done so already:
sudo dpg --add-architecture i386
ONLY FOR UBUNTU 18.04 USERS!!! IF YOU HAVE 19.10 OR NEWER SKIP TOWARDS SETTING UP WINE.
You need to set up FAudio first. This package is not in Ubuntu’s package manager but it is a dependency for Wine. To install follow these commands:
wget https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/i386/libfaudio0_19.07-0~bionic_i386.deb wget https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/amd64/libfaudio0_19.07-0~bionic_amd64.deb sudo dpkg -i libfaudio0_19.07-0~bionic_*.deb
If you get an error saying missing dependencies, enter the following command:
sudo apt -f install
Now go to the next part
Setting up wine
Follow the instructions on this page:
https://wiki.winehq.org/Ubuntu
MAKE SURE TO INSTALL WINE-STAGING!!!!
Now you have Wine installed
You can test it by typing the following command
wine --version
Step 3 Setting up Japanese locale.
We need to set up Japanese locale on the system to make sure MMD runs properly. This also allows you to unzip your models and such (due to them being zipped in the Japanese language format). We need to install the Japanese language pack for this
To install this you enter the following command.
sudo apt install language-pack-ja
Unzip script
For all your models, accessories, effects, motion data etc. you need to use this script to unpack it.
This will preserve all the original Japanese filenames etc. and this is important for your models and effects, for example.
Most archive formats are supported!
Dependencies for the script:
p7zip-full p7zip-rar convmv
to install them run this command:
sudo apt install p7zip-full p7zip-rar convmv
once these are installed you go to your MMD folder in a terminal and run the following commands:
wget https://learnmmd.com/wp-content/uploads/2020/12/linux-unzip-tool.tar.gz
tar -xf linux-unzip-tool.tar.gz
chmod +x Decompress-as-Japanese.sh
instructions on how to use will appear on screen once you run it.
Run the file using:
./Decompress-as-Japanese.sh
Step 4 Setting up Winetricks
NOTE: EVEN IF YOU HAVE WINETRICKS INSTALLED FOLLOW THE STEPS BELOW.
To use Winetricks we need to set up a few dependencies first.
These packages are aria2 binutils, cabextract, fuseiso, p7zip-full, policykit-1, unrar, unzip, xdg-utils, xz-utils and zenity
install them with the following:
sudo apt install aria2 binutils cabextract fuseiso p7zip-full policykit-1 unrar unzip xdg-utils xz-utils zenity
My autoinstall script will setup winetricks for us.
Step 5 setting up MMD
UPDATE 29-08-2021: I have updated the script after doing some research. The script now also installs all the fonts needed for MMD. (Thanks to INFINITY)
UPDATE 23-04-2022: After doing further research I have patched the install script. It will now correctly install quartz.dll & Updated DXVK version as well. (Thanks INFINITY)
Update 13-02-2023: Updated script to use newer version of DXVK.
Now we get to the MMD side of things.
For MMD we are gonna set up a special wineprefix named WineMMD64, this will be a hidden folder in the home directory.
I have found a script online that does everything that is needed for MMD to run automatically. (credit to Ginga8) This one is slightly outdated with the latest winetricks and ubuntu builds. I have modified it to work with the latest winetricks and setup DXVK for us.
Download and extract my scripts using the following commands.
CD <Path to your MMD folder>
wget https://learnmmd.com/wp-content/uploads/2023/02/WineMMD64.zip
unzip WineMMD64.zip
chmod +x WineMMD64Setup
Now you can run it using the following command:
bash WineMMD64Setup
This might take a while depending on your internet speed.
If the installation fails you can delete the folders .WineMMD64 and mmdtemp in your home directory. and try again. (if you cannot see it, press ctrl+h to reveal hidden folders)
Sometimes Winetricks will fail downloading one of the required libraries. (you can try deleting the winetricks folder in /home/<username>/.cache this will have winetricks re-download all the files)
If the installation fails again, try to look for errors and search them online or ask in the comments below.
Step 6 download and set up MMD + MME
Once you have done the last step, we can finally download and set up MMD
You can download the latest versions from the Download page here on LearnMMD or the VPVP page (on the VPVP page, you want item 1.4) and the latest version of MME (v037 as of this writing).
- Use the unzip tool from earlier to unzip both archives. (this is to preserve the Japanese characters)
- put MMD into a folder of choice.
- Install MME as normal by putting the 3 DLL files in the same folder as MikuMikuDance.exe
- Put the MikuMikuDance file included in the archive downloaded before in the same folder as MikuMikuDance.exe
- Make it executable with the following command:
chmod +x MikuMikuDance
Step 7 Launching MMD and doing final fixes
Now that everything is set up to go, get ready to run it for the first time!
If you got the script from the last step you can run it from the terminal.
Go to your MMD folder in a terminal window and run:
bash MikuMikuDance
Alternatively you can start MMD with:
LANG=ja_JP.UTF-8 WINEPREFIX=~/.WineMMD64 wine MikuMikuDance.exe
Once you are in MMD you will see a garbled mess. This is an issue that is not on MMD’s end, it has to do with how Wine renders the window (I think)
If you get the following message:
This means MME could not start due to an error. Now this can mean many things.
When this happens MMD will crash afterwards.
I experienced this error for a while, these are some things to look for to fix this:
- Check if you got the proper GPU drivers installed.
- Check if your GPU Supports Vulkan/DXVK
- Delete the folder: ~/.WineMMD64 and the contents of the folder ~/.cache/winetricks/ Then run the script again.
- Try to install without DXVK, to do that hit CRTL-C when the script asks to press enter to install DXVK. Then delete the folder ~/mmdtemp.
- This can also be a problem on Wine’s end. To fix try the above to install without DXVK. This usually happens after Wine updates. Please let me know in the comments if this happens!
Fixing MMD
Now here is where the multi monitor setup I mentioned at the start comes in handy.
To fix the issues we have do the following:
- Go to the VIEW dropdown menu, select SEPARATE WINDOW. This will put your render window and controls on different windows. If you’ve got 2 monitors you can split them over 2 like I do.
- Open up the MME Effect mapping window, select the tool dropdown and click “Skip Device Validation” this is for compatibility issues with some effects. (Credit to petite philosophie)
- When it says MikuMikuDance.exe is not responding when loading files. Just let it wait, this may take a bit depending on what you are loading.
Here are some images: (Click on the images for the full size)
Here is how it looks on my system:
(Click image for full-size)
Summary
SO! here you go! Now you can run MikuMikuDance on Linux! Using Wine and DXVK we were able to set everything up.
My scripts will set up a special Wineprefix with all the required libraries installed. Have fun with MMD!
Known issues and notes
Nothing is perfect. What we are doing here is using a workaround, with several compatibility layers to run a Windows program on Linux. Like you have already seen, the render window of MMD is broken. You have to use separate screen to make it work. It is purely visual.
Some MME effects don’t like DXVK either. Although using DXVK has been able to make many effects like Raycast run much smoother. Yes Ray-MMD does run using this method. I haven’t tested many effects but most should run.
If you run into issues and you want to reinstall, Rename .WineMMD64 in your home directory to something else and re-run the script.
This guide does not work for PMXe! it required different libries setup
I want to know what does and doesn’t run, when it comes to models and effects. Put your experiences in the comments.
– SEE BELOW for MORE MMD TUTORIALS…
— — —
– _ — –
Hello!
I was able to run it using Bottles. I simply created a new “gaming” profile bottle and the default settings. I did however copy the MMD program folder into the “c:” drive of the bottle just in case. I was able to run MMD as if it was nothing.
The only caveat is that the fonts look terrible.
Congrats… that’s great news!
I wonder whether you have a performance issue with MME? Without MME, MMD works fine in Bottles without any issue. But with MME, the frame rate drops to a single digit.
You are traveling in unexplored territory… I’m sorry that I don’t have an answer for you.
— Reggie
how did you set it? i could also run it on bottles however mme does not work and i cannot drag and drop
I am sorry… I am unable to answer your questions. Please send me an email at [email protected] and remind me of your issue. I will reply with the email address of the author of that tutorial so that you can contact him directly.
Hmm… looks like the paste didn’t work as expected. Here’s a second try:
export STEAM_COMPAT_CLIENT_INSTALL_PATH=~/.steam/steam
export STEAM_COMPAT_DATA_PATH=~/.steam/steam/steamapps/compatdata/\
alias proton=~/.steam/steam/steamapps/common/Proton /proton
proton run whatever.exe
Ok so for the STEAM_COMPAT_DATA_PATH at the end of the path there is a directory which will contain the SteamID. So it should look something like
export STEAM_COMPAT_DATA_PATH=~/.steam/steam/steamapps/compatdata/1239475/
Putting less than, greater than was interpreted as html tags by this website.
Sorry, man… what?? … Running MMD on Steam… I have no experience with that.
— Reggie
Hi!
I know a better way (and easy) to install MMD on linux using bottles.
I can do a tutorial or something like that :D
(but I don’t know how to do for MME work on linux, I’m still trying)
I’m working to do the same with PMXE :3
Hello… interesting! I will send you and email at the address you have used.
— Reggie
hii, so i’m trying to use it, and i don’t have the “separate window” option in the “view” menu? does anyone know why?
You’re talking about MMD main menu, right? It should be in the second line of “view”, between “screen size” and “to the fore”. Are you sure you’re looking in the right place?
Hello are you still here? I’m having some problems, I still can’t get mme to run on mmd 64 bit.
Next, when loading the .pmx file, the texture model is not readable (only displays white and bone), however that is the model if it exists in .pmx it will be like that, the pmd file runs normally and the texture can be loaded. This affects the use of Raycast, because some files from Raycast are .pmx (PMX models can display textures in PMXE and PocketMQO mobile applications, so the problem is not from the model)
Please help. and sorry if the grammar is bad, I use Google Translator
I AM still here! “:o).
You say you cannot get MME to run on 64-bit. Raycast requires 64-bit to run properly.
You say “when loading a PMX file…” do ALL PMX models have that issue?
— Reggie
I tried changing the render settings in regedit. Changed OffscreenRenderingMode from fbo to backbuffer. And that fixed the broken window rendering problem. But now another problem arises, when rendering avi videos the model part gets cut off
You are breaking new ground with every step you take… Awesome!
Thank you for your reporting, I am sorry that I cannot help you!
— Reggie
i was that one peep that in 2021 asked if this supported pmxe too. still hoping that one day there will be support on that part toom it would be pretty sweet.
Yes… … we can only wait to see if that is developed.
pmxe can run on linux. I tried running it using virgl instead of dxvk, because my device doesn’t support it.
Thank you for this tutorial! MMD and effects works fine for me (Arch Linux). I have one problem: I can’t render videos at all. Saving pictures is working but when i try to render video it gives me error about file writer. I don’t know what I’m missing
I solved it! So, i manually installed vcredist and found out that i was stuck at installing “quartz” (command wine64 regsvr32 /S quartz.dll gave status 5). Through some digging on Internet i find that devenum.dll caused it. Quartz needs 32 AND 64bit devenum, but devenum is installing only 32 bit version (there’s solution: https://github.com/Winetricks/winetricks/issues/1263#issuecomment-587971449 ). I got file, replaced it in “system32” folder, and command works fine. Also I changed “./winetricks” to “winetricks” because first one doesn’t work for me. Last thing, I deleted MMPlus, it also caused my problem. 32bit MMD immidiately crashes, maybe i just need to change WINEPREFIX to 32 bit, but 64 bit version works fine, effects too (tested Ray-MMD and some simple effects). System Info if need: Linux 5.13.4-arch1-1 x86_64 | Wine 6.13. Maybe this will be useful for someone. Again thank you for this tutorial and sorry for disturbing.
Hey… that’s great! … Thank you for all of that good info… like you said: I hope other users find it helpful.
— Reggie
I am going to test out if everything is still ok. Wine update tend to break things. I will update the post if needed.
ok so after testing MMD is artifacting all over the place when I try to render to AVI. and I edited my script so it pauses each step to kinda debug things. Seems like this could be related. Thank you for posting it. I might have to find a way to implement it before it sets it up. Winetricks puts out an error with missing DLL devenum.dll. I have an install CD of Windows XP X64 which I can use to extract the DLL from. but I am ofc not allowed to redistribute it I believe. Hence why I use an install script. so I do not have to redistribute any microsoft DLL’s etc.
I have updated the script and such so quartz will install. the script will always use latest winetricks.
Not sure about the error since I do not have a system with arch. However I ran into similar issues as well. I have now updated the install script that it should install the required DLL correctly.
So mmd works! It is just missing the Latin font (not the Japanese)
Any clues?
I use Ubuntu 21.04 and have also tried 20.04
so instead of using the script i used winetricks with winehq 6.12 devel and just installed all the fonts with ms in front. This guide should be updated to use a wine preset instead of a script.
so instead of using the script i used winetricks with winehq 6.12 devel and just installed all the “MS” fonts. This guide should be updated to use a wine preset instead of a script.
Thnak you for your input! … much appreciated! … I am adding your note into the text of the article so as to help future readers… Thanks!
— Reggie
I added your note to the article… Please take a look and let me know if I have put it in the right place… or if there is a better location for that note… Thank you!
Thank you for the notice, I will test this myself and I will update accordingly. Give me a couple of days to do so.
Thanks I will update everything accordingly. I will do some testing of my own and I will update the post in due time.
I tried this with a wineprefix, however using a pre-set up prefix broke after an update of wine. this was fixed by deleting it and setting it up again. Thank you for your comment regarding the fonts btw. I will add it to the script and test it. I still run MMD in japanese to fix broken filenames. but I will tinker around thank you!
It’s possible to have this working for get PMXE on Linux. Tried to set up that, but it keeps saying me that Direct3D can’t be loaded.
I have forwarded all of your comments about Linux / PMXe to Parkeerwacht (the author)… I hope he is able to get back to you with some answers.
it can, the original script had support for it. however I never could get that part to work. I will look around, maybe I can figure it out. I might make a seperate post for it. for now PMXe is not supported sadly. but once I get the chance I will work on it.
It’s possible to get PMXE working on Linux like this? I’m trying to make it work, but it doesn’t load the plugins + the 3D view.
Now, I wonder if it’s possible to run PMXE in Linux via WINE. I can open it, but the 3D window doesn’t open.
What are the 3 dll files you need to put in the same folder as the .exe??? The linked page it just to the download of MMD
The link is there… Here it is, again… when you “arrive”, scroll down just a couple of inches and see the links to download MME and MMEx64.