Author Topic: Sgt.Kelly BFG Textures  (Read 2446 times)

0 Members and 1 Guest are viewing this topic.

oneofthe8devilz

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +93/-84
  • Doom Newbie
    • View Profile
    • Scared Pixel Studios
Sgt.Kelly BFG Textures
« on: April 21, 2015, 10:45:39 AM »
Was someone able to extract ALL textures (diffuse, normal, bump, specular) for Sgt.Kelly's Head and Body from the BFG edition ?

I like the new "younger" looking version and would like to add it to my pool of selectable player models/skins...



I got six little friends and they all run faster than you ;)


Check out our mods at
moddb or the SPS Homepage

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: Sgt.Kelly BFG Textures
« Reply #1 on: April 21, 2015, 02:46:48 PM »
I'm afraid that if you want that you'll be forced to look into the source code on how to the engine does it and replicate the process. :(

oneofthe8devilz

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +93/-84
  • Doom Newbie
    • View Profile
    • Scared Pixel Studios
Re: Sgt.Kelly BFG Textures
« Reply #2 on: April 21, 2015, 03:13:49 PM »
I am quite sure there are ways to "grab" engine render calls that would allow you to take/grab shots of the textures used during rendering...
« Last Edit: April 22, 2015, 07:25:43 AM by oneofthe8devilz »
I got six little friends and they all run faster than you ;)


Check out our mods at
moddb or the SPS Homepage

TeaMonster

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: Sgt.Kelly BFG Textures
« Reply #3 on: April 23, 2015, 04:32:54 AM »
Can't you extract the level assets and find them that way?

oneofthe8devilz

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +93/-84
  • Doom Newbie
    • View Profile
    • Scared Pixel Studios
Re: Sgt.Kelly BFG Textures
« Reply #4 on: April 23, 2015, 08:20:51 AM »
As far as I know for D3 BFG most textures are in binary format...
I got six little friends and they all run faster than you ;)


Check out our mods at
moddb or the SPS Homepage

motorsep

  • Hero Member
  • *****
  • Posts: 972
  • Karma: +74/-128
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Sgt.Kelly BFG Textures
« Reply #5 on: April 23, 2015, 12:31:15 PM »
not only, they are also compressed with different methods.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: Sgt.Kelly BFG Textures
« Reply #6 on: April 23, 2015, 07:12:51 PM »
I guess the best bet is to look in the code, the decoding should be there, and replicate that code in a small app to extract textures.

motorsep

  • Hero Member
  • *****
  • Posts: 972
  • Karma: +74/-128
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Sgt.Kelly BFG Textures
« Reply #7 on: April 23, 2015, 07:46:05 PM »
But you can't - just like you can't recreated TGA from JPG, you can't recreate lossless original TGA from DXT compressed image. Perhaps you could turn .bimage into DXT image (.dds), but it's also unlikely and will still leave you with unusable image. Note that all diffuse is encoded with YCoCg DXT5, which isn't supported by Doom 3 anyway.

trebor

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +14/-7
  • Boomstick Veteran
    • View Profile
Re: Sgt.Kelly BFG Textures
« Reply #8 on: April 24, 2015, 05:57:32 AM »
You can extract all images back to .png in void idImage::ActuallyLoadImage( bool fromBackEnd )
by adding

if( image_exportPNG.GetBool() && binaryFileTime != FILE_NOT_FOUND_TIMESTAMP )
   {
      const bimageImage_t& img = im.GetImageHeader( 0 );
      
      const byte* data = im.GetImageData( 0 );
      
      //( img.level, 0, 0, img.destZ, img.width, img.height, data );
      
      idTempArray<byte> rgba( img.width * img.height * 4 );
      memset( rgba.Ptr(), 255, rgba.Size() );
      
      if( header.format == FMT_DXT1 )
      {
         idDxtDecoder dxt;
         dxt.DecompressImageDXT1( data, rgba.Ptr(), img.width, img.height );
         
         if( header.colorFormat == CFM_GREEN_ALPHA )
         {
            byte* pic = rgba.Ptr();
            for( int i = 0; i < img.width * img.height; i++ )
            {
               pic[i * 4 + 3] = pic[i * 4 + 1];
               pic[i * 4 + 0] = 255;
               pic[i * 4 + 1] = 255;
               pic[i * 4 + 2] = 255;
            }
         }
      }
      else if( header.format == FMT_DXT5 )
      {
         idDxtDecoder dxt;
         
         if( header.colorFormat == CFM_NORMAL_DXT5 )
         {
            dxt.DecompressNormalMapDXT5( data, rgba.Ptr(), img.width, img.height );
         }
         else if( header.colorFormat == CFM_YCOCG_DXT5 )
         {
            dxt.DecompressYCoCgDXT5( data, rgba.Ptr(), img.width, img.height );
         }
         else
         {
         
            dxt.DecompressImageDXT5( data, rgba.Ptr(), img.width, img.height );
         }
      }
      else if( header.format == FMT_LUM8 || header.format == FMT_INT8 )
      {
         // LUM8 and INT8 just read the red channel
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i * 4 ] = data[ i ];
         }
      }
      else if( header.format == FMT_ALPHA )
      {
         // ALPHA reads the alpha channel
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i * 4 + 3 ] = data[ i ];
         }
      }
      else if( header.format == FMT_L8A8 )
      {
         // L8A8 reads the alpha and red channels
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize / 2; i++ )
         {
            pic[ i * 4 + 0 ] = data[ i * 2 + 0 ];
            pic[ i * 4 + 3 ] = data[ i * 2 + 1 ];
         }
      }
      else if( header.format == FMT_RGB565 )
      {
         // FIXME
         /*
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize / 2; i++ )
         {
            unsigned short color = ( ( pic[ i * 4 + 0 ] >> 3 ) << 11 ) | ( ( pic[ i * 4 + 1 ] >> 2 ) << 5 ) | ( pic[ i * 4 + 2 ] >> 3 );
            img.data[ i * 2 + 0 ] = ( color >> 8 ) & 0xFF;
            img.data[ i * 2 + 1 ] = color & 0xFF;
         }
         */
      }
      else
      {
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i ] = data[ i ];
         }
      }
      
      idStr pngFileNameExport = generatedName;
      pngFileNameExport.SetFileExtension( ".png" );
      
      R_WritePNG( pngFileNameExport, rgba.Ptr(), 4, img.width, img.height, true, "fs_basepath" );
   }

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: Sgt.Kelly BFG Textures
« Reply #9 on: April 24, 2015, 10:07:11 AM »
But you can't - just like you can't recreated TGA from JPG, you can't recreate lossless original TGA from DXT compressed image. Perhaps you could turn .bimage into DXT image (.dds), but it's also unlikely and will still leave you with unusable image. Note that all diffuse is encoded with YCoCg DXT5, which isn't supported by Doom 3 anyway.
nobody said anything on getting the original assets fof which d3bfg distributed compressed textures where made of, but to extract those compressed images d3bfg uses and convert them to a format usable to vanilla d3, which should be doable with the help of the source code

you can create a TGA from a JPG but you won't get any benefit quality-wise, you will only get a non lossy file form that version of the data, which is the point of TGA

motorsep

  • Hero Member
  • *****
  • Posts: 972
  • Karma: +74/-128
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Sgt.Kelly BFG Textures
« Reply #10 on: April 24, 2015, 10:39:34 AM »
Sure, I understand that. Just don't see a point in having bad quality assets :/

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: Sgt.Kelly BFG Textures
« Reply #11 on: April 24, 2015, 06:38:49 PM »
it should be the most high quality given the BFG compressed content, if you want to use this content you have to put up with it's compression artefacts isn't it? the thing is to don't add more artefacts to the equation.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 866
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Sgt.Kelly BFG Textures
« Reply #12 on: April 25, 2015, 09:09:47 AM »
Even if the extracted textures are converted to TGA to use in original Doom 3, unless you run on Ultra (or change whatever cvar it needed) it will re-compress for you.

From a technical standpoint, I'd be interested to see the extracted textures compared to the TGA's & DDS included with Doom 3.  I wonder if reducing TGA dimension would give the same benefits as using the compressed D3 textures.


vurt

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-1
  • Doom Newbie
    • View Profile
Re: Sgt.Kelly BFG Textures
« Reply #13 on: December 30, 2016, 05:05:14 PM »
You can extract all images back to .png in void idImage::ActuallyLoadImage( bool fromBackEnd )
by adding

if( image_exportPNG.GetBool() && binaryFileTime != FILE_NOT_FOUND_TIMESTAMP )
   {
      const bimageImage_t& img = im.GetImageHeader( 0 );
      
      const byte* data = im.GetImageData( 0 );
      
      //( img.level, 0, 0, img.destZ, img.width, img.height, data );
      
      idTempArray<byte> rgba( img.width * img.height * 4 );
      memset( rgba.Ptr(), 255, rgba.Size() );
      
      if( header.format == FMT_DXT1 )
      {
         idDxtDecoder dxt;
         dxt.DecompressImageDXT1( data, rgba.Ptr(), img.width, img.height );
         
         if( header.colorFormat == CFM_GREEN_ALPHA )
         {
            byte* pic = rgba.Ptr();
            for( int i = 0; i < img.width * img.height; i++ )
            {
               pic[i * 4 + 3] = pic[i * 4 + 1];
               pic[i * 4 + 0] = 255;
               pic[i * 4 + 1] = 255;
               pic[i * 4 + 2] = 255;
            }
         }
      }
      else if( header.format == FMT_DXT5 )
      {
         idDxtDecoder dxt;
         
         if( header.colorFormat == CFM_NORMAL_DXT5 )
         {
            dxt.DecompressNormalMapDXT5( data, rgba.Ptr(), img.width, img.height );
         }
         else if( header.colorFormat == CFM_YCOCG_DXT5 )
         {
            dxt.DecompressYCoCgDXT5( data, rgba.Ptr(), img.width, img.height );
         }
         else
         {
         
            dxt.DecompressImageDXT5( data, rgba.Ptr(), img.width, img.height );
         }
      }
      else if( header.format == FMT_LUM8 || header.format == FMT_INT8 )
      {
         // LUM8 and INT8 just read the red channel
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i * 4 ] = data[ i ];
         }
      }
      else if( header.format == FMT_ALPHA )
      {
         // ALPHA reads the alpha channel
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i * 4 + 3 ] = data[ i ];
         }
      }
      else if( header.format == FMT_L8A8 )
      {
         // L8A8 reads the alpha and red channels
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize / 2; i++ )
         {
            pic[ i * 4 + 0 ] = data[ i * 2 + 0 ];
            pic[ i * 4 + 3 ] = data[ i * 2 + 1 ];
         }
      }
      else if( header.format == FMT_RGB565 )
      {
         // FIXME
         /*
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize / 2; i++ )
         {
            unsigned short color = ( ( pic[ i * 4 + 0 ] >> 3 ) << 11 ) | ( ( pic[ i * 4 + 1 ] >> 2 ) << 5 ) | ( pic[ i * 4 + 2 ] >> 3 );
            img.data[ i * 2 + 0 ] = ( color >> 8 ) & 0xFF;
            img.data[ i * 2 + 1 ] = color & 0xFF;
         }
         */
      }
      else
      {
         byte* pic = rgba.Ptr();
         for( int i = 0; i < img.dataSize; i++ )
         {
            pic[ i ] = data[ i ];
         }
      }
      
      idStr pngFileNameExport = generatedName;
      pngFileNameExport.SetFileExtension( ".png" );
      
      R_WritePNG( pngFileNameExport, rgba.Ptr(), 4, img.width, img.height, true, "fs_basepath" );
   }

Sorry for resurrecting this old post.. Does anyone know how / where I would i apply this script?

I'd like to make a texture pack for Doom 3 BFG, being able to see and open the generated .bimage files is vital. Haven't found any converters.

Thanks


argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Sgt.Kelly BFG Textures
« Reply #14 on: January 03, 2017, 11:44:48 AM »
That is not a script that is source c++ code, not knowing much about the engine source i would assume this should be used on the render part of the engine where idImage is implemented, search for it on the code base.