Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (â‹®) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

Crimson Skies: High Road to Revenge (DirectX *.x)

Featured Replies

  • Author
  • Localization

attaching one more just to make sure - Final_Boss has several .x models that contain multiple UV maps, namely ss_boss_zep.x and zep_pandora.x (the one w/ the stretched UVs) - ss_boss_zep has converted objs with fixed uv scaling, though i have noticed that there are parts like on the rear fuselage where uvs are seemingly broken on one side (highlighted)

A4swN8d.png

in any case, here's how ss_boss_zep should roughly look - it's missing the logos due to not having a second uv set on fbx or obj at the moment but h3x3r's comment above yours shows how it should look

qNTyblC.png

uvset.jpg

 

https://zippyshare.day/pdhI5N1B0QnZjeL/file

hope you can figure this out!

Edited by notameowcelot

  • Replies 108
  • Views 29.2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • shak-otay
    shak-otay

    yeah, thanks, saw it already.  

  • shak-otay
    shak-otay

    If Durik comes up with a 40 lines Noesis script there's usually no argument for other solutions.😀 Airplane_HR, cage:

  • fmt_DirectX.zip << using my DirectX plugin for Noesis, (which I shared on xentax), it also gave the error "ImportError: Normal face count does not match vertex face count.", just by commenting o

Posted Images

  • Supporter
1 hour ago, Durik256 said:

structure where uvScale is located. I'll look into it then.)

Just right after vertex block. There are 4 floats. First of them is uvScale.

uvScale.jpg

  • Author
  • Localization
On 5/19/2024 at 1:22 PM, Durik256 said:

Hello. I haven't been following this topic. post it again (files model, texture). screenshot of what the current uv is and what it should be. structure where uvScale is located. I'll look into it then.)

hey @Durik256 - wanted to check and see if there was any progress on this front 🙂 

  • Author
  • Localization
3 minutes ago, Durik256 said:

I forgot about that 

update fmt_CrimsonSkies_X.py

 

Без имени-1.png

thank you so much! will look into this - does this fix bones so meshes are skinned? since i noticed before the skeleton was flipped on the x axis for some reason

  • Author
  • Localization

hey @Durik256i noticed as well that there's a second UV map for overlays like logos on zeppelins and such - is there any chance you can include that? you should have .xs that have it, specifically zep_pandora and ss_boss_zep - that alongside the bones and mesh weights and this could be considered complete 🙂 

 

edit: h3x3r figured out the second uv part, but logos aren't correctly aligned or positioned for some reason. not sure why

 

def fixUVs(vbuf, uvScale):
    bs = NoeBitStream(vbuf)
    uvbuf = b''
    uvbuf1 = b''
    for x in range(len(vbuf)//32):
        bs.seek(16,1)
        u,v = bs.read('2h')
        u1,v1 = bs.read('2h')
        bs.seek(8,1)
        uvbuf += noePack('2f', u*uvScale, v*uvScale)
        uvbuf1 += noePack('2f', u1*uvScale, v1*uvScale)
        
    rapi.rpgBindUV1Buffer(uvbuf, noesis.RPGEODATA_FLOAT, 8)
    rapi.rpgBindUV2Buffer(uvbuf1, noesis.RPGEODATA_FLOAT, 8)

edit 2:

 

got the UV part fixed we think - all's left is skinning the bone fix.

full current code:

 

#by Durik256
from inc_noesis import *

def registerNoesisTypes():
    handle = noesis.register("Crimson Skies: High Road to Revenge (Retail, 2003)", ".x")
    noesis.setHandlerTypeCheck(handle, noepyCheckType)
    noesis.setHandlerLoadModel(handle, noepyLoadModel)
    noesis.logPopup()
    return 1

def noepyCheckType(data):
    return 1

def noepyLoadModel(data, mdlList):
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)
    rapi.rpgSetOption(noesis.RPGOPT_SWAPHANDEDNESS, 1)
    
    global nodes, materials
    nodes, materials = [], []
    
    bs.seek(32)
    readNode(bs)
    
    try:
        mdl = rapi.rpgConstructModel()
    except:
        mdl = NoeModel()
    
    #if nodes:
    #    nodes = rapi.multiplyBones(nodes)
    
    mdl.setBones(nodes)
    mdl.setModelMaterials(NoeModelMaterials([], materials))
    mdlList.append(mdl)
    return 1
    
def readNode(bs,parent=None,ptrfm=None):
    name = readString(bs)
    trfm = NoeMat43.fromBytes(bs.read(48)).transpose()
    if ptrfm:
        trfm *= ptrfm
    bbox = bs.read('6f')
    bs.read(4)# 3
    
    rapi.rpgSetName(name)
    rapi.rpgSetTransform(trfm) 
    for x in range(bs.readUInt()):
        readMesh(bs)
    
    nodes.append(NoeBone(len(nodes),name,trfm,parent))
    
    for x in range(bs.readUInt()):
        readNode(bs,name,trfm)
    
counter = 0
def readMesh(bs):
    global counter
    u0 = bs.readUInt()
    clr = bs.read('4B')
    u1 = bs.readUInt()
    u2 = bs.read('>i')[0]

    mat_name = 'mat_%i'%len(materials)
    mat = NoeMaterial(mat_name, '')
    mat.setDiffuseColor(NoeVec4([clr[0]/255,clr[1]/255,clr[2]/255,clr[3]/255]))

    dict = {0:0, 1:1, 3:2, 7:3, 17:2, 15:4, 19:3, 23:4, 31:5}
    numTx = dict[u2]
    
    for x in range(numTx):
        tx_name = readString(bs)
        if not x: mat.setTexture(tx_name)
    
    materials.append(mat)
    print('vstart:',bs.tell())
    vnum = bs.readShort()
    vbuf = bs.read(vnum*32)
    print('vend:',bs.tell())
    #bs.read('16B')
    _f = bs.read('4f')
    print(counter,'_f:',_f)#
    print('_f:',"%.6f" % _f[0])
    counter += 1
    if bs.readUByte():
        bs.seek(bs.readShort() * 12 * 4, 1)
       
    inum = bs.readShort()
    ibuf = bs.read(inum*2)
    
    rapi.rpgSetMaterial(mat_name)
    rapi.rpgBindPositionBuffer(vbuf, noesis.RPGEODATA_FLOAT, 32)
    #rapi.rpgBindUV1BufferOfs(vbuf, noesis.RPGEODATA_USHORT, 32, 16)
    fixUVs(vbuf, _f[0])
    fixUVs1(vbuf, _f[1])
    rapi.rpgCommitTriangles(ibuf, noesis.RPGEODATA_USHORT, inum, noesis.RPGEO_TRIANGLE)
    rapi.rpgClearBufferBinds()

    bs.seek(2, 1) #FF
    strip = bs.readUShort()
    bs.seek(strip*2, 1)

    if bs.readByte() == 1:
        size=16
        numUnk= bs.readInt()
    else:
        size=28
        numUnk= bs.readShort()
    bs.seek(numUnk*size, 1)
   
def fixUVs(vbuf, uvScale):
    bs = NoeBitStream(vbuf)
    uvbuf = b''
    for x in range(len(vbuf)//32):
        bs.seek(16,1)
        u,v = bs.read('2h')
        bs.seek(12,1)
        uvbuf += noePack('2f', u*uvScale, v*uvScale)

    rapi.rpgBindUV1Buffer(uvbuf, noesis.RPGEODATA_FLOAT, 8)

def fixUVs1(vbuf, uvScale):
    bs = NoeBitStream(vbuf)
    uvbuf1 = b''
    for x in range(len(vbuf)//32):
        bs.seek(20,1)
        u1,v1 = bs.read('2h')
        bs.seek(8,1)
        uvbuf1 += noePack('2f', u1*uvScale, v1*uvScale)

    rapi.rpgBindUV2Buffer(uvbuf1, noesis.RPGEODATA_FLOAT, 8)
    
def readString(bs):
    return bs.read(bs.readUInt()).split(b'\x00')[0].decode('ascii', 'ignore')

 

Edited by notameowcelot

  • Author
  • Localization

hey @Durik256is there any way to get the second uv's texture to apply in the noesis preview/export?

 

also h3x3r tried looking for skin mesh data but couldn't find anything oddly enough

  • Author
  • Localization

bump - @Durik256have you had time to look at the plugin? would be appreciated a ton 🙂

all we need is skinning fix plus the textures for second/third uv sets

  • 1 month later...
  • Author
  • Localization

@Durik256been a while - any chance you can update with skinning fix and proper material/second uv/third display?

 

cheers

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.