Need help with Noesis plugin - .dxg format Short type Vertices
Posted: Tue Jun 30, 2020 5:30 am
I need help in fixing the Noesis Plugin for the case of .dxg models using Short instead of Float Vertices.
Using the normal Plugin I can view most of the aisp@ce dxg models after applying shakotay2's patch to the script, but unfortunately the model I want is still messed up.
Upon more investigations I found out the Vertices have different data type.
Here's an example of normal float type data:
https://imgur.com/ky4li5S
Here's an example of suspected short type data:
https://imgur.com/7tx2ZAy
From the script, the default vertBuff, normBuff and UVBuff sizes are calculated assuming the types are float
and if you look in build_mesh()
You can see that the RPGEODATA used for each rpgBind is FLOAT type.
I did the obvious and tried to change the Buffer size alongside RPGEODATA_FLOAT to RPGEODATA_SHORT, but the models still has messed up mesh.
Here's what I changed for each Buff:
and in build_mesh()
The logic here is that since Float XYZ take 12 bytes, a Short XYZ will only take 6 bytes. I have also tried using HALFFLOAT but still failed.
I will attach both version of the dxg model files w/ the script here:
202201_0_01_000.dxg - Float Type
202201_0_02_000.dxg - Short Type
Also, there's a memo on the dxg format done by some Japanese modder. You will need to use wordpad++ to parse the Japanese comments. I could translate the comments if you like.
May I ask what am I doing wrong? Any help would be appreciated, and thanks in advance.
Using the normal Plugin I can view most of the aisp@ce dxg models after applying shakotay2's patch to the script, but unfortunately the model I want is still messed up.
Upon more investigations I found out the Vertices have different data type.
Here's an example of normal float type data:
https://imgur.com/ky4li5S
Here's an example of suspected short type data:
https://imgur.com/7tx2ZAy
From the script, the default vertBuff, normBuff and UVBuff sizes are calculated assuming the types are float
Code: Select all
#indices
self.parse_indices(mesh.numVerts, mesh)
mesh.idxBuff = self.parse_faces(mesh.numFaces * 3)
self.inFile.seek(startofverts)
mesh.vertBuff = self.inFile.readBytes(numCoords * 12)
mesh.normBuff = self.inFile.readBytes(numNorms * 12)
mesh.uvBuff = self.inFile.readBytes(numUV * 8)
Code: Select all
for i in range(mesh.numVerts):
posIdx, normIdx, uvIdx = mesh.posList[i], mesh.normList[i], mesh.uvList[i]
vertBuff = b''.join([vertBuff, mesh.vertBuff[posIdx * 12 : (posIdx+1) * 12]])
normBuff = b''.join([normBuff, mesh.normBuff[normIdx * 12 : (normIdx+1) * 12]])
uvBuff = b''.join([uvBuff, mesh.uvBuff[uvIdx * 8 : (uvIdx+1) * 8]])
rapi.rpgBindPositionBuffer(vertBuff, noesis.RPGEODATA_FLOAT, 12)
rapi.rpgBindNormalBuffer(normBuff, noesis.RPGEODATA_FLOAT, 12)
rapi.rpgBindUV1Buffer(uvBuff, noesis.RPGEODATA_FLOAT, 8)
I did the obvious and tried to change the Buffer size alongside RPGEODATA_FLOAT to RPGEODATA_SHORT, but the models still has messed up mesh.
Here's what I changed for each Buff:
Code: Select all
mesh.vertBuff = self.inFile.readBytes(numCoords * 6)
mesh.normBuff = self.inFile.readBytes(numNorms * 6)
mesh.uvBuff = self.inFile.readBytes(numUV * 4)
Code: Select all
for i in range(mesh.numVerts):
posIdx, normIdx, uvIdx = mesh.posList[i], mesh.normList[i], mesh.uvList[i]
vertBuff = b''.join([vertBuff, mesh.vertBuff[posIdx * 6 : (posIdx+1) * 6]])
normBuff = b''.join([normBuff, mesh.normBuff[normIdx * 6 : (normIdx+1) * 6]])
uvBuff = b''.join([uvBuff, mesh.uvBuff[uvIdx * 4 : (uvIdx+1) * 4]])
rapi.rpgBindPositionBuffer(vertBuff, noesis.RPGEODATA_SHORT, 6)
rapi.rpgBindNormalBuffer(normBuff, noesis.RPGEODATA_SHORT, 6)
rapi.rpgBindUV1Buffer(uvBuff, noesis.RPGEODATA_SHORT, 4)
I will attach both version of the dxg model files w/ the script here:
202201_0_01_000.dxg - Float Type
202201_0_02_000.dxg - Short Type
Also, there's a memo on the dxg format done by some Japanese modder. You will need to use wordpad++ to parse the Japanese comments. I could translate the comments if you like.
May I ask what am I doing wrong? Any help would be appreciated, and thanks in advance.