S3TC addons for Unreal Editor

S3TC addons for Unreal Editor

Postby Higor » Sun Nov 04, 2018 4:54 am

Decided not to depend on 227 Editor... so far I managed to add a couple of dummies.
Implementing the action will be another challenge.

I intend to add the ability to copy the compressed data from another texture into the source texture. This means that I could import two versions of the same texture (original, S3TC), compress to DXT1 the S3TC one, then copy the mip data into the original one.

The result is the original texture having the S3TC mips, becoming similar to the UT CD2 textures that load in editor and render in high res.

Theoretically, it SHOULD be possible to attach non-S3TC mips into the high res section of a texture, I assume both textures MUST have the same palette. Also in this case, a 256x256 texture with a 1024x1024 high res version could attach the original mipmaps to avoid blurring on distance. (mip list: 1024 high > 512 high > 256 org > etc).
This would solve the problem with masked textures, I just hope the renderers don't ASSUME the high res mipmaps are DXT compressed.
Attachments
Capture.PNG
Higor
Godlike
 
Posts: 1647
Joined: Sun Mar 04, 2012 6:47 pm

Re: S3TC addons for Unreal Editor

Postby Higor » Sun Nov 04, 2018 6:59 am

YAHOO!
That took less than expected, although the editor loves to crash if you attempt to render a texture you've been tampering with, so it's best to work on an empty map.

The steps are:
- Import original and high-res texture (if masked, both must have the SAME palette because DXT is not available)
- If textures are not masked, apply DXT1 compression to high-res version.
- Set the original texture's MacroTexture property to point to the high-res version.
- Then grab the mips from the macro texture. (MacroTexture is set to none during this)
- Delete the high-res version and save the package.
Attachments
Capture.PNG
Higor
Godlike
 
Posts: 1647
Joined: Sun Mar 04, 2012 6:47 pm

Re: S3TC addons for Unreal Editor

Postby papercoffee » Sun Nov 04, 2018 2:47 pm

Please avoid double posts.

But on topic...
What? I don't really understand.
This might be because my coffee level isn't high enough.
User avatar
papercoffee
Site Staff
 
Posts: 8926
Joined: Wed Jul 15, 2009 11:36 am
Location: Cologne, the city with the big cathedral.
Personal rank: coffee addicted !!!

Re: S3TC addons for Unreal Editor

Postby Higor » Sun Nov 04, 2018 7:13 pm

Look at the reported size of the texture.
Now look at the definition it has on the editor viewport.
Higor
Godlike
 
Posts: 1647
Joined: Sun Mar 04, 2012 6:47 pm

Re: S3TC addons for Unreal Editor

Postby papercoffee » Sun Nov 04, 2018 7:33 pm

Higor wrote:Look at the reported size of the texture.
Now look at the definition it has on the editor viewport.

Wowait... wait wait ... 256² :shock: no way.

This is supposed to be a masked texture with 256x256 pixel ...but we see in the viewport a much higher detailed version.
Is this the same texture?
Higor wrote:- Set the original texture's MacroTexture property to point to the high-res version.
- Then grab the mips from the macro texture. (MacroTexture is set to none during this)

How do I do this?
I've never played with S3TC... :|

Higor wrote:- Delete the high-res version and save the package.

What?
Ok if I understand this right, this package will have high-res textures but without them actually inside the file?
HOW? This is awesome.
Will it also decrease the file size?
Is it bound to XC, or can everyone without your Engine use this addon?

If I can get this to work I could finally make a Food Fight texture pack as I wanted.
User avatar
papercoffee
Site Staff
 
Posts: 8926
Joined: Wed Jul 15, 2009 11:36 am
Location: Cologne, the city with the big cathedral.
Personal rank: coffee addicted !!!

Re: S3TC addons for Unreal Editor

Postby Higor » Mon Nov 05, 2018 2:12 am

In short:
What it does is attach DXT1 data to normal textures.

A texture has two image data 'slots', and they can be of any format (as long as it's supported by the engine).
We'll be talking about these two:
P8 = 8bit pallete format (up to 256 colors)
DXT1 = S3TC format (no alpha transparency)


Your standard UT texture has:
- P8 image data as primary data.

DieHard's textures have
- DXT1 image data as primary data.

UT CD2 textures have
- P8 image data as primary data.
- DXT1 image data as secondary data.


The secondary data channel is optionally loaded by S3TC capable renderers, some facts.
- Primary and Secondary image data can have different resolutions, no need to apply special scaling (as with DieHard's textures).
- Renderers that have no S3TC support don't even bother looking at the secondary data.
- Renderers that have no S3TC support will crash if the primary channel has DXT image data.
- UTGLR renderers support DXT3 and DXT5 data.
- UTGLR renderers do not load the secondary data if it's in P8 format.
- MetalDRV does not support DXT3 and DXT5 data.
- UE1 (UnrealEd, UCC) has a command line option that makes the texture importer additionally compress and store DXT1 data into the secondary channel... but it's bugged and doesn't work.
- MergeDXTCommandlet can create UT CD2 styled textures, it requires multiple steps to do it (worth the time if you're working with over 30 textures).
- MergeDXTCommandlet cannot copy DXT1 image data onto a P8 low-res texture if it's stored as primary data (DieHard's DDS imported textures won't work).
- Masked textures cannot be compressed into DXT1 because the color format is incompatible with the effect.
- Non-227 builds of UE1 don't have native AlphaBlend support, so it's pointless to use DXT3 and DXT5 data.


Had a texture package with 96 textures of 512x512 (P8), size was around 32mb.
I downscaled them to 128x128 and stored the 512x512 data as DXT1 (secondary data) onto the downscaled textures.
The result was a UT CD2 styled package with size 19mb.

EDIT:
Also, for those pesky repackers:
DXT1 data cannot be extracted using Unreal Editor or other exporter, you need UTPT in order to visualize and extract the DXT1 data.
Higor
Godlike
 
Posts: 1647
Joined: Sun Mar 04, 2012 6:47 pm

Re: S3TC addons for Unreal Editor

Postby SC]-[WARTZ_{HoF} » Fri Nov 23, 2018 4:14 am

Was curious about this topic. However whenever I look at a textures properties I don't see the "actions" key. Is there a setting to enable that.
Image
Image
Image
SC]-[WARTZ_{HoF}
Adept
 
Posts: 381
Joined: Tue Feb 21, 2012 7:29 pm

Re: S3TC addons for Unreal Editor

Postby Dr.Flay » Fri Nov 23, 2018 5:20 pm

Very cool. Seems like a much better way to merge the textures.

I think it may be worth noting.
Traditionally UT compressed textures are made from an 8 bit image, so you can have the same pallet.
DDS/S3TC stores 24 and 32 bit data, so you can actually bypass optimising and dithering for 8bit imports, and import a full quality 24 bit texture as a DDS, or directly into UEd2.1
Great looking textures with no compromise, except for this awesome new optimising trick, which it won't work with :(
User avatar
Dr.Flay
Site Staff
 
Posts: 3127
Joined: Thu Aug 04, 2011 9:26 pm
Location: Kernow, UK
Personal rank: Chaos Evangelist

Re: S3TC addons for Unreal Editor

Postby Higor » Sat Nov 24, 2018 3:59 pm

Should be out for next XC_Engine release, hopefully before 2018 ends.
Higor
Godlike
 
Posts: 1647
Joined: Sun Mar 04, 2012 6:47 pm


Return to Discussions

Who is online

Users browsing this forum: No registered users and 1 guest