XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Wed May 23, 2018 11:47 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Tue Feb 02, 2016 7:35 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times

[out]

You can make the ads go away by registering



Last edited by Wobble on Sun Mar 12, 2017 10:50 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Tue Feb 02, 2016 10:37 pm 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1088
Has thanked: 2127 times
Have thanks: 598 times
That was a valiant effort Wobble, thanks! :gulp:
maybe MrAdults could step in and offer some advice on this or a quick solution.

edit
should there be anything in the code about Endianess?
The fmt_star_wars_kinect_tga.py plugin for Kinect Star Wars textures might hold the key

viewtopic.php?f=16&t=8714
Code:
...
   #DXT1
   if imgFmt == 0x28:
      data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
      texFmt = noesis.NOESISTEX_DXT1
   #DXT5
   elif imgFmt == 0x33:
      data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
      texFmt = noesis.NOESISTEX_DXT5
   #DXT5 packed normal map
   elif imgFmt == 0x1C:
      data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
      data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_ATI2)
      texFmt = noesis.NOESISTEX_RGBA32
   #DXT5 packed normal map2
   elif imgFmt == 0x36:
      data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
      data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_ATI1)
      texFmt = noesis.NOESISTEX_RGBA32
   #DXT1 packed normal map
   elif imgFmt == 0x16:
      data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
      data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_DXT1NORMAL)
      texFmt = noesis.NOESISTEX_RGBA32
   #raw
   elif imgFmt == 0x1B:
      data = rapi.imageUntile360Raw(rapi.swapEndianArray(data, 4), imgWidth, imgHeight, 4)
      texFmt = noesis.NOESISTEX_RGBA32
   #unknown, not handled
...

_________________
Noesis
Hex2obj
QuickBMS
Unity Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 3:31 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:50 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 4:08 am 
Offline
mega-veteran
mega-veteran

Joined: Sun Aug 22, 2010 10:14 pm
Posts: 161
Has thanked: 35 times
Have thanks: 11 times
Wobble wrote:
Woohoo, you got it!

Attachment:
62e82b02_solo_face_1024.JPG


The data needs to be endian swapped before passing it to unswizzle functions.

But, it's not perfect. The pixels are still very jagged. I don't know if this is how the original texture is supposed to look like on the XBox 360,
or if the unswizzle function is not unswizzling the entire image.


It seems like maybe it's pixelated like that cause the head is maybe 512x512 and not 1024x1024.

But great job this is really amazing now we just need a proper importer for noesis for the models.


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 9:19 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:51 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 4:48 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:51 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 7:29 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:51 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 10:02 pm 
Offline
mega-veteran
mega-veteran

Joined: Sun Aug 22, 2010 10:14 pm
Posts: 161
Has thanked: 35 times
Have thanks: 11 times
Wobble wrote:
Last one:
- Added filename argument scanning for zero headers. Arguments must be separated by spaces.

Attachment:
x2t_image.zip


Code:
<filename> <width> <height> <bpp> <format>.x2t


This is really amazing it's just sad they didn't extract with the proper file names cause going down through noesis to find textures you want is pretty hard since there are so many.


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 10:37 pm 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1088
Has thanked: 2127 times
Have thanks: 598 times
The textures were extracted with the names that were stored in the str file, and these same names are referenced in the rax files, the names are correct for this build.

_________________
Noesis
Hex2obj
QuickBMS
Unity Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Wed Feb 03, 2016 11:08 pm 
Offline
mega-veteran
mega-veteran

Joined: Sun Aug 22, 2010 10:14 pm
Posts: 161
Has thanked: 35 times
Have thanks: 11 times
AceWell wrote:
The textures were extracted with the names that were stored in the str file, and these same names are referenced in the rax files, the names are correct for this build.


Ah okay,

Well i found something that isn't right compared to one of the textures i already had to one i just exported.

The one i have here is 2048x2048 and the one i converted is 1024x1024.

Now i know the plugin isn't fully finished but i thought i'd point this out to help you fix it.

Pre-alpha 1024x1024
Image

Final 2048x2048
Image


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Thu Feb 04, 2016 3:20 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Fri Feb 05, 2016 7:17 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1088
Has thanked: 2127 times
Have thanks: 598 times
I was just comparing the Kinect Star Wars tga python script with your x2t_image.cpp and was wondering if image_bpp/8 should be image_bpp/4 instead for untile raw
Code:
// Uncompressed

if(image_format == 3) {

    //                                   BYTE *dst,    BYTE *src, int dstSize,   int imgW,     int imgH, int bytesPerPix
    rapi->Noesis_UntileImageRAW( unswizzled_buffer, image_buffer, image_size, image_width, image_height, (image_bpp/8) );
}



fmt_star_wars_kinect_tga.py
Code:
#raw
   elif imgFmt == 0x1B:
      data = rapi.imageUntile360Raw(rapi.swapEndianArray(data, 4), imgWidth, imgHeight, 4)
      texFmt = noesis.NOESISTEX_RGBA32

_________________
Noesis
Hex2obj
QuickBMS
Unity Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Sat Feb 06, 2016 4:22 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:56 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Sat Feb 06, 2016 4:43 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Tue Jan 04, 2005 9:47 pm
Posts: 585
Has thanked: 43 times
Have thanks: 112 times
[out]


Last edited by Wobble on Sun Mar 12, 2017 10:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [X360] Star Wars Battlefront III pre-alpha (*.x2t)
PostPosted: Sun Feb 07, 2016 1:18 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1088
Has thanked: 2127 times
Have thanks: 598 times
this is what MrAdults says here viewtopic.php?p=115576#p115576
Quote:
There are lots of image processing scripts of this nature to use as examples over on the old Google Code depot.
The Gamebryo NIF script shows how to do all kinds of untiling including 360-style and straight up Morton order. Use rapi.swapEndianArray to quickly endian-swap DXT blocks as commonly needed on the 360, this is demonstrated in the BulletWitch script in cprLoadTexture.



Wobble wrote:
The problem is with the imageUntile360Raw() function. It doesn't seem work for these textures.
Can't do nothing about it, because we don't know how it works. It is based on Morton order or something else?

maybe it does have something to do with Morton order. :scaredy:

this is a snip from the fmt_gamebryo_nif.py script that i think MrAdults was talking about, morton untile is near the end
Code:
#run through and convert texture data
      pixObject = nif.objects[texObject.pixLinkID]
      noeFmt = noesis.NOESISTEX_UNKNOWN
      pixelFormatObj = noeSafeGet(pixObject, "pixelFormat")
      if pixelFormatObj is None:
         print("WARNING: Object", texObject.pixLinkID, "type", pixObject.typeName, "should have contained a pixel format, but didn't.")
         continue
      pixelFormat = pixelFormatObj.format
      imageData = pixObject.imageData
      
      pixelImageInfo = [pixObject.numFaces, pixObject.mipLevels, pixObject.mipsTotalSize, pixObject.mipInfo]
      
      if pixelFormat == NIFTEX_RGB:
         noeFmt = noesis.NOESISTEX_RGBA32
         imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageDecodeRaw, "r8g8b8")
      elif pixelFormat == NIFTEX_RGBA:
         noeFmt = noesis.NOESISTEX_RGBA32
         if pixObject.platform == NIF_PLATFORM_PS3: #alpha first on ps3 (or so we not always correctly assume)
            imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageDecodeRaw, "a8r8g8b8")
         elif pixObject.platform == NIF_PLATFORM_XBOX360: #another potentially-faulty assumption - bgra for 360
            imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageDecodeRaw, "b8g8r8a8")
      elif pixelFormat == NIFTEX_DXT1:
         noeFmt = noesis.NOESISTEX_DXT1
      elif pixelFormat == NIFTEX_DXT3:
         noeFmt = noesis.NOESISTEX_DXT3
      elif pixelFormat == NIFTEX_DXT5:
         noeFmt = noesis.NOESISTEX_DXT5
      elif pixelFormat == NIFTEX_MONO:
         #expand out to rgba32
         noeFmt = noesis.NOESISTEX_RGBA32
         imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageDecodeRaw, "r8")
         imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageKernelProcess, 4, nifImageExpandMonoColorKernel)
      else:
         print("WARNING: Unsupported texture format", pixelFormat)

      if noeFmt != noesis.NOESISTEX_UNKNOWN:
         if pixelFormatObj.tiling != 0:
            #lots of games seem to have bad mip offsets when using tiling/swizzling modes,
            #which don't take into account necessary platform-specific padding. so, sadly,
            #we'll have to skip the mips.
            pixelImageInfo[1] = 1
         
         if pixelFormatObj.tiling == 1:
            #360 untile
            if noeFmt == noesis.NOESISTEX_RGBA32:
               imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageUntile360Raw, 4)
            else: #dxt
               imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageUntile360DXT, 8 if noeFmt == noesis.NOESISTEX_DXT1 else 16)
         elif pixelFormatObj.tiling == 3:
            #morton untile
            if noeFmt == noesis.NOESISTEX_RGBA32:
               imageData = noeProcessImage(imageData, pixelImageInfo, rapi.imageFromMortonOrder, 4, 2 if pixObject.platform == NIF_PLATFORM_VITA else 0)
            else: #dxt
               dxtBlockBytes = 4 if noeFmt == noesis.NOESISTEX_DXT1 else 8
               imageData = rapi.imageFromMortonOrder(imageData, pixObject.width>>1, pixObject.height>>2, dxtBlockBytes)
               #possible todo - support untiling dxt blocks with multiple mips/faces
               pixelImageInfo[0] = 1
               pixelImageInfo[1] = 1
               



_________________
Noesis
Hex2obj
QuickBMS
Unity Studio
TextureFinder


Last edited by AceWell on Mon Feb 08, 2016 2:27 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group