Welcome to the Forum Archive!

Years of conversation fill a ton of digital pages, and we've kept all of it accessible to browse or copy over. Whether you're looking for reveal articles for older champions, or the first time that Rammus rolled into an "OK" thread, or anything in between, you can find it here. When you're finished, check out the boards to join in the latest League of Legends discussions.

GO TO BOARDS


lol2obj official release + source code.

123
Comment below rating threshold, click here to show it.

renticletape

Senior Member

08-23-2009

I have released this utility in a thread from a while back but since then I fixed a few issues and decided to make a thread for its release.

What is lol2obj? Basically this is a command line utility for windows that allows you to convert the .sco models from League of Legends (located in the "League of Legends\Game\HeroPak_client\DATA\Characters" directory) into a .obj model which can be viewed in most 3d modeling applications.

How to use lol2obj:
There are 2 ways of using this utility. The easy way is to simply drag and drop the .sco file onto the exe file and the application will spit out a .obj file. For those who don't like user friendliness, you can use the command prompt to run this application. Just type in lol2obj_v1.0.exe <input file> <outputfile> in the command prompt. Without the "< >" of course.

DO NOT DISTRIBUTE ANYTHING YOU HAVE CONVERTED OUTSIDE OF THESE FORUMS AS IT WILL VIOLATE THE NDA FOR THE BETA.

If you have any issues, please post what the error is and what caused it. This application doesn't do any file format checking, so if you throw in a file that is not a valid .sco model, its likely to crash or stop responding.

Also, for anyone interested in how this works or how to parse the .sco format, here is the c++ source code:
[code]
//LoL2Obj by renticletape
//Converts the LoL's .sco model format into the .obj model format
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<sstream>
using namespace std;

struct vector3 {
float x,y,z;
};
struct vector2 {
float x,y,z;
};
struct face {
vector<int> index;
};


int main(int argc, char* argv[]) {
ifstream fin; //file input stream
ofstream fout; //file output stream
int vertcount; //number of vertecies
int facecount; //number of faces

if (argc < 2) {
cout << "error: no input files\n";
exit(1);
}

fin.open(argv[1]); //open the first arguement from the command line
if (fin.fail()) {
cout << "error: failed to read: " << argv[1];
exit(1);
}
if (argc == 2) {
fout.open(string(string(argv[1]) + string(".obj&quot).c_str());
} else {
fout.open(argv[2]);
}
if (fout.fail()) {
cout << "Failed to open the output file\n";
exit(1);
}
while(!fin.eof()) {
string line;
stringstream ss;
string tmp;

getline(fin,line);
ss << line;
ss >> tmp;
if (tmp == "Verts=&quot {
//read in the vertecies
ss >> vertcount;
for (int i = 0; i < vertcount; i++) {
vector3 vtx;
fin >> vtx.x >> vtx.y >> vtx.z;
//output the verts in the obj format
fout << "v " << vtx.x << " " << vtx.y << " " << vtx.z << "\n";
}
cout << "read " << vertcount << " vertecies" << "\n";
}
if (tmp == "Faces=&quot {
int vtc = 1; //vertex counter, set initially to 1 because the obj format starts at 1 for indexing
ss >> facecount;

for (int i = 0; i < facecount; i++) {
face f;
int facesize; //number of verts per face
fin >> facesize;
for (int j = 0; j < facesize; j++) {
int v;
fin >> v;
f.index.push_back(v);
}
fin >> tmp;
for (int j = 0; j < facesize; j++) {
//read in the UV coordinates
vector2 vt;
fin >> vt.x >> vt.y;
fout << "vt " << vt.x << " " << 1.0 - vt.y << "\n";

}
fout << "f ";
for (int j = 0; j < (int)f.index.size(); j++) {
fout << f.index[j] + 1 << "/" << vtc << " ";
vtc ++;
}
fout << "\n";
getline(fin,tmp);
}
cout << "read " << facecount << " faces" << "\n";
}
}
}
[/code]


Comment below rating threshold, click here to show it.

Larias

Adjudicator

08-23-2009

This is pretty cool


Comment below rating threshold, click here to show it.

HappyNihil

Member

08-23-2009

Ok, redirecting to this thread in my tutorial.
Thx for the app.


Comment below rating threshold, click here to show it.

stmiki

Member

08-23-2009

Wow pro c++ coder join my h4x balkan team plz


Comment below rating threshold, click here to show it.

SunKyu

Senior Member

03-08-2010

When I launch the file, it shows a cmd.exe box and then it closes liek a millisecond later. I can't do anything to fix it. Anyone help?


Comment below rating threshold, click here to show it.

boni

Senior Member

03-08-2010

Quote:
SunKyu:
When I launch the file, it shows a cmd.exe box and then it closes liek a millisecond later. I can't do anything to fix it. Anyone help?

if (argc < 2) {
cout << "error: no input files\n";
exit(1);
}


Comment below rating threshold, click here to show it.

SunKyu

Senior Member

03-08-2010

Quote:
boni:
if (argc < 2) {
cout << "error: no input files\n";
exit(1);
}


What exactly is agrc?


Comment below rating threshold, click here to show it.

SunKyu

Senior Member

03-08-2010

Help?!


Comment below rating threshold, click here to show it.

Struz

Senior Member

03-08-2010

Way to necro this thread lol. This is from months and months ago.

Read the instructions given and all will be fine. Basically, don't just click the **** file! Oh and not that it makes much difference to you but argc is the number of command line arguments given to the executable.


Comment below rating threshold, click here to show it.

Necrax

Senior Member

03-08-2010

Quote:
SunKyu:
When I launch the file, it shows a cmd.exe box and then it closes liek a millisecond later. I can't do anything to fix it. Anyone help?


launch a command prompt first and and then start the application.

Start -> Run... -> Type cmd.


123