ETC1 (dual texture) // ATF // PKM // KTX

Hi.

It’s a bit late over here - I hope I’ll stick to the point. I’ve been at this for a few hours.

Basically, I’m having some loading times issues on an Android build.

I’m not sure but I have the feeling it has to do with decompression of textures on load (and reload of scene). I may be wrong.

The Unity documentation suggests going with ETC1 and the dual texture solution if you need alpha (which I do). Storing alpha in one of the textures and the colors in the other then combining them in a shader.

Here’s a shader kindly posted on Answers.

I haven’t tested it out and still unsure if it’s what I need and will perform.

Even if it does, I still need to create the textures and haven’t been able to yet.

In this thread there is discussion of different techniques, including an editor script which can do it. I haven’t been able to wrap my head around that one completely as that seems to be my best bet. They also discuss creating these textures manually (photoshop/gimp/etc.) - but then, how would they bring them in to Unity? (see below. I assume they’ll be making two rgb files - one with rgb color info and one with alpha in a color chanel and then letting unity convert/compress the files)

I’ve also come across Adobes new format - ATF.

I assume at some point we’ll be able to use it within Unity (as Flash seems at home) - It already couples two ETC’s (1 for alpha).

Mali compression tool, also creates two ETC1 textures (one with alpha) from a texture (with alpha). But it stores the files as either PKM or KTX.

I understand I can’t bring in an ETC file into Unity (it can only be converted internally - I can’t find the post but I think it was Dreamora.)

So, my best option is to write an editor script to create these files?

I’m using Unity3.5.7. I need alpha and I’m hoping compression will be ok for my needs. I can’t use RGBA16 as I’m using GetPixels on it (can’t see a way around that). I’m left with either going RGBA32 (and long loading times and bloated builds - I’m hoping to have as many of these textures as possible - they correspond to levels in my game). Or getting the dual ETC1 textures to work for me.

I assume there are other Android developers facing this and that we’ll see ATF integration soon (drop one file in - support a fragmented Android market.)

Ok. For those reading who need a quick solution for a 2 texture pipeline (2 ECT1 textures as recommended in the documentation).

I’m sure there are plenty of other ways.

Download Mali compression tools. Latest is 4.0.1. (I just tested it on Win7 but should work on OS/X and Linux).
Install. Run the GUI version.

For some reason I could only find the compressing tool in the GUI version.

Drop your png’s (or textures with alpha). Select compress. Use PKM. Choose alpha as Uncompressed seperate file. and ECT1.

Other settings may also work.

Compress.

Now the buggy bit.

Go into CMD-line. find the installation directory. (arm/malicompression…etc./bin/)

You’ll have to copy convert.exe into your working dir (where your compressed textures are stored). - there’s a bug.

now chdir to your working dir.
create a new dir where files will be saved.
and run the following

etcpack -ext PNG

should look something like this

c:\ etcpack level1.pkm tmpdir -ext PNG

then

c:\ etcpack level1_alpha.pkm tmpdir -ext PNG

you should now have two RGB files - one with RGB the other with ALPHA

compile the shader linked in the above post and drop in the two textures.

Should be working.

*My problem is that I’m not sure I need them :slight_smile: or I may need to rewrite the way I read the files in (I got lost in the search).

I just woke up with the realization this is a complete over kill. Not sure how dead the textures would be. They may be very dead.

They’ve been compressed into ETC1 then decompressed into PNG (then dropped into unity to be compressed again).

I assume this isn’t a good way of doing it (I’m actually happy with it, because all I want is to use the same textures and test loadtimes with the textures as ETC)

No effect on the loading times. (at least none that I notice.)

Since I’m using the Indie version - I’m assuming the loading times I’m seeing are normal somehow.

(I think it’s somewhere in the range of 10-15sec’s to load the game - also for a restart of the level - but that may be less important if I manage to keep the whole game in this one scene - but at the moment it would probably take the same time to switch back to a menu scene, etc. though haven’t tried.)

It may also be the phone I’m using which is…well on the crappy end of things (Huawei G300)

Since this long (pointless?) thread is here, If I have a non power of two texture that isn’t used in game (other than reading it’s pixels with GetPixels) - is there going to be an overhead or am I in the clear?

The documentation mentions that if they’re used for GUI elements it’s fine.

hey buddy. Since no body was responding: “pss…even if you cut out all assets completely…you’d still probably have a 20sec initial loading time and 13secs reload level time.”

hmm…