Jump to content

Recommended Posts

Posted
On 2/11/2025 at 9:39 AM, h3x3r said:

Hi, Can somebody please figure out vertex normals. They should be byte. But not sure. They are in 3848536924.VertexBuffer.

It's the last thing i need to finish my 010 Editor template exporter.

Here is info:

612424467.VertexBuffer
Vertices
Offset > 0x1C, Stride > 12, Vertex count > 7412 Data Type > Float

3848536924.VertexBuffer
Normals, UV, etc
Offset > 0x1C, Stride > 20, Vertex count > 7412

2139299717.IndexBuffer
Indices
Offset > 0xF5DC4, Index Count > 4320, Data type > uint16

Thanks in advance.

f40_normals.7z 390.93 kB · 11 downloads

EDiT: Tried this one but it doesn't yield nothing good

byte bx = Var0, by = Var1, bz = Var2;
double length = Math.Sqrt((bx * bx) + (by * by) + (bz * bz));
double dx = bx / length, dy = by / length, dz = bz / length;

EDiT: I got some clues but not sure how they are converted. There is some unknown after x,y,z. maybe it's somehow involved in conversion.

I can see some patern in it. 

001 vn -78 -75 30  	unknown 48  >  vn 0.850738 -0.162228 -0.499926
002 vn -88 -95 46  	unknown 47  >  vn 0.830714 -0.115664 -0.544552
003 vn -88 21 -81  	unknown 46  >  vn 0.830885 -0.172438 -0.529052
004 vn -88 53 -50  	unknown 47  >  vn 0.830573 -0.225279 -0.509311
005 vn -78 37 -97  	unknown 47  >  vn 0.850253 -0.107755 -0.515227
006 vn -3 -47 -81  	unknown 61  >  vn 0.996954 -0.023489 -0.074376
007 vn -3 -63 -49  	unknown 61  >  vn 0.997029 -0.031295 -0.070382
008 vn -78 77 -66  	unknown 48  >  vn 0.850758 -0.213692 -0.480152
009 vn -3 41 0     	unknown 2   >  vn 0.997836 0.019600 0.062759
010 vn -3 -31 -97  	unknown 61  >  vn 0.996948 -0.016643 -0.076276
011 vn -3 -15 -97  	unknown 61  >  vn 0.997050 -0.007840 -0.076350
012 vn -78 -111 95  unknown 47  >  vn 0.850449 -0.054870 -0.523188
013 vn -88 -115 95  unknown 46  >  vn 0.830468 -0.056695 -0.554173
014 vn -3 -79 -17   unknown 61  >  vn 0.997009 -0.039206 -0.066607
015 vn -78 -23 125  unknown 49  >  vn 0.850203 -0.262448 -0.456372
016 vn -88 -55 -83  unknown 48  >  vn 0.830695 -0.278314 -0.482170
017 vn -3 57 -16   	unknown 1   >  vn 0.997786 0.027350 0.060626
018 vn -3 69 -48   	unknown 1   >  vn 0.997821 0.033377 0.056907
019 vn -3 29 32    	unknown 2   >  vn 0.997684 0.013718 0.066627
020 vn -31 -43 48  	unknown 10  >  vn 0.941970 0.103787 0.319252

 

did you get the normals? what formula did you use to get the final coordinates?

  • 3 months later...
  • Engineers
Posted

image.thumb.png.51bdadff2f998bd6880825c4b77192c6.png

I was just lucky. Following my 010 editor template. Can't believe it i converted it to the python...🙃

Sure there's left transfer parts, i leave it as last piece of puzzle. There's also parenting, somethin new to me to be honest. But i got it in my template. Now understand the parenting function.

  • Engineers
Posted (edited)

Hi, well i stuck at gathering element buffers. Whatever i am doing... i am doing it wrong.

Here is code for parsing elements. Now i need to collect only specific buffers. Let's say dcUnitVectorSize and put it into single buffer and feed rapi.rpgBindUV1Buffer() with it.

dcElementTypeList = []
dcElementSizeList = []
dcUnknown_0List = []
bs.seek(dcElementStreamFormatResourceId64Offset, NOESEEK_ABS)
bs.read(12)
dcElementStreamIndex = bs.readUByte()
for n in range(0, dcElementStreamIndex):
    dcElementTypeList.append(bs.readUByte())
    dcElementSizeList.append(bs.readUByte())
    dcUnknown_0List.append(bs.readUByte())
    dcUnknown_1 = bs.readUByte()
    dcUnknown_2 = bs.readUByte()
    
# dcElementBuffer
bs.seek(dcElementResourceOffset, NOESEEK_ABS)
bs.read(22)
dcElementStride = bs.readUShort()
dcTotalElementIndex = bs.readUInt()
dcElementBufferBaseOffset = bs.tell()
    
for o in range(0, dcTotalElementIndex):
    for p in range(0, dcElementStreamIndex):
        dcElementType = dcElementTypeList[p]
        dcElementSize = dcElementSizeList[p]
        dcUnknown_0 = dcUnknown_0List[p]
        
        if dcElementType == 2 and dcElementSize == 15:
            dcNormalsSize = bs.read(3)
            dcNormalsVarSize = bs.read(1)
            
        elif dcElementType == 5 and dcElementSize == 8:
            dcUnitVectorSize = bs.read(8)
            
        elif dcElementType == 5 and dcElementSize == 9 and dcUnknown_0 == 1:
            dcUnknown03fSize = bs.read(12)

        elif dcElementType == 5 and dcElementSize == 9:
            dcUnknown13fSize = bs.read(12)
            
        elif dcElementType == 5 and dcElementSize == 15:
            dcUnknown4bSize = bs.read(4)
            
        elif dcElementType == 6 and dcElementSize == 19:
            dcColorsSize = bs.read(4)

     
if dcElementType == 5 and dcElementSize == 8:
    rapi.rpgBindUV1Buffer(feed buffer, noesis.RPGEODATA_FLOAT, 8)

I would say i tried everything but wrong... Basically i don't know how to deal with 2 loops.

Thank you for anything.

Anyway this works for vertices, but not sure why not for elements

dcVerticesSize = bytes()
    
for k in range(0, dcTotalVertexIndex):
    for l in range(0, dcVertexStreamIndex):
        dcVertexType = dcVertexTypeList[l]
        dcVertexSize = dcVertexSizeList[l]
        
        if dcVertexType == 1 and dcVertexSize == 9:
            dcVerticesSize += bs.read(12)
            #dcVertexBuffer.extend(dcVerticesSize)
            
        elif dcVertexType == 2 and dcVertexSize == 15:
            dcNormalsSize = bs.read(3)
            dcNormalsVarSize = bs.read(1)
            #dcVertexNormalsBuffer.extend(dcNormalsSize)
            
        elif dcVertexType == 5 and dcVertexSize == 8:
            dcUnitVectorSize = bs.read(8)
            #dcVertexUVBuffer.extend(dcUnitVectorSize)
            
        elif dcVertexType == 5 and dcVertexSize == 9:
            dcUnknown3fBufferSize = bs.read(12)
            #dcVertexUnknown3fBuffer.extend(dcUnknown3fBufferSize)
            
        elif dcVertexType == 5 and dcVertexSize == 15:
            dcUnknown4bBufferSize = bs.read(4)
            #dcVertexUnknown4bBuffer.extend(dcUnknown4bBufferSize)
            
        elif dcVertexType == 6 and dcVertexSize == 19:
            dcColorsSize = bs.read(4)
            #dcVertexColorsBuffer.extend(dcColorsSize)
            
rapi.rpgBindPositionBuffer(bytes(dcVerticesSize), noesis.RPGEODATA_FLOAT, 12)

 

Edited by h3x3r
  • Engineers
Posted (edited)

So you think there is another element i don't have described?

Not sure why my 010 template works with UV but this one not.

So i check it but nothing unusual. All printed variables are described.

But... there are minimum 5 8 0 variables which are UVs, same for normals, none. And in my template i have them.

 

prob.jpg

It prints only last entry. Like rest doesn't count? wtf

I think there will be something trivial in loop...

Well if i print element value like that, i am retreiving them.

for o in range(0, 1):
	for p in range(0, dcElementStreamIndex):
		dcElementType = dcElementTypeList[p]
		dcElementSize = dcElementSizeList[p]
		dcElementUnknown_0 = dcElementUnknown0List[p]
		print(o,p,dcElementType,dcElementSize,dcElementUnknown_0)

Lets summarize it:

VertexStreamFormat offset     ✓
VertexStreamFormat parse     ✓

VertexBuffer offset                  ✓

ElementStreamFormat offset  ✓
ElementStreamFormat parse   ✓

ElementBuffer offset                ✓

element buffer use same vertex count as vertex buffer

but still when i feed the buffer it gives me error about UV1 buffer would have been read out of bounds by provided indices.

 

So i don't think that faces fails.

Edited by h3x3r
  • Engineers
Posted
1 hour ago, h3x3r said:

but still when i feed the buffer it gives me error about UV1 buffer would have been read out of bounds by provided indices.

Yeah, this "out of bounds" error in Noesis. SizeOfBuffer divided by sizeOfElements gives the elements' count.

And that must match the maximum face index count. Sounds simple but sometimes it's a little bit hard to solve it...

  • Engineers
Posted (edited)

Hmm there is also vertex/element offset starting from base offset + VertexCount + 1 * stride.

I am reading whole buffer.

Looks like with this i also must reset face index to 0 and i noticed something about it.

there are 2 values one is lower and second higher, could this be min index, max index. And this: max index - min index gives you vertex count

image.thumb.png.9299f1f18632ff67290309e04fc5cde8.png

Edited by h3x3r
  • Engineers
Posted (edited)
6 hours ago, h3x3r said:

And this: max index - min index gives you vertex count

(typo?) you don't read it as a difference. Max face index is identical with vertex count when min index is zero.That's why hex2obj says rVC=508 for 6192 - 5685. 

Last time when min face index was not zero for me was the game 'Ride' 10 years ago. I was cleverer these times.:classic_blink:

Edited by shak-otay
  • Engineers
Posted (edited)

Maybe i found solution for my template. I was reading whole vertex bufer bcs faces were not reseted. I have let's say 405 vertex count but face indices starts with 8652. So that VertexOffset value is min face index. So now i need just Subtract every face indice with that min index and it should be ok.

 

Yes, it worked. Now i can export it with 010 without using 40 GB+ RAM when exporting...

So what i need now is convert indices and return them back to binary buffer.

EDiT: Figured out how to reset indices and push them to buffer. So now I hope, that uv will work.

Nah same sh!t

Edited by h3x3r
  • Like 1
  • Engineers
Posted (edited)

Well i noticed something off with reading elements. I printed the small one and it gives me just half of buffer.

EDiT: Correction, they are there but somehow converted to string instead of hex

b'\xd1[\x00?:[\x00?\x8d)\x80>\xfa\x08\x00?\xd1[\x00?\xdf\xdf\x80>ca\x80>\xe5(\x80>'

Should be

\d1\5b\00\3f\3a\5b\00\3f\8d\29\80\3e\fa\08\00\3f\d1\5b\00\3f\df\df\80\3e\63\61\80\3e\e5\28\80\3e

But maybe thats the print function format

Nah it does same for vertices and they work, so it's normal.

 

Hmmm looks like culprit

STEERING_COLUMNShape bytearray(b'') 

It's empty and i bet my ass that this one mf causing it. And it's not only one.

So maybe exception problem.

Yep, no uv's

image.thumb.png.5e8fecffca2f362a2804e8423454ffdb.png

Confirmed, my exception fails. I tried to load like 5 meshes which has uv and they load with uv's.

image.thumb.png.d4ba00908ae23ada2d9879a65ab62ad2.png

 

Well now i have half of meshes with uv. But rest is not displayed... Maybe i break something with exception

Edited by h3x3r
  • Engineers
Posted (edited)

I don't know how to load meshes without uv. I have all with em.

There are 3 UV Sets. But can't get right exception combo.

dcElementUVSet0Size = len(dcElementUVSet0)
dcElementUVSet1Size = len(dcElementUVSet1)
dcElementUVSet2Size = len(dcElementUVSet2)
    
if dcElementUVSet0Size != 0 and dcElementUVSet1Size == 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet0), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size == 0 and dcElementUVSet1Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet1), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size != 0 and dcElementUVSet1Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet1), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size == 0 and dcElementUVSet1Size == 0 and dcElementUVSet2Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet2), noesis.RPGEODATA_FLOAT, 8)
else:
    break

Not sure why that break breaks pasrsing rest of mesh.

And here whole code for imagination.

dcElementUVSet0 = bytearray()
dcElementUVSet1 = bytearray()
dcElementUVSet2 = bytearray()

for k in range(0, dcElementCount):
    for l in range(0, dcElementStreamIndex):
        dcElementType = dcElementTypeList[l]
        dcElementSize = dcElementSizeList[l]
        dcElementUnknown_0 = dcElementUnknown0List[l]

        if dcElementType == 2 and dcElementSize == 15:
            dcNormalsSize = bs.read(3)
            dcNormalsVarSize = bs.read(1)
            
        elif dcElementType == 5 and dcElementSize == 8 and dcElementUnknown_0 == 0:
            dcUnitVectorSize = bs.read(8)
            dcElementUVSet0.extend(dcUnitVectorSize)
            
        elif dcElementType == 5 and dcElementSize == 8 and dcElementUnknown_0 == 3:
            dcUnitVectorSize = bs.read(8)
            dcElementUVSet2.extend(dcUnitVectorSize)
            
        elif dcElementType == 5 and dcElementSize == 8 and dcElementUnknown_0 == 4:
            dcUnitVectorSize = bs.read(8)
            dcElementUVSet1.extend(dcUnitVectorSize)
            
        elif dcElementType == 5 and dcElementSize == 9:
            dcUnknown03fSize = bs.read(12)
            
        elif dcElementType == 5 and dcElementSize == 15:
            dcUnknown4bSize = bs.read(4)
            
        elif dcElementType == 6 and dcElementSize == 19:
            dcColorsSize = bs.read(4)
dcElementEndOffset = bs.tell()

dcElementUVSet0Size = len(dcElementUVSet0)
dcElementUVSet1Size = len(dcElementUVSet1)
dcElementUVSet2Size = len(dcElementUVSet2)

if dcElementUVSet0Size != 0 and dcElementUVSet1Size == 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet0), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size == 0 and dcElementUVSet1Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet1), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size != 0 and dcElementUVSet1Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet1), noesis.RPGEODATA_FLOAT, 8)
elif dcElementUVSet0Size == 0 and dcElementUVSet1Size == 0 and dcElementUVSet2Size != 0:
    rapi.rpgBindUV1Buffer(bytes(dcElementUVSet2), noesis.RPGEODATA_FLOAT, 8)
else:
    break

# Seek for dcMaterial
dcMaterialResourceId64Offset = data.find(dcNull and dcMaterialResourceId64, dcTableOffset, dcTableSize)
bs.seek(dcMaterialResourceId64Offset, NOESEEK_ABS)
bs.read(12)
dcMaterialResourceOffset = bs.readUInt()

I did exception for:

elif dcElementUVSet0Size == 0 and dcElementUVSet1Size == 0 and dcElementUVSet2Size == 0:

    bs.seek(dcElementEndOffset, NOESEEK_ABS)

    continue

 

But it returns : tried to set offset beyond buffer size.

Also this is 010 code and it works just fine.

if (exists(UV0PosX) & !exists(UV1PosX))
{
    Printf("vt %f %f\n",UV0PosX,-UV0PosY + 1);
}
else if (!exists(UV0PosX) & exists(UV1PosX))
{
    Printf("vt %f %f\n",UV1PosX,-UV1PosY + 1);
}
else if (exists(UV0PosX) & exists(UV1PosX))
{
    Printf("vt %f %f\n",UV1PosX,-UV1PosY + 1);
}
Edited by h3x3r
  • 1 month later...
  • 4 weeks later...
Posted

Hey guys, is there a way to replicate this method but for the .bnk and .crk audio files so I can use them in Automation cars?

ChatGPT told me your method only gets .dat .bin and .rpk, but the audio files are still stcuk encrypted in the bin files?

any ideas?

Screenshot (515).png

Posted

Hey guys, is there a way to replicate this method but for the .bnk and .crk audio files so I can use them in Automation cars?

ChatGPT told me your method only gets .dat .bin and .rpk, but the audio files are still stcuk encrypted in the bin files?

any ideas?

 

Screenshot (515).png

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...