XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Wed Aug 16, 2017 11:03 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: 3D model reversing compilation
PostPosted: Fri Jan 13, 2012 12:31 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 13, 2004 1:55 am
Posts: 703
Location: The wiki.
Has thanked: 107 times
Have thanks: 122 times

There's no format for the wiki that's set in stone, really, but you can get a good idea of what we're generally going for by looking at some existing pages.

Each format should have its own page - if a game has its own audio, 3D model, and archive format, for example, each of those should be documented on a separate page.

Naming is something I've been struggling with, and I keep coming back to one basic strategy: use the extension the format uses, followed by the name of the game in parentheses (e.g. if the game "Skis on Wiis" had a custom image format that used the extension "swg", the article would be named something like "swg (Skis on Wiis)"). This isn't perfect - there are exceptions that have to be dealt with - but in general, I think it *should* work.

You can make the ads go away by registering


_________________
Welcome to Xentax!

Rules | Requests | Wiki

If you run across a post that breaks the rules, please PM Craptain, Mr.Mouse, or myself - we will handle it from there.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Fri Jan 13, 2012 12:49 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
I like grouping it by game title and following the subpage structure for article names.

ie:

MyGame/Archive
MyGame/Model
MyGame/Sound
MyGame/Image

Of course a single game could have multiple archive formats, or multiple model formats, etc but that could be handled as well.
This makes it easier to link articles together, and especially if subpaging were available, you could just use relative links to refer to each article rather than an absolute link.

_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Fri Jan 13, 2012 5:24 pm 
Offline
advanced

Joined: Thu Jan 14, 2010 4:38 pm
Posts: 76
Has thanked: 1 time
Have thanks: 3 times
finale00 wrote:
lol 3Dmax costs $3500 for a license!!! :[

Noesis it is.

Yes, and student licenses are free :wink: I'd say the majority of people that have max tend to have those these days. Since autodesk finally realised that the best way to get people in industry to use max and mostly max is to have it accessible from the ground up.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 15, 2012 12:23 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
Hmm, what are some ways to learn how to do the stuff.

I guess simple ones are

1: familiarizing themselves with the API. Always useful....and one reason why I don't recommend blender for this because it's a little hard to separate the rendering from the parsing. Doesn't matter if I can write a parser for it or not, I simply can't figure out what functions to call to get the stuff into blender properly :(

2: writing import scripts for formats that already have existing importers. Some people think that they should only work on formats that haven't been done before and that it's a waste of time to work on something that's already been done. Well we've all probably written a "hello world" program at some point in our lives....

3: expand knowledge about 3D. More you know, better idea of what's going on. I'm lazy so my knowledge of 3D is pretty much at a stand-still.

_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 15, 2012 9:18 am 
Offline
Banned

Joined: Sun Apr 10, 2011 5:30 pm
Posts: 95
Has thanked: 0 time
Have thanks: 14 times
I could write a tutorial for Blender, specifically targeted at importers. The API has a lot of functions which are junk to us.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 15, 2012 7:20 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
Tutorial for blender would be great.
I just want to be able to map textures!

_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 15, 2012 9:27 pm 
Offline
Banned

Joined: Sun Apr 10, 2011 5:30 pm
Posts: 95
Has thanked: 0 time
Have thanks: 14 times
I wondering if we could add it to a wiki. It's a specific tutorial for people writing importers/exporters.

Got something for a start:
Quote:
BLENDER PYTHON FOR AN IMPORTER/EXPORTER WRITER

This document is meant for Blender importer/exporter writers.
It explains all you need to know: how to create a mesh, add it to an object, add vertices, faces, vertex colors, UVs, normals, create and assign materials and textures to vertex groups, create bones, assign bones to vertices and add bone weights.

Blender is a powerful 3d modeller. Blender is a great choice if you want to write an importer/exporter as anyone can use your script because the program is completely free, unlike very expensive tools like Max and Maya. In fact users of these expensive tools shouldn't complain, because they can just reexport the data from Blender to a format their own program understands, something which Blender users can't do with Max/Maya scripts without paying. And doing that will require only basic understanding of the Blender GUI.

However Blender scripts are comparably more difficult to write than Max/Maya scripts, especially if you have no experience in programming. The main reason is Blender uses an actual general-purpose programming language called “Python”. What “general-purpose” means is that the language can be used to write any kind of program, from web applications to video games, unlike MaxScript and MEL, which are only used by and inside these 3d modellers. The good news is Python is a very simple language compared to other general-purpose programming languages like C++.

Frankly we don't even need to understand most of Python and most of Blender's Python library to be able to write an importer/exporter.

Firstly, you'll need to learn some Python. Make sure you understand “variables”, “functions”, “lists/tuples”, “dictionaries” and have at least some idea of “classes”.
This is a good tutorial: http://www.swaroopch.com/notes/Python

Next all is left to do is to learn the needed functions and classes of Blender's Python library (“library” means collection of modules).
A full list is available here:
B2.4: http://www.blender.org/documentation/249PythonDoc/
B2.5+: http://www.blender.org/documentation/bl ... pi_2_61_2/

These are full lists of classes and functions you can use. You don't need to be a programmer to use a computer, the same way you don't need to know more than 5% of these to create an importer/exporter.

As you noticed there are two links, one for Blender 2.4, one for Blender 2.5 and above. The reason is everything was rewritten in Blender 2.5, including the Python library. 2.4 is quickly becoming deprecated, so you should go with Blender 2.5. This tutorial will list the commands for both of them, though.

Also note that Blender 2.4 uses Python 2, Blender 2.5 and above use Python 3. These languages are almost the same, but do some things differently. The main differences are:
“print” statement doesn't exist in Python 3, only print() function
“xrange()” doesn't exist in Python 3, “range()” does the same
strings are handled differently

For both you will need to import and use the module “struct”. “struct” is a module for converting data read from file to the needed type, like integer, short, long or float.

So let's begin. We will start with explaining the functions and classes of Blender 2.5+ which we need, then we will explain the equivalent Blender 2.4 functions and classes in a separate section.

Blender 2.5+

Creating vertices, edges, faces.
The usual way to create vertices, edges and faces is creating lists of vertex positions, list of edge indexes and list of face indexes and passing them as arguments to the function mesh.from_pydata() . Note that you can pass empty lists for edges and faces if you want.
As you see, from_pydata() is a method (method - function belonging to class) of the Mesh class. So you'll need to make a Mesh object (object - instance of Mesh class first). If these terms (“ method”. “class”, “object”, “instance”) confuse you, then you should probably learn some more on classes in Python.

Example:

vertices = [[x, y, z], [x, y, z], [x,y,z], [x,y,z]] # replace “x,y,z” with actual numbers
faces = [[0,1,2], [3,4,5], [6,7,8], [9,10,11]]


mesh = bpy.data.meshes.new('name')
mesh.from_pydata(vertices, [], faces) # [] is in place of edges, is an empty list


The first two lines create Python lists. vertices list contains sublists with 3 numbers, which will be used as x,y,z positions for the vertices. faces list is a collection of indexes, which tells how the vertices in the first list will connect and create triangles.
The 3rd line creates a Mesh and third adds vertices and faces to the Mesh from the data we have in our lists.

Like anything else in Blender (like Lights, Curves and Armatures), Meshes need to be assigned to “Objects”. Objects are like nodes. Everything in the 3d scene of Blender are Objects. However the Objects can contain different things, one can contain a Mesh, the other a Light. This allows everything in the 3d scene to the treated the same way, like a Light can be moved around the same way as a Mesh.

So to actually see your Mesh you'll need to create a new Object, assign the Mesh to it and add (“link”) the Object to the scene:

mesh = bpy.data.meshes.new('name') # again
object = bpy.data.objects.new('name', mesh)
bpy.context.scene.objects.link(object) # link object to scene


And you should be able to see your Mesh, unless you used some odd values for your vertices and faces lists (even then you should at least see a dot which is the pivot of the Object.

Vertex colors
To assign vertex colors, you will need to create a “VertexColor layer” for you mesh, then loop through your faces and add the colors to all vertices of each face, like this:

mesh.vertex_colors.new(name = 'VertexColor')
index = 0
for face in mesh.vertex_colors[0].data:
face.color1 = colors[index]
face.color2 = colors[index + 1]
face.color3 = colors[index + 2]
index += 3


Where colors is a list of sublists containing RGB colors, like so:

colors = [[R,B,G],[R,G,B],[R,G,B]]

Note that colors in Blender are float numbers in the range (0.0, 1.0). if you have an integer in the range (0, 255), just divide your number by 255.

TODO


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 15, 2012 10:06 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
http://wiki.xentax.com/index.php/Blender_Import_Guide

? :D

Just choose an appropriate title.

_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Thu Jan 19, 2012 1:02 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 13, 2004 1:55 am
Posts: 703
Location: The wiki.
Has thanked: 107 times
Have thanks: 122 times
finale00 wrote:
I like grouping it by game title and following the subpage structure for article names.

ie:

MyGame/Archive
MyGame/Model
MyGame/Sound
MyGame/Image

Of course a single game could have multiple archive formats, or multiple model formats, etc but that could be handled as well.
This makes it easier to link articles together, and especially if subpaging were available, you could just use relative links to refer to each article rather than an absolute link.

Some formats are shared between games, though (this is especially common between different games in a series, or games that use the same engine). The format itself should come first, and the game should be a distant second, used only as needed, when naming and disambiguating format pages.

_________________
Welcome to Xentax!

Rules | Requests | Wiki

If you run across a post that breaks the rules, please PM Craptain, Mr.Mouse, or myself - we will handle it from there.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Thu Jan 19, 2012 6:22 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
Yes, that's always been one of the major criticisms of subpaging schemes; what if multiple articles just happen to share the same content? Do we subpage under this article? or that article? Let's just not bother at all!

Obviously, redundancy is bad, so the last time I was like "how about let's just duplicate stuff" it was shot down quickly.
In the end there was never a resolution to it.

I'll see how I can fit the articles into the ext (game/engine) format.

For disambiguation, ya, it'd be pretty easy to say "did you mean, for this game?"

How about this scenario:
someone creates an article for "mdl" format. Common model extension used in hundreds of games.
Some weeks later, someone else decides to create an article for another game with the same extension.

Would the original "mdl" be renamed to "mdl (game)" in order to be consistent?

_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Thu Jan 19, 2012 10:07 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 13, 2004 1:55 am
Posts: 703
Location: The wiki.
Has thanked: 107 times
Have thanks: 122 times
Actually, pages that are just named after extensions are meant to be disambiguation pages for all formats known to use that extension, e.g. PAK. Generally speaking, a page dedicated to a single format should never be named with just the extension.

I really didn't word my previous comment as well as I should have. If a format is known to have an "official" name (e.g. if there are published specifications in which it's clearly named, such as BMP, or it's widely known with a certain name, e.g. RAR), that's the name we want to go with, otherwise we just work through the following list until we find one that works: name of engine, name of developer, name of first game known to use the format, name of game we're looking at that uses the format.

_________________
Welcome to Xentax!

Rules | Requests | Wiki

If you run across a post that breaks the rules, please PM Craptain, Mr.Mouse, or myself - we will handle it from there.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Sun Jan 29, 2012 5:59 pm 
Offline
n00b

Joined: Sun Jan 29, 2012 5:54 pm
Posts: 17
Has thanked: 0 time
Have thanks: 7 times
OK, I wrote the Blender Import Guide: http://wiki.xentax.com/index.php/Blender_Import_Guide
Few things are missing, add them if you can.

@mods: next time you ban someones account because it's listed in bugmenot.com, do us a favor and check that it actually works, will ya!?
Seems like someone likes me...


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Mon Jan 30, 2012 5:59 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 13, 2004 1:55 am
Posts: 703
Location: The wiki.
Has thanked: 107 times
Have thanks: 122 times
gjinka2 wrote:
@mods: next time you ban someones account because it's listed in bugmenot.com, do us a favor and check that it actually works, will ya!?
Seems like someone likes me...


You're gonna have to be more specific than that; are you referring to a block I did on the wiki? Because all of those were bot accounts that posted spamming gibberish on their own userpages.

_________________
Welcome to Xentax!

Rules | Requests | Wiki

If you run across a post that breaks the rules, please PM Craptain, Mr.Mouse, or myself - we will handle it from there.


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Mon Jan 30, 2012 3:40 pm 
Offline
n00b

Joined: Sun Jan 29, 2012 5:54 pm
Posts: 17
Has thanked: 0 time
Have thanks: 7 times
I mean the forum

http://www.bugmenot.com/


Top
 Profile  
 
 Post subject: Re: 3D model reversing compilation
PostPosted: Mon Jan 30, 2012 4:34 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran

Joined: Sat Apr 09, 2011 1:22 am
Posts: 2387
Has thanked: 170 times
Have thanks: 277 times
Good tutorial.
Maybe now I can actually finish writing my blender importer.

Something else I've been wanting to do: put my python 3D converter on google app engine. Since it's written in pure python it would be a great candidate for resource hogging.

And then while I'm at it, figure out HTML5's 3D rendering capabilities and put it there as well.
har har

I didn't know people posted forum accounts on bugmenot. Especially when registration is unrestricted.


_________________
Model Import Plugins/Scripts

Noesis Plugins | Reference files

Reference
Guide to 3D model reversal | 3D glossary


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group