don't click here

Sonic Heroes texture editing just became a whole lot more practical

Discussion in 'Engineering & Reverse Engineering' started by Herm the Germ, Sep 14, 2010.

Thread Status:
Not open for further replies.
  1. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    Anyone who's ever tried editing level or object textures on Sonic Heroes knows what a pain in the ass mipmaps can be. Well, no more.

    Here's what I did. I edited some level textures within a TXD-file using Vice TXD. Then, I opened up said TXD file using TXD Workshop (v4.0b, not sure if older versions would corrupt things or not). In the lower right hand corner, I selected "GTA VC" and then hit the "Save TXD" button again. Et voilĂ , those bothersome mip maps are gone.
    However, there's a catch -- it doesn't work well with all level texture TXDs. So far, I can confirm that it works for Power Plant (Stage 04) and Hang Castle (Stage 11), as well at the common objects file (obj_common).
     
  2. Hey, that's cool.

    What causes the mipmap problem? They're not automatically generated by the game, but rather pregenerated and loaded from the texture file? Can you show pictures comparing how it was before/how it is after the fix?

    I couldn't find a lot of info on Sonic Heroes Hacking, or on the mipmap problem...
     
  3. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    I'll try to assemble a few good comparison pictures by tomorrow.

    Generally, here's the gist of it: The mipmaps are stored along the other textures within the TXD-archives. However, the tools we do have available either eliminate those mipmaps (TXD Workshop) or only replace the base-level-texture, but retain the mipmaps (Vice TXD). The former is the more desirable solution, as the game can actually perform without mipmaps, but it will make it look a tad bit uglier with some textures (especially animated water textures).
    The latter makes the texture edits visible only up close to the camera, as the mipmaps, of course, kick in the further away the camera is, creating some really cool dimensional-distortion type effect, but retaining otherwise little use in real texture editing.
    TXD Workshop would be ideal for replacing entire batches of textures, but (at least on my computer) it has a big flaw: It cannot read game-provided TXD archives which store big textures (say, 512x512, which I believe is the biggest texture size stored within the game). When attempting to, it will report an "Out of Memory While Expanding Memory Stream" error message.

    Now (and this is new development only achieved some time last night), however, I figured out a solution if you are a "victim" of this bug. Simply rebuild the entire TXD archive!
    ... okay, it's not so "simple". What you got to do is extract all the regular textures and their alphas into one big folder, then re-insert them, file by file, into a new TXD Archive using "Vice TXD" (TXD Workshop has a tendency to crash while attempting this). Be sure to retain all the original filenames.
    Now, after you made a back up of your old txd archive and replaced it with your new one, you can test your Stage textures on Sonic Heroes...
    ... only to realize that the game "cannot create world" or something like that.
    NOW you open up your new texture archive in TXD Workshop, click on the drop-down menu on the lower right, and select "GTA VC," then hit the Save button again. FINALLY, it should work as intended.

    Hope this is helpful to some people out there. If I am not mistaken, this can be used on just about everything, from menu textures, to characters, bosses, special effects, common objects, etc.

    EDIT: Now, isn't this a much better fleet? :v:
     
  4. Haha, cool. That many Death Eggs almost made me shiver. I don't know, maybe a sequel to Sonic 3 back then could have Eggman building and launching enourmous amounts of Death Eggs.

    EDIT: I was looking, TXD is proprietary to Renderware. Did they relase the specs for the format publicly? If so, maybe someone could write a tool to automate that.
     
  5. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    Well, far as I can tell, there ain't much in the line of official software, and even the unofficial stuff is only satisfying to some degree, but that may just be me.

    Either way, I figured out some new stuff, regarding the way Sonic Heroes lights stuff. I tested what little hex-editing skills I have on the file "s27_light.bin," which would give light to the Metal Madness stage (or not, if you fuck up).

    I apologize for my cruddy hex-explanations. If I format the offsets wrong, I apologize, as well.

    The file appears to begin with

    Code (Text):
    1. XX YY 00 00   XX YY 00 00   XX YY 00 00
    XX seems to stand for the light-intensity of some sort... if all of these are below 3E, characters (with the exception of their gloss-files, or "Pohn", and when lighted by lightning as is the case on the Metal Madness stage) will be entirely wrapped in black (pun intended). These values appear to follow the regular RGB scheme, as putting a higher value into the last of these three and leaving the others below 3E turned the characters into an obnoxious blue.

    YY appears to stand for general light-values, also according to RGB standard.

    So...

    Code (Text):
    1. 3F 00 00 00   3F 10 00 00   3F 30 00 00
    Would tint our heroes and the objects around them a slight blue, but still have them fittingly visible.

    Similarily,

    Code (Text):
    1. 3F 99 00 00   3F 10 00 00   3F 13 00 00
    Gives us a more red-ish tone of color, kinda like on that 2P-Seaside-Hill.

    There's more lighting data at $000000D0, $000001a0 and $00000270, which probably control the lights on enemies, objects, the actual stage textures etc., but I am not yet sure which does which.

    If I messed up with any of these explanations, please, slap and correct me. :specialed:
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    Those appear to be standard big-endian single-precision floating point values.
    So
    Code (Text):
    1. 3F 00 00 00   3F 10 00 00   3F 30 00 00
    is actually
    Code (Text):
    1. 0.5   0.5625   0.6875
    + - And yet again, I am the only person that can tell when something is a float by looking at it.  
     
  7. Covarr

    Covarr

    Sentient Cash Register Member
    4,233
    3
    18
    Trapped in my own thoughts.
    Two stageplays, a screenplay, and an album
  8. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    Well, sadly, I cannot create new mipmaps with what I have available. I can only destroy 'em. =/

    EDIT: Hexplorer's "Simple Data Types" viewer plus some hex<->floating point converters seems to confirm what Main Memory figured out brilliantly there, props to you. ... now to figure out how I can make that to be of use to me.
     
  9. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    [​IMG]

    Now, in my personal opinion, that doesn't look half-bad, however, the eyes kinda bug me... There isn't some miracle by which it is possible to make them glow, too, is there?
     
  10. Aquaslash

    Aquaslash

    <The Has-been Legend> Moderator
    If you ever get Knuckles shoes not to use the same color as his fur, let me know so I can jump all over that.
     
Thread Status:
Not open for further replies.