Jump to content

MESSIAH MeshToOBJ [*.mesh/*.model]


Durik256

Recommended Posts

  • Durik256 changed the title to MESSIAH MeshToOBJ [*.mesh/*.model]
  • 5 months later...
On 11/10/2023 at 12:28 AM, Durik256 said:

MESSIAH

game support : +(Diablo Immortal, Ace Racing, Fantasy Westward Journey, 1 unk)

\\\\\\\\\\\MeshToOBJ.exe
Link on github: MeshToOBJ.exe

c8eaab16cae0377395088a2ee550fea7.png.79161fdce08e1fdf6e80edc6d50e503a.png

\\\\\\\\\\\Noesis
for Noesis for *.mesh/*.model
link on github: fmt_mesh_diablo.py

14a0b3c67be3a938f393eff98a50adc1(1).png.7b8823c89f53bb9487412dd3ad0ab027.png

How did you obtain these models? I tried parsing the visible strings, MESSIAH, Compressed_P_C_N_UV1_TB, W4B_I4B, but I couldn't get any clue. The parsed vertex data, xyz, all contain abnormal values. Could you please share how you successfully read and converted the .mesh file to .obj? Thank you very much!

I know mesh to obj can read the models, but I want to know the method so that I can integrate it into my Python script for execution. I'm researching ACE Racing.

mesh.rar

Link to comment
Share on other sites

Posted (edited)
2 hours ago, Rinorsi said:

How did you obtain these models? I tried parsing the visible strings, MESSIAH, Compressed_P_C_N_UV1_TB, W4B_I4B ...

Compressed:
P - (12bytes) as 3float
C -  (4bytes)
N - (4bytes)
UV1/2 - (4bytes) as 2HalfFloat
TB - (8bytes)
Other:
template: [target][count][type]
sample: W4B = target:Weight, count:4, type:Byte

On my githab there is a plugin(python) for diablo, it also uses MESSIAH. (you can see the implementation there)

Edited by Durik256
  • Like 1
Link to comment
Share on other sites

Thank you, I spent the whole day trying to understand,

but even after modifying the Noesis plugin (fmt_mesh_diablo.py) according to the data you provided, it still doesn't seem to work and causes Noesis to crash.

Or perhaps, how can I batch convert .mesh files to .obj using Python? Besides models, AceRacing also includes many FX or particles that are compressed with LZMA.

I want to use a Python script to batch convert models to precisely extract the parts that belong to models from all the decompressed files.

If you can assist me, I would be very grateful.

44a58c7279b47747f44d7a30dd424b0d.png

AceRacing-Mesh.rar

Link to comment
Share on other sites

13 hours ago, Durik256 said:

why did you remove (author's name) from the script?

MeshToOBJ supports batch processing.

i made plugin for Noesis for AceRacing fmt_mesh_AceRacing.py

*(Later I’ll make a universal for everyone messiah)

thx!!!
I apologize, I use chatgpt so i dont know why it remove author's name from the script.
……

I have encountered some issues that seem to be unable to execute properly, so I have modified the plugin to ensure that it can now execute properly.

I fixed some bugs in fmt_mesh_AceRacing.py, and now it can correctly read .messiah model information (perhaps the data differs between the Chinese version and the global version; I have only tested models obtained from the Chinese version with .MESSIAH, which can be read correctly).

Noesis-Plugins/fmt_mesh_AceRacing.py at master · Durik256/Noesis-Plugins (github.com)

 

Fixes include:

Changed the file header check in the noepyCheckType function to match the first 8 bytes (.MESSIAH) instead of bytes 1 to 8.

Replaced bs.read with bs.readBytes in the noepyLoadModel function to correctly handle the reading of binary data. This ensures the read operations correctly interpret the data formats.

Corrected the method name for binding UV buffers from rapi.rpgBindUVXBufferOfs to rapi.rpgBindUV1BufferOfs, which is the correct method available in the Noesis API for binding UV buffers.

 

c3a9dbf7333c8cd9bf7025e892c7051d.png

 

Edited by Rinorsi
Link to comment
Share on other sites

Posted (edited)
3 hours ago, Rinorsi said:

Fixes include:

I'll duplicate the answer from Github:

1)magic check is correct. (it doesn’t matter how many bytes you check, it’s just to check the validity of the file).
I just skip the first dot (I don’t remember why I did this, maybe in other MESSIAH games there was another symbol instead of a dot)

2)reading bytes through bs.read() is the same as through bs.readBytes(), this can be seen in the Noesis code
```
	def read(self, fmtStr):
		if isinstance(fmtStr, str):
			self.toUnpacker(); r = noeSuper(self).read(fmtStr); self.fromUnpacker(); return r
		else:
			return self.readBytes(fmtStr) #assume byte count
```

3)rpgBindUVXBufferOfs is used to set the UVS to the desired channel. It is not necessary to use an explicit method for the desired channel.
especially when there are several channels or more than 2
from Noesis documentation:
```
{"rpgBindUVXBuffer", RPGBindUVXBuffer, METH_VARARGS, "binds uvx buffer. (Oiiii)"}, //args=bytes for uv2's, dataType, stride, uv index, uv elem count
By replacing rpgBindUVXBufferOfs with rpgBindUV1BufferOfs, you broke the code, since some models have several UVs channels. you always set UVs to the zero channel. that is, if there are multiple UVs you will only get the last one.
```

so I think all your changes are unnecessary
the only thing that can be used is the magic check.
*(send me the file that gave the error)

The plugin is absolutely functional and does not need any corrections

-1.png.17e43a399c623c70557e29fa4917b64a.png

Edited by Durik256
Link to comment
Share on other sites

5 minutes ago, Durik256 said:

I'll duplicate the answer from Github:


magic check is correct. (it doesn’t matter how many bytes you check, it’s just to check the validity of the file).
I just skip the first dot (I don’t remember why I did this, maybe in other MESSIAH games there was another symbol instead of a dot)
2)
reading bytes through bs.read() is the same as through bs.readBytes(), this can be seen in the Noesis code

	def read(self, fmtStr):
		if isinstance(fmtStr, str):
			self.toUnpacker(); r = noeSuper(self).read(fmtStr); self.fromUnpacker(); return r
		else:
			return self.readBytes(fmtStr) #assume byte count
rpgBindUVXBufferOfs is used to set the UVS to the desired channel. It is not necessary to use an explicit method for the desired channel.
especially when there are several channels or more than 2
from Noesis documentation:

{"rpgBindUVXBuffer", RPGBindUVXBuffer, METH_VARARGS, "binds uvx buffer. (Oiiii)"}, //args=bytes for uv2's, dataType, stride, uv index, uv elem count
By replacing rpgBindUVXBufferOfs with rpgBindUV1BufferOfs, you broke the code, since some models have several UVs channels. you always set UVs to the zero channel. that is, if there are multiple UVs you will only get the last one.

so I think all your changes are unnecessary
the only thing that can be used is the magic check.
*(send me the file that gave the error)

该插件绝对功能强大,不需要任何更正

-1.png.17e43a399c623c70557e29fa4917b64a.png

Okay, I'm not quite sure what the problem might be, maybe it's a version issue?
Anyway, I sincerely thank you for your help!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...