- Joined
- Dec 13, 2018
- Messages
- 2,368
Not sure if you already knew this, but you can convert wow models from .obj to .mdx in an instant using Retera's model studio. Retera's model studio will also automatically convert the textures from .png to .blp.
(3 ratings)
#include<windows.h>
#include<vector>
#include<fstream>
#include<string>
#include<iostream>
#include<cstdio>
#include<cstdlib>
using std::system;
using std::cin;
using std::cout;
using std::endl;
using std::getline;
using std::ifstream;
using std::ofstream;
using std::string;
using std::ios;
bool unshaded = false;
void Help()
{
cout<< "Welcome to WoWtoWC3conv v.1.2\n"
<< "This tool was made by Maldiran, but the core jM2converter was made by Koward. It also uses MdlVis and Mdlx converter.\n\n"
<< "To convert .m2 models to .mdx you should:\n"
<< " 1.Open Command Prompt (by clicking 'Enter' now or by clicking 'Windows'+'R' and typing 'cmd')\n"
<< " 2.Drag my program to the console window, type 'space';\n"
<< " 3.Drag your .m2 model to the console window, type 'space';\n"
<< " 4.Write your new texture name (for example texture1.blp, the model will have basic texture textures/texture1.blp);\n"
<< " 5.Click enter or, if you want to convert more models, type 'space' and repeat steps 3 and 4.\n"
<< " Example command: path/WoWtoWC3converter.exe path/model1.m2 texture1.blp path/model2.m2 texture2.blp\n\n"
<< "If you aren't convering gear, than texture from point 4 will not apply (probably), but you still need to type its name;\n"
<< "If you want your new model/s to be unshaded (whole model), than at the end of line type 'true', example command:\n"
<< " path/WoWtoWC3converter.exe path/model1.m2 texture1.blp path/model2.m2 texture2.blp true\n"
<< "In this case both model1 and model2 will be unshaded.\n\n\n"
<< "To exit help window and open Command Prompt hit 'Enter'\n";
getchar();
}
void DeleteMD21(string inputfile)
{
ifstream save(inputfile, ios::app | ios::binary);
string line;
getline(save, line);
if (line.length() < 9)
{
string tem;
getline(save, tem);
line += tem;
}
if (line[3] == '1')
{
ofstream saves("temp.m2", ios::binary);
if (line[8] == 'D')
saves << 'M';
if (line[8] == '2')
saves << "MD";
if (line[8] == '1')
saves << "MD2";
for (int i = 8; i < line.length(); i++)
saves << line[i];
while (getline(save, line))
{
saves <<endl<< line;
}
saves.close();
save.close();
remove(inputfile.c_str());
rename("temp.m2", inputfile.c_str());
}
else { cout << "Not an MD21" << endl; save.close(); }
}
void Mdlchange(string inputfile, string image)
{
ifstream save(inputfile, ios::app);
ofstream saves("temp.mdl");
string line;
bool istextures = false;
bool willtextures = true;
bool ismaterials = true;
bool willunshaded = unshaded;
while (getline(save, line))
{
if (willtextures) { if (line.substr(0, 8) == "Textures") willtextures = false; istextures = true; }
else
{
if (istextures)
{
if (line == " Bitmap {")
{
getline(save, line);
if (line == " Image \"\",")
{
while (getline(save, line))
{
if (line == " }") { line.erase(); break; }
line.erase();
}
}
else saves << " Bitmap {" << endl;
}
if (line == " Image \"Cape.blp\",") line = " Image \"textures\\" + image + "\",";
if (line[0] == '}') istextures = false;
}
else
{
if (willunshaded)
{
if (line.substr(0, 9) == "Materials") ismaterials = true;
if (ismaterials)
{
if (line.substr(0, 13) == " FilterMode")
{
saves << line << endl;
getline(save, line);
if (line != " Unshaded,")
saves << " Unshaded," << endl;
}
if (line[0] == '}') willunshaded = false;
}
}
}
}
saves << line << endl;
}
saves.close();
save.close();
remove(inputfile.c_str());
rename("temp.mdl", inputfile.c_str());
}
int main(int argc, char* argv[])
{
if (argc == 1)
{
Help();
system("cmd");
return 0;
}
int k = 0;
string unsh = argv[argc - 1];
if (argc == 2)
{
if (unsh == "help")
{
Help();
return 0;
}
}
if (unsh == "true")
{
unshaded = true;
k++;
}
int j = 1;
string path = argv[0];
while (true)
{
if ((path.substr(path.size()-4, path.size())) == ".exe")
break;
path += ' ' + argv[j];
j++;
}
while (true)
{
if ((path[path.size() - 1] == '\\') || (path[path.size() - 1] == '/'))
break;
path = path.substr(0, path.size() - 1);
}
for (int i = j; i < argc - k; i += 2)
{
string temp = argv[i];
string text = argv[i + 1];
cout << text << endl;
cout << temp << endl << " {" << endl;
DeleteMD21(temp);
string command = "java -jar \"" + path + "subapps\\jM2converter.jar\" -in \"" + temp + "\" -out \"" + temp + "\" -bc";
system(command.c_str());
string isdone;
command = "\"\"" + path + "mdlvis\\MdlVis.exe\" \"" + temp + "\"\"";
cout << endl << "Now it is time to canonize model. In opened mdlvis click 'K' and 'Cltr+S' then close mdlvis and type 'done'." << endl;
system(command.c_str());
while (true)
{
cin >> isdone;
if (isdone == "done") break;
}
temp = temp.substr(0, temp.size() - 2);
command = "\"\"" + path + "subapps\\MdlxConverterEdited.exe\" \"" + temp + "mdx\"\"";
system(command.c_str());
remove((temp + "mdx").c_str());
Mdlchange((temp + "mdl"), text);
command = "\"\"" + path + "subapps\\MdlxConverterEdited.exe\" \"" + temp + "mdl\"\"";
system(command.c_str());
remove((temp + "mdl").c_str());
cout << '}' << endl << endl;
}
cout << endl << "Done" << endl;
return 0;
}
Some models will be automatically rescaled by Retera's model studio.I knew, but .obj WoW models are not scaling properly. If you are going to use them with character models, it will be really painful.
So does Retera's model studio.it automatically changes texture name. It also maintains geosets divided like in original WoW models.
This is indeed interesting. Are you saying animations for all models will also be automatically applied when you convert models using your tool?And above this - animations. You can convert for example horse model via .obj, but you will lose all animations. Using this, you are converted the WoW model as it is, without changing anything (except particle emitters, but wc3 simply doesn't recognize them properly).
Animation names can be changed randomly, but animations should be intact. The only bugs might be present when vertex is attached to too many bones, but this is - again - Warcraft 3 problem.This is indeed interesting. Are you saying animations for all models will also be automatically applied when you convert models using your tool?
I see. I don't need the model now, I was just trying random models.If the model is using more than one texture, than the texture is renamed to textures/xxxx.blp. If you are converting larger model, then you have to manually choose the correct texture, because app doesn't recognize where should it go. When you are converting models like items than this is not a problem.
With replaceable ID 0 I will deal tomorrow, I will simply delete all of them.
EDIT: 1. Ok, I know what happened in first video. I will fix it tomorrow. If you want this model now, than open freshly exported model with notepad and delete first 8 bytes. So, It should look like MD21xxxxMD20xxxx and make it MD20xx (normal notepad may not read all characters correctly, I prefer notepad++)
2. Simply too complicated model to assign all textures.
And by the way, you don't have to name your texture "texture1.blp", it can be whatever you want. I have used it as an example in tutorial.
The CMD should output an error message.I think I broke it.
No, character models cannot be ripped as well as another bigger models. This is caused because of their vertices numbers. The max number in Warcraft models is around 21000 if I remember correctly. Character models and other big models (like K'thir one) are unportable without use of Blender.Some, rare models require .anims files that don't exist. It is caused by a bug in jM2 converter. To omitte this, we simply need to create dummy animation files. That's why I have made 'dummyanims.exe'. Open Windows Command Processor, drag 'dummyanims.exe', click 'space', drag your model. Now you can click 'Enter' or drag additional models.
Remember! This app creates ~5000 new files in model's directory. You should delete them after conversion.
Hmm Retera's model studio can convert even the biggest .wmo models without any use of Blender. Take this model for example, I am sure it has got well over 100k vertices;No, character models cannot be ripped as well as another bigger models. This is caused because of their vertices numbers. The max number for Warcraft models is around 21000 if I remember correctly. Character models and other big models (like K'thir one) are unportable without use of Blender.
Ok, there are two options.
Remember to replace the dummy files with orginal .anim files you have exported or you will have no animations.Some, rare models require .anims files that don't exist. It is caused by a bug in jM2 converter. To omitte this, we simply need to create dummy animation files. That's why I have made 'dummyanims.exe'. Open Windows Command Processor, drag 'dummyanims.exe', click 'space', drag your model. Now you can click 'Enter' or drag additional models.
Remember! This app creates ~5000 new files in model's directory. You should delete them after conversion.
Since it relies on good old jM2converter, than no, it's not possible for now. But I can think about merging .skin with .m2 and then converting it. I don't know if it is possible at all, but I will check.This looks promising , can you convert models containing .skel file ?
If not , is there any possibility to make it happen?
Basically jm2converter retroports WoW files into old expansion file. For example people retroport it into Burning Crusade file format, by doing that allows MDLVIS to open BurningCrusade files. So the key might be MDLVIS old Burning Crusade M2 opening.View attachment 378451
Ideologically, does anybody on friggin Planet Earth have the jm2converter source code? It's java so you could literally upgrade the source and include it in Retera Model's Studio as some kind of incorporated plugin or part of RMS.
Above is a GIF of a version of Retera Model Studio that I hacked together some day back in January or whenever. Someone sent me a build of WoW, like some alpha or something, that was so old that all the models were in the MDX format version 1300 (much closer to WC3 format than the release clients of WoW, I think?)
And so it was a single day's work with that particular MPQ that they sent me to make an RMS that could just link against WoW instead of WC3 as the game data source, and then you can click any model and the save code isn't changed so it just saves Warcraft III MDX files.
What is the reason that programmers do not pursue this kind of paradigm where you can just open WoW models and save to WC3 instead of going through like 3 different binary black box tools? In my one day of working, making the RMS that would load these WoW models was as simple as reading the online documentation of the WoW format
And, of course, as shown in this picture I did not bother getting a BLP2 parser, but surely that is well-documented as well.
Still not sure how to do it, I can't export the animation of the raptor.
- Run dummyanims.exe
- Delete .anims with identical names as original files.
- Paste original files
- Convert the model in normal way
- Delete unnecessary.anim files
Yepp, same for me! IT looked pretty promising but just wont work!it says I couldn't find VCRUNTIME140D.DLL MSVCP140D.DLL ucrtbased.dll
Same question. Can anyone help please?I don't know if this thread is still active, but when I run the program I get the error "0x000007b". and nothing is executed. Is there a solution?
from step 7Same question. Can anyone help please?
Tried just now, it doesn't work. It looks like that error with the application itself. Though, I have Java and Microsoft Visual Redistributable installed. Also, this step in the link, as I understand it, speaks about fixing the model in WoD format from the Legion format, and I am trying to convert the old taunok model from the early WotLK archive.from step 7
Rip models from WoW into Warcraft 3
1.Introduction Hey guys! Since the release of the WC3 Reforged many people were asking, if it is possible to rip for example character models and make them work in Warcraft 3. The answer is: yes! Some time ago, there was forum named Warcraft Underground, where such models were posted, but now it...www.hiveworkshop.com
"""you need to delete first 7 bytes not 8"""
When you use "wow.export.exe," you have to run the CMD command immediately, and above all, don't move the textures or models so the conversion doesn't fail.Tried just now, it doesn't work. It looks like that error with the application itself. Though, I have Java and Microsoft Visual Redistributable installed. Also, this step in the link, as I understand it, speaks about fixing the model in WoD format from the Legion format, and I am trying to convert the old taunok model from the early WotLK archive.
I've extracted taunka models through Ladik's MPQ, due wow.export cannot read WotLK client. Maybe it somehow affects the result?When you use "wow.export.exe," you have to run the CMD command immediately, and above all, don't move the textures or models so the conversion doesn't fail.
Or at least that's how it did in my case.