• PS2 "Swizzled" Textures & Color Palettes
    2 replies, posted
[B]Update 6:45pm: Figured it out, nevermind![/B] [U]Cliffnotes at the bottom, otherwise, here's the long version:[/U] I was wondering if anyone here has experience with swizzling/unswizzling textures that may or may not originate from a PS2-platform game. The swizzling/unswizzling part is already taken care of, but now I have to figure out how to incorporate color palettes. This is where things are getting a bit tricky for me and I do not know how to continue from here. Here's what I get when I unswizzle an image (this is an older image and has junk at the top): [IMG]https://dl.dropboxusercontent.com/u/69162797/driver/driv3r/d3ps2_unswizzled8%20%282%29.bmp[/IMG] Through WAYWO, I found out about the indexes into the color palette: So basically, each "pixel" represents an index to a color in the color palette. In order to be able to use the palette information, I used [B]Console Texture Explorer[/B], which allows me to accomplish this: [IMG]https://dl.dropboxusercontent.com/u/69162797/driver/driv3r/ps2-tex-format.jpg[/IMG] I put some notes in there in case it's needed. Here's 1024 bytes of the palette data: [CODE] Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00014D80 B1 96 77 7F DD DF DA 7F 9B 9C 97 79 B4 B6 B0 7F ±–w.ÝßÚ.›œ—y´¶°. 00014D90 C1 C3 C4 80 BA DB BA 80 D6 E2 D8 80 F0 E8 D2 80 ÁÃÄ€ºÛº€ÖâØ€ðèÒ€ 00014DA0 78 F0 77 80 71 F1 71 80 77 ED 77 80 79 F5 78 80 xðw€qñq€wíw€yõx€ 00014DB0 78 F1 77 80 79 F4 78 80 7A F6 7A 80 9A F5 9D 80 xñw€yôx€zöz€šõ.€ 00014DC0 49 F7 4A 7F 06 F4 06 80 59 19 19 7F 06 F7 06 80 I÷J..ô.€Y....÷.€ 00014DD0 13 E5 11 80 1E DD 1A 80 37 F6 38 80 3B F7 3C 80 .å.€.Ý.€7ö8€;÷<€ 00014DE0 71 6C 59 80 77 71 63 80 95 75 5A 80 85 82 70 80 qlY€wqc€•uZ€…‚p€ 00014DF0 9B 9D 96 80 AF A8 96 80 7F 14 18 7E C6 B7 9E 80 ›.–€¯¨–€...~Æ·ž€ 00014E00 07 06 06 80 0A 09 08 80 12 11 0C 80 15 17 11 80 ...€...€...€...€ 00014E10 1A 1B 18 80 1F 1F 1B 80 2B 2C 27 80 2F 2D 29 80 ...€...€+,'€/-)€ 00014E20 2A 31 2E 80 31 37 34 80 35 3D 39 80 38 41 3D 80 *1.€174€5=9€8A=€ 00014E30 4B 42 3B 80 3D 46 42 80 40 4A 47 80 43 4B 47 80 KB;€=FB€@JG€CKG€ 00014E40 23 24 1F 80 2A 2B 28 80 27 27 1F 80 2B 2D 2A 80 #$.€*+(€''.€+-*€ 00014E50 65 17 14 80 5C 14 13 80 7C 1B 19 80 80 1C 1B 80 e..€\..€|..€€..€ 00014E60 50 27 22 80 59 18 16 80 82 15 15 80 84 0F 13 80 P'"€Y..€‚..€„..€ 00014E70 5A 51 46 80 68 5E 4E 80 40 84 40 80 3C 94 41 80 ZQF€h^N€@„@€<”A€ 00014E80 56 56 4D 7C 6A 68 5E 7F 81 82 7C 7F 80 82 7A 7F VVM|jh^..‚|.€‚z. 00014E90 A5 A9 A7 7F B6 BA BA 7F 9B 9D 99 7F B6 B9 B7 7F ¥©§.¶ºº.›.™.¶¹·. 00014EA0 63 63 5A 7F 66 65 5C 7F 72 73 6E 7F 72 73 6C 7F ccZ.fe\.rsn.rsl. 00014EB0 7D 7F 7B 7F 7E 80 7C 7F 7D 7E 7A 7F 87 89 82 7F }.{.~€|.}~z.‡‰‚. 00014EC0 68 68 5F 7F 68 68 60 7F 7E 7F 79 7E 7C 7D 7A 7F hh_.hh`.~.y~|}z. 00014ED0 6F 70 68 7F 72 73 6C 7F 7A 7B 77 7F 86 87 84 7F oph.rsl.z{w.†‡„. 00014EE0 7A 7B 76 7F 83 85 82 7F 7E 7F 7C 7F 88 89 86 7F z{v.ƒ…‚.~.|.ˆ‰†. 00014EF0 6B 6A 61 7F 74 75 6F 7F 86 87 82 7F 88 89 83 7F kja.tuo.†‡‚.ˆ‰ƒ. 00014F00 61 9D 61 58 69 AD 6C 5E 65 BE 68 64 6B C6 6D 68 a.aXi.l^e¾hdkÆmh 00014F10 70 EF 6F 7F 7A F0 79 7F 89 F4 8A 7F A7 F6 A9 7F pïo.zðy.‰ôŠ.§ö©. 00014F20 A6 A8 A5 7F AE B0 AE 7D AE AC A5 7A B9 BB B7 7D ¦¨¥.®°®}®¬¥z¹»·} 00014F30 C7 CA C8 7F D8 D9 D6 7F C3 CB C3 7F C2 C1 B8 7E ÇÊÈ.ØÙÖ.ÃËÃ.ÂÁ¸~ 00014F40 8C 8D 88 7F 97 99 94 7F 91 93 8D 7F 9B 9C 99 7F Œ.ˆ.—™”.‘“..›œ™. 00014F50 92 96 94 5C 9F A2 A1 62 A7 AA A6 7E BA BC B8 7F ’–”\Ÿ¢¡b§ª¦~º¼¸. 00014F60 E6 E8 E6 7F EF F2 F1 7F D2 D4 D1 7F DE E0 DD 7F æèæ.ïòñ.ÒÔÑ.ÞàÝ. 00014F70 F0 F1 F0 7F E7 E8 E5 7F F3 F5 F3 7F F6 F8 F6 7F ðñð.çèå.óõó.öøö. 00014F80 07 06 07 00 0D 0D 0D 02 0C 0D 0C 01 13 15 13 07 ................ 00014F90 15 17 15 07 17 19 18 0D 1B 1E 1F 11 20 25 23 18 ............ %#. 00014FA0 2F 41 31 2A 39 3D 3B 26 3A 56 3C 3A 3D 69 40 46 /A1*9=;&:V<:=i@F 00014FB0 33 4A 35 33 35 50 37 36 48 4D 4C 2F 5A 60 5C 3F 3J535P76HML/Z`\? 00014FC0 15 17 15 08 16 19 16 09 28 30 29 1F 2B 38 2D 25 ........(0).+8-% 00014FD0 15 17 15 08 16 18 16 0A 31 3A 32 27 47 4C 4A 31 ........1:2'GLJ1 00014FE0 3B 60 3D 41 3D 6A 40 47 39 5B 3B 3D 3B 60 3D 3F ;`=A=j@G9[;=;`=? 00014FF0 3E 6E 40 49 3E 6B 3F 47 3F 77 41 4D 40 79 41 4F >n@I>k?G?wAM@yAO 00015000 08 08 07 7F 15 15 11 7F 23 18 14 53 23 20 18 7F ........#..S# .. 00015010 33 30 26 7F 2F 32 31 7E 2A 2A 25 7F 41 37 28 7F 30&./21~**%.A7(. 00015020 2B 2A 25 7F 38 39 34 7F 43 44 41 7D 4A 49 43 7E +*%.894.CDA}JIC~ 00015030 39 3A 35 7F 45 41 39 7F 32 31 2A 7F 4F 4A 40 7F 9:5.EA9.21*.OJ@. 00015040 4D 14 12 74 7B 17 18 7F 31 30 29 7F 38 39 35 7F M..t{...10).895. 00015050 43 38 32 5D 39 4D 3A 6B 4A 49 41 7D 3F 40 3B 7F C82]9M:kJIA}?@;. 00015060 54 4F 43 7E 5B 5C 50 7E 5F 51 42 7F 64 60 52 7F TOC~[\P~_QB.d`R. 00015070 67 68 5F 7F 73 6C 5B 7F 72 73 6A 7F 83 7D 6C 7F gh_.sl[.rsj.ƒ}l. 00015080 40 85 42 55 3F 8B 41 58 40 84 41 54 3F 8C 41 58 @…BU?‹AX@„AT?ŒAX 00015090 3E 6B 3F 48 3D 66 3C 44 40 83 41 54 40 83 42 54 >k?H=f<D@ƒAT@ƒBT 000150A0 3E 95 40 5D 3E 95 40 5D 3C 9C 3E 60 3C 9E 3D 61 >•@]>•@]<œ>`<ž=a 000150B0 39 A9 3A 66 39 A9 3A 66 37 B0 38 6A 38 AB 39 68 9©:f9©:f7°8j8«9h 000150C0 51 57 55 38 47 71 5A 49 79 67 36 47 83 65 36 47 QWU8GqZIyg6Gƒe6G 000150D0 5B 63 64 42 62 6E 71 48 6F 74 71 4A 7D 81 7F 51 [cdBbnqHotqJ}..Q 000150E0 3B A2 3D 63 3C 9F 3D 62 3D 99 3E 5F 3E 95 3F 5D ;¢=c<Ÿ=b=™>_>•?] 000150F0 3A A5 3B 65 3A A6 3B 65 3D 9A 3E 60 3C 9E 3E 61 :¥;e:¦;e=š>`<ž>a 00015100 3D 9C 3E 60 3D 97 3F 5E 39 A9 3A 67 3A A6 3B 65 =œ>`=—?^9©:g:¦;e 00015110 40 83 42 54 3F 8F 41 5A 40 7F 42 52 3F 8E 41 5A @ƒBT?.AZ@.BR?ŽAZ 00015120 06 E5 06 79 18 D1 18 79 2A C5 2A 74 30 BE 31 70 .å.y.Ñ.y*Å*t0¾1p 00015130 06 EB 06 7A 06 F1 06 7C 06 F5 06 7E 23 F6 23 7E .ë.z.ñ.|.õ.~#ö#~ 00015140 3C 9E 3D 61 39 A8 3B 66 3C 9D 3E 61 3D 99 3F 5F <ž=a9¨;f<.>a=™?_ 00015150 3A A6 3B 65 3A A7 3B 66 3B A0 3D 62 3A A4 3C 64 :¦;e:§;f; =b:¤<d 00015160 35 B5 36 6C 2F C1 2F 71 37 AF 38 69 35 B3 36 6B 5µ6l/Á/q7¯8i5³6k 00015170 2F BE 30 70 32 BA 33 6F 35 B5 35 6B 36 B1 37 6A /¾0p2º3o5µ5k6±7j [/CODE] They look a lot like floats, and 1024 / 4 = 256. So there's 256 floats, or in other words, 256 color entries. But how would data for RGBA be inside of a float value? You can probably see why I'm really lost. Is there anyone that can help this clueless bastard out? I wish there was more documentation regarding swizzling, but I just can't find any. [B][U]Cliffnotes:[/U][/B] - Format provides offset for texture and palette data (amongst others, see image above) - I can unswizzle the texture data, but don't know how to parse palette data - Palette data seems to be a list of 256 floats - How can a float value hold RGBA data? Sorry for the long post, just didn't want to leave anything out.
They're most likely not floats.
[QUOTE=dajoh;42590232]They're most likely not floats.[/QUOTE] I actually just found out a possible decoder: [url]http://code.google.com/p/puyotools/source/browse/trunk/PTImgLib/VrSharp/Svr/SvrPaletteDecoder.cs?r=93[/url] I'm going to see if this is what I'm looking for. [B]Update:[/B] Yeah, that did it: [IMG]https://dl.dropboxusercontent.com/u/69162797/driver/driv3r/d3PS2_unswizzled.bmp[/IMG] Needs a few minor tweaks, but I read the palette! I will update the OP when I get back. At least I finally figured it out!
Sorry, you need to Log In to post a reply to this thread.