Search Unity

Failed ETC2 Compression

Discussion in 'Linux' started by frimkron, Mar 16, 2016.

  1. frimkron

    frimkron

    Joined:
    Mar 16, 2016
    Posts:
    1
    Hi!

    I'm getting an issue where Unity is unable to compress textures if the compression method is ETC or ETC2. When I import or reimport the asset, I get the error message "Failed ETC2 compression" in the console (with no other details) and the imported graphic ends up with black and white glitchy sections across it.

    I'm using the 5.3.3f1+20160223_amd64 build on Linux Mint 17.1 Cinnamon 64-bit.
     
  2. ottobonn

    ottobonn

    Joined:
    Mar 16, 2016
    Posts:
    2
    I am also running into this issue. My project type is set to Android and compression fails for both ETC and ETC2. When that happens, textures appear glitchy in both the editor and in the built project on Android, with gray stripes across them in random places, depending on the proximity to the camera. The texture errors appear on all objects, including assets from the store and brand-new GameObjects with simple image textures applied.

    By setting the texture compression type to "ATC (Adreno)" in the Build Settings, I can get textures to compress and display properly, including on the target phone.

    Build: 5.3.3f1+20160223_amd64
    OS: Linux Mint 17.1 Cinnamon 64-bit
    Kernel: 3.13.0-37-generic
     

    Attached Files:

  3. ottobonn

    ottobonn

    Joined:
    Mar 16, 2016
    Posts:
    2
    I can confirm that it also happens on 5.3.4f1+20160316_amd64. The ATC compression workaround still works, as does disabling compression (using "16 bits" or "Truecolor") in the texture import settings pane (though obviously that will increase texture sizes dramtically).
     
  4. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Thanks, we'll investigate.
     
  5. cician

    cician

    Joined:
    Dec 10, 2012
    Posts:
    233
    Same here with Unity 5.4.0b10. Just tried to switch platform to Android.
    Part of editor.log:
     
  6. maquis

    maquis

    Joined:
    Feb 7, 2016
    Posts:
    61
    Also seeing this problem... If I set all graphics to 16 bits, it doesn't glitch, but I am still getting the Failed ETC1 and Failed ETC2 compression errors.
     
  7. ArcticShores

    ArcticShores

    Joined:
    Feb 3, 2016
    Posts:
    2
    I'm seeing exactly the same issue on my Arch Linux machine on Unity 5.3.3f1.

    Our texture sizes are enormous which is causing some serious problems. :(
     
  8. billywang

    billywang

    Joined:
    Apr 14, 2016
    Posts:
    5
  9. ArcticShores

    ArcticShores

    Joined:
    Feb 3, 2016
    Posts:
    2
    That's hardly relevant to Linux builds.
     
  10. jetpackpony

    jetpackpony

    Joined:
    Feb 25, 2016
    Posts:
    2
    Same here on Ubuntu 15.10. Tried Unity versions 5.3.2, 5.3.3, 5.4.0.
    Devs, any news on this issue? It has been a month since first reported.
     
    superkid333 likes this.
  11. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    243
    nloewen likes this.
  12. DrakkenWulf

    DrakkenWulf

    Joined:
    Mar 6, 2015
    Posts:
    10
    Also getting this error.
     
  13. sumdog_steve

    sumdog_steve

    Joined:
    Apr 6, 2016
    Posts:
    3
    I am also getting this error on Linux Ubuntu 14.04 LTS
     
    masterchop likes this.
  14. santiihoyos

    santiihoyos

    Joined:
    Sep 4, 2015
    Posts:
    9
    On Ubuntu 16.04 i have the problem...
     
  15. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Failed ETC1 / ETC2 compression

    Unity Editor v5.4.0p1+20160810_amd64
    Android Platform

    System: Ubuntu 16.04.1 LTS
    Kernel: 4.4.0-31-generic
    Processor: Intel® Core™ i5 CPU 650 @ 3.20GHz × 4
    Memory: 16 GB
    Graphics: Nvidia GeForce GTX 750 Ti/PCIe/SSE2 (2048 MB)
    OpenGL: OpenGL 4.5 [4.5.0 NVIDIA 361.42]

    The editor divides the import file into small parts and it seems that running an import process for each CPU core.
    It fails if these processes do not end in the same order in which they were executed.
    It seems not well managed multiple processes.

    Using the original PVRTexTool sometimes there are zombie child process.

    The Solution

    A small program that involves the PVRTexTool.
    Synchronize threads based on the system time (multiples of 750 milliseconds or if preferred in a second for safety).

    It is a temporary while the bug is fixed.
    It is a simple without access to the source code editor.
    It is a bit slower.

    Build. Android Texture compression: Don't override.
    In other cases fails.

    It is NOT A SOLUTION. Try to shed some light.

    Correct me for my style of programming and for my bad English !!!

    Off Topic:
    Controlling or waiting external processes can be the source of other errors? for example "Blender .blend Could not convert the file to FBX file."

    It is a bit slower but it works in most situations.
    Work with multiple files.

    Assets Menu or Context Menu: Reimport or Reimport All.
    Assets Menu -> Import New Asset...
    Copy file to project folder.

    Code (Golang):
    1.  
    2. /*
    3.  
    4.    This program is free software: you can redistribute it and/or modify
    5.    it under the terms of the GNU General Public License as published by
    6.    the Free Software Foundation, either version 3 of the License, or
    7.    (at your option) any later version.
    8.  
    9.    This program is distributed in the hope that it will be useful,
    10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
    11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12.    GNU General Public License for more details.
    13.  
    14.    You should have received a copy of the GNU General Public License
    15.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16.  
    17. */
    18.  
    19. package main
    20.  
    21. import (
    22.     "bytes"
    23.     "fmt"
    24.     "os"
    25.     "os/exec"
    26.     "path/filepath"
    27.     "strings"
    28.     "time"
    29. )
    30.  
    31. const (
    32.     // Total time taken for a process. For safer, but more slow, use a sync
    33.     // time of one second (1000 * time.Millisecond or time.Second)
    34.     totalTime = 750 * time.Millisecond
    35.  
    36.     // Full path of PVRTexTool command file
    37.     cmdPVRTexTool = "/opt/Unity/Editor/Data/Tools/PVRTexToolCLI"
    38.  
    39.     // TODO: Get pattern from input file?
    40.     // Supported Image Formats: PVRTexTool -- Must be a JPEG, PNG, BMP, PVR, KTX, DDS or ASTC file.
    41.     feedPattern = "*-feed.png"
    42.  
    43.     timeFormat = "2006-01-02 15:04:05.999 -0700 MST" // format a time stamp with millisecond precision
    44.     debug      = false
    45. )
    46.  
    47. var (
    48.     start = time.Now()  // start time
    49.     pid   = os.Getpid() // process id
    50. )
    51.  
    52. func main() {
    53.  
    54.     // command line arguments
    55.     cmdName := os.Args[0]
    56.     cmdArgs := os.Args[1:]
    57.  
    58.     if debug {
    59.         fmt.Fprintf(os.Stderr, "wrapper %d: start %s command %s %s\n", pid, start.Format(timeFormat), cmdName, strings.Join(cmdArgs, " "))
    60.         os.Stderr.Sync()
    61.     }
    62.  
    63.     // execute command
    64.     var stdout, stderr bytes.Buffer // pipes for reading the generated outputs
    65.  
    66.     cmd := exec.Command(cmdPVRTexTool, cmdArgs...)
    67.     cmd.Stdout = &stdout
    68.     cmd.Stderr = &stderr // Original PVRTexTool only use stderr
    69.  
    70.     if err := cmd.Run(); err != nil {
    71.         if debug {
    72.             fmt.Fprintf(os.Stderr, "wrapper %d: error exec command: %s\n", pid, err)
    73.         }
    74.     }
    75.  
    76.     if debug {
    77.         fmt.Fprintf(os.Stderr, "wrapper %d: comand stderr: [\n%s]\n", pid, stderr.String())
    78.         os.Stderr.Sync()
    79.     } else {
    80.         fmt.Fprint(os.Stderr, stderr.String())
    81.         os.Stderr.Sync()
    82.     }
    83.  
    84.     // end process
    85.     end := time.Now().Sub(start)
    86.  
    87.     // args
    88.     var path string
    89.  
    90. loop:
    91.     for i, arg := range cmdArgs {
    92.         switch arg {
    93.         case "-i": // input file
    94.             path = filepath.Dir(cmdArgs[i+1])
    95.             break loop
    96.         }
    97.     }
    98.  
    99.     fs, err := filepath.Glob(filepath.Join(path, feedPattern))
    100.     if err != nil {
    101.         fmt.Fprintf(os.Stderr, "wrapper %d: error counting png files in %s: %s\n", pid, path, err)
    102.         os.Stderr.Sync()
    103.     }
    104.  
    105.     feeds := len(fs)
    106.  
    107.     if debug {
    108.         // calculate approximately
    109.         base := start.Round(totalTime)
    110.         now := time.Now()
    111.         delay := totalTime - now.Sub(base)
    112.         sync := now.Add(delay)
    113.  
    114.         fmt.Fprintf(os.Stderr, "wrapper %d: end %s, process %s, delay %s, sync time %s, feeds %d\n", pid, now.Format(timeFormat), end, delay, sync.Format(timeFormat), feeds)
    115.         os.Stderr.Sync()
    116.     }
    117.  
    118.     // process synchronization
    119.     if feeds > 1 {
    120.         delay := totalTime - time.Now().Sub(start.Round(totalTime))
    121.  
    122.         if delay > 0 {
    123.             time.Sleep(delay) // wait
    124.         }
    125.     }
    126. }
    127.  
    128. // end PVRTexTool.go
    129.  
     

    Attached Files:

    Last edited: Aug 20, 2016
    HNKNTA and spacepluk like this.
  16. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Hello.

    Unity Editor v5.4.0p1+20160810_amd64
    Android platform
    Importing textures or building.
    Texture Glitch

    Failed ETC1/ETC2 compression

    In my system, with a clean installation of the editor, uses 4 processes to import. After building, import or new build, uses 6 process and some of them fail.

    if anyone is interested I have one PVRTexTool ipc based wrapper.
    Wrapper works for me.
    After starting the editor, import texture or build, ALWAYS it works. Without errors.
    From that moment, import texture or build, always fails.
    Restart the editor working again.

    I hope this is the right place to report this issue.

    Thanks

    fail.png ok.png ok_multiple.png
     
    Last edited: Aug 20, 2016
  17. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    I believe we'll have a fix for this issue in the next build.
     
    spacepluk and Bollit like this.
  18. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Great! Thanks.
     
  19. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Hello.

    Same error for v5.5.0b1+20160830_amd64

    Android platform.
    Importing textures or building.
    Texture Glitch.

    Failed ETC1/ETC2 compression
     

    Attached Files:

  20. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Sorry, beta1 was already cut when that fix landed - but it should be in the next build!
     
  21. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Thanks!
     
  22. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Fixed in 5.5.0b2.
     
    Last edited: Oct 1, 2016
  23. seyacat

    seyacat

    Joined:
    Sep 10, 2015
    Posts:
    23
    It works only on reload one texture,
    reloading multiple Crash,
    Reload All Freeze,
    Build on Android Crash,
    Switch to Android Crash

    5.5.0b2 its a lot unstable
     
  24. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    243
    Yeah, there's still something wrong with this. Now it just hangs while reimporting all the assets and I need to kill the editor. For some reason it didn't happen the first few times I tried, and I got it to build for Android once without crashing.
     
  25. HecklerS

    HecklerS

    Joined:
    Feb 27, 2014
    Posts:
    3
  26. sirvela

    sirvela

    Joined:
    Sep 19, 2016
    Posts:
    5
    Just to report this bug also happens on Debian 8 (using 5.4.1f1 on a 64bit machine). Changing to ATC (Adreno) solves in the editor. Didn't try on device.
     
  27. HNKNTA

    HNKNTA

    Joined:
    Oct 10, 2016
    Posts:
    1
    @Bollit thanks, you are lifesaver!
    Unity is almost unusable as I start to use standard assets because of this bug. Version is 5.4.0p1. Version 5.4.1f1 cannot build a project at all.
    I almost regret that I started with Unity, maybe I had to choose UE
     
    milox777 likes this.
  28. Bollit

    Bollit

    Joined:
    Aug 6, 2014
    Posts:
    22
    Hi!
    Happy to help a little.

    5.5.0b5 is better in this regard.
    Sometimes the error occurs in 5.5.0b5, but not how to play it.
    Sporadic hangs with compression ETC.

    Stop zombie child process can continue without restarting the editor.
    With the System Monitor, or shell, delete the child process 'Unity'.
    In System Monitor view active 'Dependencies'.

    system_monitor_Unity3d_hang.png

    Remember that it is not a solution.

    Unity in linux is experimental but progressing.
    Fixed in the next release?

    Look at your skills.
     
    Last edited: Oct 12, 2016
  29. Seraphic572

    Seraphic572

    Joined:
    Mar 11, 2016
    Posts:
    21
    How to overcome this ? Even i am having the same issue in unity 5.6.0
     
    Mightynate and paulnaude like this.
  30. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    195
    Same issue in 2017.1p3 Android, when upgraded pretty simple project from 5.6.2p4. Change to DXT Build Settings and Reimport All fixes it for me. Or manually override compression settings for Android for each texture to DXT or disable sRGB.

    How this stuff passes Unity's "quality control" is beyond me.
     
  31. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,598
    Still getting this in Android builds using 2018.2.10!
     
  32. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Three years later and no official fix? :/
     
  33. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369
    I seem to be having this issue in the Linux Editor 2018.3.12f1. Looking closer at it it seems to be on textures where the original size is non-power of two, even if it's set to resize to POT in advanced options. The ETC crunched seem to work...but the non-crunched ETC does throw the error. This problem happens only on Linux and not my Mac...

    So if you are having this issue it might be worth checking this...
     
    Last edited: Apr 16, 2019
  34. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    We are having same issue in the Linux Editor Unity 2019.1.0...
     
  35. nacs

    nacs

    Joined:
    Jun 5, 2013
    Posts:
    6
    Also occasionally getting the "Failed ETC1 compression issue"
    Unity 2019.1.0f2 on Ubuntu 18.04
     
  36. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    216
    Any chance you can repro it semi-consistently? Good enough for a bug report?
    https://unity3d.com/unity/qa/bug-reporting
     
  37. wenderRondonia

    wenderRondonia

    Joined:
    Mar 15, 2015
    Posts:
    29
    getting the "Failed ETC1 compression issue"
    somem textures of NPOT type,
    reimporting 3-5 times solves, I wished to know how to overcome this issue
    Unity 2019.1.14f1 on Ubuntu 18.04
     
  38. datbq

    datbq

    Joined:
    Nov 6, 2017
    Posts:
    6
    I confirm the "Failed ETC1(or ETC2) compression" error at Unity 2019.1.14f1 on Linux.
    This error appear when I builded Android app. And when I played this app on device, textures appear glitchy with gray stripes across them.
    I tried to clear Library/ folder and rebuild, but It's still appear.
     
    Last edited: Sep 20, 2019
  39. ZliVuk

    ZliVuk

    Joined:
    Mar 24, 2018
    Posts:
    61
    Whenever I get that error it is with new textures (sprite2d in my case) and enabling Crunch Compression for each texture solves problem.
     
  40. jisharma

    jisharma

    Joined:
    Jan 28, 2019
    Posts:
    1
    Facing same issue, working fine in windows machine and in Mac its giving "Failed ETC2 compression", tried to use every solution provided by everyone in above replies but none worked,

    only some of the sprite are affected even though all have same compression setting, recently started facing this issue since I upgraded my unity.

    also facing issue in android devices only in editor its working fine.

    Unity version : 2018.4.1f1
     
  41. Chikist

    Chikist

    Joined:
    Nov 30, 2016
    Posts:
    8
    Also have "Failed ETC1(or ETC2) compression" error on Arch Linux at Unity 2019.1 and 2019.2 during android build. After successful build some textures are glitchy.
     
  42. jounisuominen

    jounisuominen

    Joined:
    Nov 6, 2018
    Posts:
    5
    I also have the "Failed ETC2 compression" issue with Ubuntu 18.04 LTS and Unity 2019.2.9.
     
  43. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Have any of you reported bugs? It won't be fixed just because you wrote you can repro in the forum...
     
  44. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    902
    @Tautvydas-Zilys : I just submitted case #1222219 which is a small, simple project which exhibits this bug. In the bug report are a simple set of steps to repro the error on demand so that you can easily debug it. This project was submitted from Unity 2019.3.1f1, where the problem is still present unfortunately.

    This bug makes it unrealistic to use Linux editor for our Android projects at the moment, both VR and mobile, so fixing this would be a gigantic boon to productivity over here! I hope it can get the priority that it deserves.

    if we can provide any more info to help fix the problem please let us know.
     
    sfjohansson likes this.
  45. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    902
    sfjohansson likes this.
  46. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369
  47. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    902
    Yes, actually. QA reached out today to let me know they're still working on it *BUT* we can try this workaround for now: change "ETC Texture Compressor" in Project Settings->Editor from Legacy to Default.

    This workaround does indeed seem to work for me so far. Give it a try.
     
    senkal_, ajz3d and sfjohansson like this.
  48. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369
    So It seems like it made the errors go away. but I had some artifacts ingame, made a cloud build and that came out fine
     
  49. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Do you know if the artifacts were caused by errors in texture compression?

    When using "Default" ETC Texture Compressor Unity uses the executable etccompress. It's a custom tool that just wraps some third-party ETC compression libraries (ETCPACK, Etc2Comp, etcpak).
    With "Legacy" we use PVRTexTool (afaik also based on third-party ETCPACK, but not sure).

    Since we don't know yet what causes the problem with PVRTexTool it could be that using "Default" just hides the bug because we spawn fewer processes. In case of PVRTexTool we split every texture to compress the parts in parallel. Etccompress is multithreaded internally.
     
  50. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369

    Error codes I can see here:
    Failed ETC2 compression: Output file Temp/a9aa0a7bc947f95edb5f038bf04821b5-res.pvr not found
    exitcode:0

    Failed ETC1 compression: Output file Temp/02c0e3a68ea7d317fb9c9a5a0a3321e5-res.pvr not found
    exitcode:0

    Failed ETC2 compression: Failed to launch Tools/PVRTexTool
    exitcode:1

    Failed ETC1 compression: Failed to launch Tools/PVRTexTool
    exitcode:1