Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

General mod discussion and requests.
User avatar
FiftyTifty
Posts: 475
Joined: Tue Apr 09, 2013 7:36 pm

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by FiftyTifty » Mon Feb 10, 2020 2:41 am

RoyBatty wrote:
Sun Feb 09, 2020 8:32 pm
Maybe the code can be patched somehow, but iirc the facegen code is optimized and hard to decode. Possibly stewie can look into it.
It's not an issue of the code, it's just the EGT layers themselves. Just need to figure out how each one is used, then properly remove the green-blue tint from them.

User avatar
RoyBatty
Gary
Posts: 7096
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by RoyBatty » Mon Feb 10, 2020 3:19 am

But, they are generated by GECK. The races are hardcoded internally.
Image

User avatar
FiftyTifty
Posts: 475
Joined: Tue Apr 09, 2013 7:36 pm

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by FiftyTifty » Tue Feb 11, 2020 9:34 am

RoyBatty wrote:
Mon Feb 10, 2020 3:19 am
But, they are generated by GECK. The races are hardcoded internally.
And we can extract then recompile them, without the GECK in the way. EGTPacker Is made specifically for that. The program is included in this mod's archive: https://www.nexusmods.com/oblivion/mods ... escription

That's how Oblivion Character Overhaul fixed the face tints, which were utterly horrendous in vanilla. Edited the layers after exporting them as .dds, and replaced them inside the .EGT file.

User avatar
RoyBatty
Gary
Posts: 7096
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by RoyBatty » Tue Feb 11, 2020 11:03 am

I don't think the egt versions are the same? I believe I tried this before. Maybe not... not sure. Requires investigation.
Image

User avatar
FiftyTifty
Posts: 475
Joined: Tue Apr 09, 2013 7:36 pm

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by FiftyTifty » Sun Aug 09, 2020 7:05 pm

I've managed to get ESRGAN running on my AMD GPU, so I'm taking a look at this again. Unfortunately, the .egt packer tool I linked from the Oblivion Nexusmods doesn't support Fallout New Vegas' .egt files. Any idea where to get the tool to unpack/pack these files?

Edit: Figured out the problem. You should not specify the extension .egt when unpacking an existing .egt file. Time to start poking around.

User avatar
RoyBatty
Gary
Posts: 7096
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by RoyBatty » Mon Aug 10, 2020 7:32 pm

zilav translated some of russian a bit better for me, some crucial information.

Code: Select all

It's a command line tool. It use is:

egtpacker <filename> pack/unpack m1/m2/m3

For the filename you must enter the name (and path) of the file without the extension. So headhuman.egt would be headhuman.

The second parameters selects whether you want to unpack the textures into seperate tga files or pack a group of 50 tga textures into a egt file.

The last parameter selects the method of texture extraction/insertion.

m1 - Extracts only the raw bitmap data as it's stored in the egt file as two's compliment bytes.
m2 - Offsets the bitmap data by 127. This makes any negative changes easier to see.
m3 - Blends in the base texture. You will definately get clipping and loose information using this technique. The base texture must be in the same directory as the egt file/tga files and have the name <filename>.tga.

Any tga files you use MUST NOT be compressed and must be saved in a bottom up order. (this means upside down!)

You must also make sure you repack the egt file in the same format as you unpacked it. (Fallout 3/NV uses m2 afaik)

Any tga files that are unpacked by the unpack command use the file name format <filename><texture number>.tga and must be named this way for packing.

When unpacking the egt file the program will create a <filename>.txt file. This contains the extra data that's inside the egt file. This file is needed to re-pack the tga files into an egt file.
Image

User avatar
FiftyTifty
Posts: 475
Joined: Tue Apr 09, 2013 7:36 pm

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by FiftyTifty » Tue Aug 11, 2020 4:54 pm

RoyBatty wrote:
Mon Aug 10, 2020 7:32 pm
-snip-
Aye that tidbit about flipping the image vertically is important. Now I've identified two possible .egt layers that cause the green and blue colours on African American NPCs: 07 and 11. I've upscaled the layers with both Topaz Gigapixel, and ESRGAN, with ESRGAN having the least number of artifacts on the high contrast layers.

Also, layer 00 is the layer used when the race is 100% Caucasian and 100% female. I'm going to try editing the layers a couple at a time, to figure out how each layer is used by Facegen. Here they are after upscaling, but before modifying them further:

07
Image

11
Image

Now after converting them all back to .tga, copying over the .txt file, and having egtpacker.exe in the same folder, the command egtpacker headhuman pack m2 doesn't work, with egtpacker saying "error opening tga files". I suspect this is due to XNView not converting them correctly, but I can't find any other working converters for tga files.

Any ideas?

Edit: After some more digging, I found a very interesting mod for Oblivion: https://www.nexusmods.com/oblivion/mods/35487

the_philanthropy Edited the EGT layers so that they were only localized to a specific part of the face, which remedied Oblivion's horrific face textures. As an example, here are the modified textures for layers 07 and 11:

07
Image

11
Image

I'd love to dig around with this, but until I can get egtpacker to actually pack the layers, I can't investigate this stuff.

User avatar
RoyBatty
Gary
Posts: 7096
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by RoyBatty » Tue Aug 11, 2020 9:49 pm

Yeah the TGA has to be uncompressed and a certain format, keep experimenting, this will be great to know and fix that too. Can also fix the neck seams this way, I believe there is a mod for oblivion which does that.
Image

User avatar
FiftyTifty
Posts: 475
Joined: Tue Apr 09, 2013 7:36 pm

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by FiftyTifty » Tue Aug 11, 2020 11:03 pm

Right-o. Got to fairly low level digging, and here's what I've found so far.

The header of a .tga file is as follows:

Code: Select all

byte  identsize;          // size of ID field that follows 18 byte header (0 usually)
byte  colourmaptype;      // type of colour map 0=none, 1=has palette
byte  imagetype;          // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
word colourmapstart;     // first colour map entry in palette
word colourmaplength;    // number of colours in palette
byte  colourmapbits;      // number of bits per palette entry 15,16,24,32
word xstart;             // image x origin
word ystart;             // image y origin
word width;              // image width in pixels
word height;             // image height in pixels
byte  bits;               // image bits per pixel 8,16,24,32
byte  descriptor;         // image descriptor bits (vh flip bits)
After taking a look at the header, the problem with the XNView output is the very last byte in the header is 20, whereas we need it to be 0, which is what the original .tga files have. No idea what that actually means, but it's the only difference between the headers after resizing them down to 256x256 just to be sure.

Both XNView and ImageMagick output the .tga files with the incorrect header, and I'd really rather not save an ungodly amount of images over time with Photoshop, at least in the investigation phase. Gonna ask on the ImageMagick forums if there's something that can be done.

User avatar
RoyBatty
Gary
Posts: 7096
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

Re: Why bLoadFaceGenHeadEGTFiles=0 is dumb [image heavy]

Post by RoyBatty » Thu Aug 13, 2020 8:40 pm

Nice. Keep it up!
Image

Post Reply