Page 8 of 8

Re: Enhanced Monster Skins

Posted: Sat May 14, 2016 2:22 am
by Dr.Flay™
http://www.oldunreal.com/wiki/index.php?title=ARB-texture-compression_doc

DXT1 does not support alpha channels, only a mask colour.
DXT3 is used for alpha channels with a sharp edge
DXT5 is used for alpha channels with a blended edge.

My post explains the difference with examples
https://www.ut99.org/viewtopic.php?f=5&t=5956
It also has resources for Photoshop and Gimp.

Re: Enhanced Monster Skins

Posted: Sat May 14, 2016 2:48 am
by Lightning_Hunter
DXT1 does not support alpha channels, only a mask colour.
I am not an expert with DXT1 or anything, so I could be totally wrong here - but isn't there DXT1 with and without support for 1 Alpha Channel?  I created an alpha channel in photoshop with the Warlord skin, and photoshop gave me the option to export as DXT1 with 1 alpha channel.  When I imported this file in UnrealEd 2.1 and saved it as UTX to run in UT99, the Warlord appeared masked just fine.  Maybe I am wrong about the details of why this is, but the point is that it seems to be working fine.  I tried using a color for a masked texture (white, black, etc.), but it did not work.  Only an alpha channel with DXT1 worked!

Re: Enhanced Monster Skins

Posted: Sat May 14, 2016 5:41 am
by Lightning_Hunter
Well, I have completed all the Unreal scripted pawn skins.  The final skin to complete was the Queen, and I just finished it (and I sure am glad that skin is over with).  The Queen skin is one of the most intricate skins in the game, and also my least favorite in Unreal.  However, I think the skin turned out nicely.  I am not going to bother posting screenshots this time around.  People can have something to look forward to when they finish Unreal.  :P   

The next step is to convert all the skins to DXT1 format, get all the masked textures working properly, and add them to the mutator.  I will also likely add some other object textures to the pack as well before doing the final upload.  If anyone wants to create high-res skins for the weapons, now is the time... It would be a shame to release a pack without high-res skins of the items you stare at the most!

Re: Enhanced Monster Skins

Posted: Sat May 14, 2016 9:16 am
by sn260591
If anyone wants to create high-res skins for the weapons, now is the time...  It would be a shame to release a pack without high-res skins of the items you stare at the most!
If remaining textures will redrawn, then it is necessary to divide actors into groups to avoid problems with performance:

Code: Select all

struct STex
{
      var string      Old[8];
      var string      New[8];
};

struct SData
{
      var string      Mesh;
      var string      MeshNew;
      var bool      bMultiSkins;
      var int      TexNum;
      var STex      Tex[6];
};

var struct SGroup
{
      var int DataNum;
      var SData Data[32];
} Group[3];

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
      local int g, i, j, m;
      local bool bDone;

      if (Other.Mesh == None)
            return true;

      if (Other.IsA('ScriptedPawn') || Other.IsA('Carcass'))
            g = 0;
      else if (Other.IsA('Decoration'))
            g = 1;
      else if (Other.IsA('Weapon'))
            g = 2;
      else
            return true;

      for (i = 0; i < Group[g].DataNum; i++)
      {
            if (string(Other.Mesh) ~= Group[g].Data[i].Mesh)
            {
                  if (Group[g].Data[i].MeshNew != "")
                        Other.Mesh = mesh(DynamicLoadObject(Group[g].Data[i].MeshNew, Class'Mesh'));

                  for (j = 0; j < Group[g].Data[i].TexNum; j++)
                  {
                        if (!(Group[g].Data[i].bMultiSkins))
                        {
                              if (string(Other.Skin) ~= Group[g].Data[i].Tex[j].Old[0])
                              {
                                    Other.Skin = texture(DynamicLoadObject(Group[g].Data[i].Tex[j].New[0], Class'Texture'));
                                    return true;
                              }
                        }
                        else
                        {
                              for (m = 0; m < 8; m++)
                              {
                                    if (Group[g].Data[i].Tex[j].New[m] != "")
                                    {
                                          if (string(Other.MultiSkins[m]) ~= Group[g].Data[i].Tex[j].Old[m])
                                          {
                                                Other.MultiSkins[m] = texture(DynamicLoadObject(Group[g].Data[i].Tex[j].New[m], Class'Texture'));
                                                bDone = True;
                                          }
                                    }
                              }

                              if (bDone)
                                    return true;
                        }
                  }
            }
      }

      return true;
}

function PreBeginPlay()
{
//ScriptedPawn and Carcass
      Group[0].DataNum = 2;

      Group[0].Data[0].Mesh = "UnrealShare.Skaarjw";
      Group[0].Data[0].TexNum = 2;
      //SkaarjWarrior
      Group[0].Data[0].Tex[0].Old[0] = "None";
      Group[0].Data[0].Tex[0].New[0] = "Ancient.Base.GRENMRBL";
      //IceSkaarj
      Group[0].Data[0].Tex[1].Old[0] = "UnrealI.Skins.Skaarjw3";
      Group[0].Data[0].Tex[1].New[0] = "Ancient.Base.A_bs4";

      Group[0].Data[1].Mesh = "UnrealI.Pupae1";
      Group[0].Data[1].bMultiSkins = True;
      Group[0].Data[1].TexNum = 1;
      //Pupae
      Group[0].Data[1].Tex[0].Old[1] = "None";
      Group[0].Data[1].Tex[0].New[1] = "Ancient.Base.Crunchyd";

//Decoration
      Group[1].DataNum = 1;

      Group[1].Data[0].Mesh = "UnrealI.Flag1M";
      Group[1].Data[0].TexNum = 1;
      //Flag1
      Group[1].Data[0].Tex[0].Old[0] = "None";
      Group[1].Data[0].Tex[0].New[0] = "Ancient.Base.WALLA";

//Weapon
      Group[2].DataNum = 3;

      //ASMD
      Group[2].Data[0].Mesh = "UnrealShare.ASMDPick";
      Group[2].Data[0].bMultiSkins = True;
      Group[2].Data[0].TexNum = 1;
      Group[2].Data[0].Tex[0].Old[1] = "None";
      Group[2].Data[0].Tex[0].New[1] = "Ancient.Door.dth_dr";

      Group[2].Data[1].Mesh = "UnrealShare.ASMD3";
      Group[2].Data[1].bMultiSkins = True;
      Group[2].Data[1].TexNum = 1;
      Group[2].Data[1].Tex[0].Old[1] = "None";
      Group[2].Data[1].Tex[0].New[1] = "Ancient.Door.dth_dr";

      Group[2].Data[2].Mesh = "UnrealShare.ASMDM";
      Group[2].Data[2].bMultiSkins = True;
      Group[2].Data[2].TexNum = 1;
      Group[2].Data[2].Tex[0].Old[1] = "None";
      Group[2].Data[2].Tex[0].New[1] = "Ancient.Door.dth_dr";
}

Re: Enhanced Monster Skins

Posted: Sun May 15, 2016 1:53 am
by han
If remaining textures will redrawn, then it is necessary to divide actors into groups to avoid problems with performance:
How about a (fixed size) hashtable you fill at runtime?

Re: Enhanced Monster Skins

Posted: Sun May 15, 2016 5:06 am
by Dr.Flay™
DXT1 does not support alpha channels, only a mask colour.
I am not an expert with DXT1 or anything, so I could be totally wrong here - but isn't there DXT1 with and without support for 1 Alpha Channel?  I created an alpha channel in photoshop with the Warlord skin, and photoshop gave me the option to export as DXT1 with 1 alpha channel.  When I imported this file in UnrealEd 2.1 and saved it as UTX to run in UT99, the Warlord appeared masked just fine.  Maybe I am wrong about the details of why this is, but the point is that it seems to be working fine.  I tried using a color for a masked texture (white, black, etc.), but it did not work.  Only an alpha channel with DXT1 worked!
I looked back through it to refresh myself, and just noticed how borked the wiki page is.
Yes indeed it does have an RGBA option, so I believe my trials had lead me to believe it was better to use DXT3 and 5 for alpha channels due to them being made for it, not forced.
I stick to normal 24bit textures in DXT1 for highest compression ratio and use the others for transparency depending on the type.

From the official doc (better link)
http://www.oldunreal.com/editing/s3tc/ARB_texture_compression.pdf
http://www.oldunreal.com/editing/s3tc/ARB_texture_compression.doc
S3TC

Be aware that the enumerated format list is not necessarily the same as the list of supported formats. The main purpose of the format enumeration is to enumerate “normal-looking” formats so that an application can try them out without having any knowledge about specific extensions. This explains why the S3TC format enumeration doesn’t refer to the GL_COMPRESSED_RGBA_S3TC_DXT1_EXT format, which is understood as not being a “normal” RGBA format.
I can't find the guide that explained the difference between DXT-3 and 5, but it made sense finally.
If you use an Alpha channel, it will not have the 8:1 compression, so because with 3 and 5 you don't get the option, it made sense to keep DXT-1 for solid textures or the classic masking.

When you import a masked texture, you must remember to edit the properties and remind it that it is masked, or it won't work.


I also am no expert with DDS/DXT, and from all I have found over the years, there aren't any in the Unreal Universe.
Until recently most people were still reducing to 8bit before importing into UEd for compression.
Actually, most people probably still are.

Re: Enhanced Monster Skins

Posted: Sun May 15, 2016 9:33 am
by han
Imho the Wikipedia page explains quite well the different S3TC modes.
https://en.wikipedia.org/wiki/S3_Texture_Compression

The difference between the alpha channel in DXT3 and DXT5 is that, in DXT3 the alpha channel is stored with individual 4 bit per pixel, where as in DXT5 the alpha channel is using a compression.

Re: Enhanced Monster Skins

Posted: Sun May 15, 2016 4:38 pm
by sn260591
If remaining textures will redrawn, then it is necessary to divide actors into groups to avoid problems with performance:
How about a (fixed size) hashtable you fill at runtime?
You can give examples how it is realized in UScript, please?

Re: Enhanced Monster Skins

Posted: Mon May 16, 2016 11:05 am
by han
I have no example for uc, but it is a common datastructure. For 227 I would use some static array with dynamic arrays inside (if thats possible?). Without dynarray support it gets a bit more tricky, but there are ways around this issue. Like some huge array with hash table entries (enough for all texture replacements) which acts as a pool for the entries. Each of those entry elements have an index to the next hash slot element. Another int array to store the top level indices for the hash slots.

As I'm yet to tired for a proper explainations...
// Hash table entry.
struct HashEntry
{
var int HashNext;
var Object Key;
var Whatever Value; // Stored Data.
}

var HashEntry HashPool[512]; // Pool of unused entries.
var int HashPoolNext; // Next free Pool entry.

var int HashTable[32]; // Hash table entry point.

function int Hash( Object Key ); // Creates some hash out of Key and returns values from 0 to ArrayCount(HashTable)-1.

function HashInit()
{
local int i;
for ( i=0; i

Re: Enhanced Monster Skins

Posted: Mon May 16, 2016 5:32 pm
by Lightning_Hunter
Keep in mind, I am using UT99 for my primary engine.  I will work on the 227 version after I complete all the skins.  The mutator has to work in both engines.  I say we just stick with the mutator created by sn260591, since I've already edited the script to add all my skins.

Re: Enhanced Monster Skins

Posted: Mon May 16, 2016 6:39 pm
by han
Keep in mind, I am using UT99 for my primary engine.  I will work on the 227 version after I complete all the skins.  The mutator has to work in both engines. 
I did, thats why 95% off my post was about implementing hash maps without requiring dynarray support.

Re: Enhanced Monster Skins

Posted: Mon May 16, 2016 6:55 pm
by Lightning_Hunter
Keep in mind, I am using UT99 for my primary engine.  I will work on the 227 version after I complete all the skins.  The mutator has to work in both engines. 
I did, thats why 95% off my post was about implementing hash maps without requiring dynarray support.
Ah, well you will have to forgive my ignorance with coding, as I am definitely not a coder!  I misread your post and thought you made that code for 227. Sorry. :-X

Re: Enhanced Monster Skins

Posted: Wed May 18, 2016 1:09 am
by Lightning_Hunter
Just for reference, I have moved this discussion to an official project thread here:
http://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1463427961

All new project development will be there instead. sn260591, I asked you a question in the new thread. :)