Jump to content

need help to the correct read uv from Reckless Racing *.sggr


Recommended Posts

Posted

Hello guys, I need help to the correct read UV`s and Textures, from the Reckless Racing game. 

Earlier, durik256 helped me read the mesh format and some UV data from the *.sggr format, but to this day I haven’t been able to figure out the UV scaling and materials.

Here’s the link to the discussion: https://reshax.com/topic/1067-reckless-racing-ios-vfs-files/

Below is the Noesis script for reading the mesh data.

Script have two problems: 

- Sometimes the script reads the LOD versions of the mesh models.

- It also doesn’t read the UV scale, and the mesh isn’t split by materials.

I’m asking for your help in updating this script.

from inc_noesis import *

def registerNoesisTypes():
    handle = noesis.register("Reckless Racing", ".sggr")
    noesis.setHandlerTypeCheck(handle, noepyCheckType)
    noesis.setHandlerLoadModel(handle, noepyLoadModel)
    return 1

def noepyCheckType(data):
    if data[:4] != b'\x4D\x3C\x2B\x1A': 
        return 0
    return 1

def noepyLoadModel(data, mdlList):
    bs = NoeBitStream(data)
    ctx = rapi.rpgCreateContext()

    ofs_res = data.find(b'#RES')
    if ofs_res != -1:
        bs.seek(ofs_res + 44)
        unk, vnum, zero = bs.read('3I') 
        skip = 12 if unk == 4368 else 0
        vbuf = b''
        vbuf, uvbuf = b'', b''#bs.read(vnum*24)
        for x in range(vnum):
            bs.seek(2,1)
            vbuf += bs.read(2)
            bs.seek(2,1)
            vbuf += bs.read(2)
            bs.seek(2,1)
            vbuf += bs.read(2)
            bs.seek(5,1)#4
            uvbuf += bs.read(2)
            bs.seek(2,1)
            uvbuf += bs.read(2)
            bs.seek(1,1)#2
            bs.seek(skip,1)#12+
        rapi.rpgBindPositionBuffer(vbuf, noesis.RPGEODATA_SHORT, 6)
        rapi.rpgBindUV1Buffer(uvbuf, noesis.RPGEODATA_USHORT, 4)

        u0, inum, u1 = bs.read('3I')
        ibuf = bs.read(inum * 2)
        rapi.rpgCommitTriangles(ibuf, noesis.RPGEODATA_USHORT, inum, noesis.RPGEO_TRIANGLE)

    try:
        mdlList.append(rapi.rpgConstructModel())
    except:
        mdlList.append(NoeModel())

    return 1

 

  • Like 1
  • Engineers
Posted

Hello, you really should put more effort in your request. People who could help don't have all the time in the world, to unpack a vfs, search for the sggr in question,

which samples have the "lod problem", etc, etc.

WHY not simply upload the samples in question plus a description what EXACTLY you've done so far to get uvs.

Your post here is not very insightful, imho.

 

  • Thanks 1
  • Engineers
Posted (edited)

Seems your "need of help" is not much urgent. Anyways, uvs seem to be ok to some extend (4e153346.sggr) :

sggr_uvs.png

edit: for b8de6453.sggr (type 4368) a bigger uv offset (26) is required (see bold marked uvs):

sggr-uvs-4368.png.305e99d3e1ce7137fcdc500877fe563e.png

b8de6453-sggr-uvs.png.616dd476991d7f2f328f59e509346b57.png

Change the script like so:

            bs.seek(16,1)#type 4368
            uvbuf += bs.read(2)
            bs.seek(2,1)
            uvbuf += bs.read(2)
            bs.seek(1,1)
            bs.seek(-11,1)#type 4368
            bs.seek(skip,1)#12+

(You can use the variable skip to combine both versions of the script into one.)

(I showed a reduced set of uvs, otherwise all uvs are overlapping so in a next step sub meshes need to be created.)

Edited by shak-otay
Posted

Hi shak-otay, thanks a lot for your help. I just need to figure out how to read subMeshes. Could you also tell me when reading some meshes as LODs, could that also be related to subMeshes?

  • Engineers
Posted (edited)
4 hours ago, black_racer said:

Hi shak-otay, thanks a lot for your help. I just need to figure out how to read subMeshes. Could you also tell me when reading some meshes as LODs, could that also be related to subMeshes?

Hi black_racer,

I have no idea how the LODs and sub meshes are organized. As a start you could insert g SM_no_xx lines between the face index lines and compare the resulting sub meshes to suiting textures.

sub mesh no5 (from face index 5000 to 5999) marked:

b8de6453out-sm5_obj.jpg.62f6f126a8a0ad1108e0b4bfa931df3c.jpg

Quote

- Sometimes the script reads the LOD versions of the mesh models.

With which sggr file(s) does that happen?

Edited by shak-otay

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