Page 6 of 12

Re: 3D Model Researcher - extract 3D models with Python

Posted: Fri Jul 26, 2019 3:17 pm
by jayn23
Hi,

Mostly for debugging my code and i am just used to scripting in visual studio :)
And since i am new to python i checked online and it said that you should be able to import .pyd files.

Great tool by the way!

Re: 3D Model Researcher - extract 3D models with Python

Posted: Tue Jul 30, 2019 10:29 pm
by EDXZ23
Hi Lazov,

I'm having problems getting the faces of a model.

There's 8 submeshes but only a small part of the model renders and even that doesn't look right

Could you tell me what i'm doing wrong? i'm using 3D Model Researcher Pro

Thanks!!

P.S i'm loving the tool by the way, keep up the good work
1.png

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Jul 31, 2019 3:36 am
by Lazov
EDXZ23
It is necessary to watch the model itself, a screenshot does not give any information. Some models can not be opened using standard functionality. But with the help of scripts you can extract any models.

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Jul 31, 2019 12:32 pm
by EDXZ23
Lazov wrote: Wed Jul 31, 2019 3:36 am EDXZ23
It is necessary to watch the model itself, a screenshot does not give any information. Some models can not be opened using standard functionality. But with the help of scripts you can extract any models.
Hi again Lazov, thanks for the reply!!

I've tried to use a script from a youtube video and the same thing happens. but this time i get an error message "MRError: Invalid data - cannot reshape array of size 1000 into shape (3)"

the hex values for a face is 00 00 01 00 02 and i use the first instance of these as my face offset
error.png

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Jul 31, 2019 5:04 pm
by Lazov
EDXZ23
The readByte function returns a single value, and a tuple is needed.
Try this:
fc = (f.readByte (), f.readByte (), f.readByte ())
faces.append (fc)

But it will not help to extract the model. Need to somehow convert the data.

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Jul 31, 2019 7:51 pm
by EDXZ23
Lazov wrote: Wed Jul 31, 2019 5:04 pm EDXZ23
The readByte function returns a single value, and a tuple is needed.
Try this:
fc = (f.readByte (), f.readByte (), f.readByte ())
faces.append (fc)

But it will not help to extract the model. Need to somehow convert the data.
Hi Lazov thanks again for the help!!

your code worked the error message is no longer occurring! but you were right about it not helping extract the model.
You said i have to convert the data. any ideas how or to what? the file is currently in .dat extension

P.S i'm really new to all of this, sorry if all my questions are basic and annoying

Re: 3D Model Researcher - extract 3D models with Python

Posted: Mon Aug 05, 2019 3:27 am
by EDXZ23
Lazov wrote: Wed Jul 31, 2019 5:04 pm EDXZ23
The readByte function returns a single value, and a tuple is needed.
Try this:
fc = (f.readByte (), f.readByte (), f.readByte ())
faces.append (fc)

But it will not help to extract the model. Need to somehow convert the data.

could you elaborate on convert data?

Re: 3D Model Researcher - extract 3D models with Python

Posted: Mon Aug 05, 2019 2:16 pm
by Lazov
EDXZ23
Unfortunately, there is nothing I can help. I almost do not extract models. But there are people who know this subject very well. Try to ask a question on the forum:
viewforum.php?f=16

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Aug 07, 2019 11:42 am
by GHFear
Lazov wrote: Mon Aug 05, 2019 2:16 pm EDXZ23
Unfortunately, there is nothing I can help. I almost do not extract models. But there are people who know this subject very well. Try to ask a question on the forum:
viewforum.php?f=16
Hello Lazov,
What do you do in the backend to calculate the UVs from Signed and Unsigned Short?

Re: 3D Model Researcher - extract 3D models with Python

Posted: Wed Aug 07, 2019 1:19 pm
by EDXZ23
GHFear wrote: Wed Aug 07, 2019 11:42 am
Lazov wrote: Mon Aug 05, 2019 2:16 pm EDXZ23
Unfortunately, there is nothing I can help. I almost do not extract models. But there are people who know this subject very well. Try to ask a question on the forum:
viewforum.php?f=16
Hello Lazov,
What do you do in the backend to calculate the UVs from Signed and Unsigned Short?
Hi GHFear,

Your skate extraction videos is what I've been using as a guide.

I've been told that the faces in my file can't be read as a single array and that there may be many start and stop offsets

I've successfully found the first one, but how do I find the others? the file has a similar structure to .rax files in SWBF3 by Free Radical
progress.png

Re: 3D Model Researcher - extract 3D models with Python

Posted: Fri Aug 09, 2019 8:17 am
by GHFear
EDXZ23 wrote: Wed Aug 07, 2019 1:19 pm
GHFear wrote: Wed Aug 07, 2019 11:42 am
Lazov wrote: Mon Aug 05, 2019 2:16 pm EDXZ23
Unfortunately, there is nothing I can help. I almost do not extract models. But there are people who know this subject very well. Try to ask a question on the forum:
viewforum.php?f=16
Hello Lazov,
What do you do in the backend to calculate the UVs from Signed and Unsigned Short?
Hi GHFear,

Your skate extraction videos is what I've been using as a guide.

I've been told that the faces in my file can't be read as a single array and that there may be many start and stop offsets

I've successfully found the first one, but how do I find the others? the file has a similar structure to .rax files in SWBF3 by Free Radical
progress.png
Hello
You would have to upload the file so I can look at it.

/GHFear

Re: 3D Model Researcher - extract 3D models with Python

Posted: Fri Aug 09, 2019 10:37 am
by EDXZ23
GHFear wrote: Fri Aug 09, 2019 8:17 am
EDXZ23 wrote: Wed Aug 07, 2019 1:19 pm
GHFear wrote: Wed Aug 07, 2019 11:42 am

Hello Lazov,
What do you do in the backend to calculate the UVs from Signed and Unsigned Short?
Hi GHFear,

Your skate extraction videos is what I've been using as a guide.

I've been told that the faces in my file can't be read as a single array and that there may be many start and stop offsets

I've successfully found the first one, but how do I find the others? the file has a similar structure to .rax files in SWBF3 by Free Radical
progress.png
Hello
You would have to upload the file so I can look at it.

/GHFear

heres the file dude!
6118.zip
the file was extracted to .dat but i know now that its a .rax file

Re: 3D Model Researcher - extract 3D models with Python

Posted: Fri Aug 09, 2019 1:13 pm
by GHFear
EDXZ23 wrote: Fri Aug 09, 2019 10:37 am
GHFear wrote: Fri Aug 09, 2019 8:17 am
EDXZ23 wrote: Wed Aug 07, 2019 1:19 pm

Hi GHFear,

Your skate extraction videos is what I've been using as a guide.

I've been told that the faces in my file can't be read as a single array and that there may be many start and stop offsets

I've successfully found the first one, but how do I find the others? the file has a similar structure to .rax files in SWBF3 by Free Radical
progress.png
Hello
You would have to upload the file so I can look at it.

/GHFear

heres the file dude!
6118.zip

the file was extracted to .dat but i know now that its a .rax file
I can not for the life of me figure this format out.
sorry.

Re: 3D Model Researcher - extract 3D models with Python

Posted: Fri Aug 09, 2019 9:00 pm
by Lazov
GHFear
All coordinates are divided by 0xffff.

EDXZ23
Try using meshes. If it turned out to build part of the model, this is already good.
By the way, I can not open the archive with your model.

Re: 3D Model Researcher - extract 3D models with Python

Posted: Sat Aug 10, 2019 3:41 am
by GHFear
Lazov wrote: Fri Aug 09, 2019 9:00 pm GHFear
All coordinates are divided by 0xffff.

EDXZ23
Try using meshes. If it turned out to build part of the model, this is already good.
By the way, I can not open the archive with your model.
Hi Lazov.

Thanks for the answer.

The UV coordinates are in hexadecimal: 0x107 and 0x20A8 Big Endian.
The value shown in the .OBJ file is 0.0083 and 0.2568.

Dividing 0x107 (263) by 0xffff (65535) = 0,00401312275883115892271305409323
Dividing 0x20A8 (8360) by 0xffff (65535) = 0,12756542305638208590829327840085‬

So there must be something else being done to the coordinates to get 0.0083 and 0.2568.
Or maybe I am completely missing something.


Edit (Solution): If anyone has the same problem converting short / 16bit Int UVs to floats,
my solution is this:

If you're using python and rounding,

rounded UVs Multiplier:

short U / 31869
short V / 32553

If you don't want to round and just accept some tiny variance:

raw UVs Multiplier:

short U / 31868
short V / 32555

/GHFear