Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Extracting simple models

Read or post any tutorial related to file format analysis for modding purposes.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

from "r_eye" and "l_eye" it looks to me as if it were a skeleton file with matrices.
(too busy to care for now)
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
eri619
veteran
Posts: 80
Joined: Wed May 16, 2012 6:36 am
Location: India
Has thanked: 11 times
Been thanked: 2 times
Contact:

Re: Extracting simple models

Post by eri619 »

shakotay2 wrote:from "r_eye" and "l_eye" it looks to me as if it were a skeleton file with matrices.
(too busy to care for now)
They are armature/skeleton

Mesh details comes after that.
eatrawmeat391
beginner
Posts: 20
Joined: Tue Dec 06, 2016 10:51 am
Has thanked: 8 times
Been thanked: 9 times

Re: Extracting simple models

Post by eatrawmeat391 »

Hi Shakotay, I coded a script to extract the obj from a model file.Problem is,the output obj (02_test.obj)'s position in space is different from the right obj(which is object0.obj) when preview with a 3D tool.Do you know why this happen and what can I do to fix it?
You do not have the required permissions to view the files attached to this post.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

looks like y and z are swapped
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
eatrawmeat391
beginner
Posts: 20
Joined: Tue Dec 06, 2016 10:51 am
Has thanked: 8 times
Been thanked: 9 times

Re: Extracting simple models

Post by eatrawmeat391 »

shakotay2 wrote:looks like y and z are swapped
I see
In an obj file there are 3 sections : v: vertex position, vn: normals, vt: uv
Can you tell me what section affects the y and the z(and the x) coordinate in space of an object?

Edit: When I don't export the normal,the position change when viewing with Online 3D Viewer(my obj got the normal data from the file ).And Blender generated the normal as well,which is saved in that correct file.So every 3D tool generates normal differently I guess

I wrote a function that does the rotation (given x,y,z and degree).I tried rotating Normal coordination but the model's direction stayed the same
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

the position is handled in v section.

I'd suggest to refrain from wild guessing and use a textured square in blender (not a cube) to understand
how things work.

(press 'n' in blender's 3D view, in properties panel scroll down to 'normals' and press button "display face normals as lines")

Export he square as obj, copy the file, swap y and z in there and reimport it.
See how position is affected, also pay attention to the face winding.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
eri619
veteran
Posts: 80
Joined: Wed May 16, 2012 6:36 am
Location: India
Has thanked: 11 times
Been thanked: 2 times
Contact:

Re: Extracting simple models

Post by eri619 »

The problem is his PC cannot run blender or any other 3d app due to driver issues.
eatrawmeat391
beginner
Posts: 20
Joined: Tue Dec 06, 2016 10:51 am
Has thanked: 8 times
Been thanked: 9 times

Re: Extracting simple models

Post by eatrawmeat391 »

Thanks Shakotay2 and ERI619,actually,after the last driver update(which is in 2007,latest one) I can run Blender once.But after I restarted my PC,I couldn't run it again,it said "Unsupport Graphic Driver",this is the same with most OBJ Viewer tool that uses OpenGL,I can run it once.
The problem is now solved, I added the following calculations before exporting the obj (to the v section and vn section as well)
- Rotate x,y,z by x-axis 180 degree
- Swap y and z
- Multiply y by -1
Edit: I am writing a program that will support exporting the obj from the yobj and also importing the obj as well,I ran into an issue,in a document about the offset of the program.There is a weight data section,I don't know what it means.Basically the v sections are stored like this v x y z 1.0 so I think it has a weight of its own.The normal section doesn't accept weight parameter.And the vt section accepts weight parameter but there are 161 of them,while the weight's total amount of item is 122.I think the weight items are stored like this (float1) (float2) 0.0 0.0 so there are 122*2 = 244.It isn't evenly divisible to any of the amount of items.(Basically this file stores the bone data as well)
Do you know what the weights are for,is it okay to ignore it when parsing obj and putting them into the yobj?We'll only replace face object to another face object,arm object to another arm,... but the number of vertices will be increased or decreased
You do not have the required permissions to view the files attached to this post.
eri619
veteran
Posts: 80
Joined: Wed May 16, 2012 6:36 am
Location: India
Has thanked: 11 times
Been thanked: 2 times
Contact:

Re: Extracting simple models

Post by eri619 »

i think we only need to worry about weights if we are injecting modified armature/bones back into the model files.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

yep.
@eatrawmeat391: "For every vertex (triangle point) in the model, we have to figure out which bones it should be attached to, and how strong each attachment should be."
read here for example: http://blog.wolfire.com/2009/11/volumet ... n-skinning

There may be up to 4 weights per vertex.

btw: this is not an "extracting simple models" discussion

You should take into consideration to open/join another thread on this.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
eri619
veteran
Posts: 80
Joined: Wed May 16, 2012 6:36 am
Location: India
Has thanked: 11 times
Been thanked: 2 times
Contact:

Re: Extracting simple models

Post by eri619 »

I think he posted it here because he can easily seek your help here.
eatrawmeat391
beginner
Posts: 20
Joined: Tue Dec 06, 2016 10:51 am
Has thanked: 8 times
Been thanked: 9 times

Re: Extracting simple models

Post by eatrawmeat391 »

Thanks you next time I will open a new topic
eri619
veteran
Posts: 80
Joined: Wed May 16, 2012 6:36 am
Location: India
Has thanked: 11 times
Been thanked: 2 times
Contact:

Re: Extracting simple models

Post by eri619 »

Could you please help us,this is the only missing data which we need to complete the import tool.
viewtopic.php?f=16&t=15579
eatrawmeat391
beginner
Posts: 20
Joined: Tue Dec 06, 2016 10:51 am
Has thanked: 8 times
Been thanked: 9 times

Re: Extracting simple models

Post by eatrawmeat391 »

Can I ask a dumb question?About the f sections,I think they are just 3 points that form a triangle.Is it okay if they are swapped?(It shouldn't be)

f 1 2 3
f 1 3 2
f 2 1 3
f 2 3 1
f 3 1 2
f 3 2 1
...
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4285
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

Looks like double faces (maybe foreside and backside?).
Swapping means the winding is changed.

You can check such problems in a very simple way:
create a copy of the whole wavefront obj file.
In the original one delete all odd faces (line 1, 3, and so on in the faces' list).
In the copy delete all even faces (line 2, 4 and so on).

Then load the two obj files into your 3D app and apply the texture(s) to them.

(If there are thousand faces it might be sufficient to delete only 50 of them.)
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
Post Reply