Search Unity

PVRTC 4 compression looking horrible only on iMAC

Discussion in 'Shaders' started by flapyfox, Jan 5, 2013.

  1. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I can barely see the difference between "truecolor" mode and "compressed PVRTC 4bits" on my lightmaps in Windows but when I move to iOS, the difference is huge and the "compressed PVRTC 4bits" look horrible? why is that ? and Yes I already checked "override for iPhone, Quality Best"
    ("true color" looks the same as in windows)
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    On windows you are not seeing pvrtc, you are probably seeing it compressed as DXT which generally looks better than pvrtc (check what it actually says as the texture format at the bottom in the inspector where the texture is shown).
     
  3. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Yes that's right, but even DXT is looking horrible on MAC where it looks great on windows.

    There is a huge difference between true color and compressed (DXT or PVRTC)
    http://i.imgur.com/Ie6UU.jpg
     
  4. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    I think the only problem you're seeing is that your Mac editor is set to iOS mode, from building for iOS. It is showing you previews of the compressed textures you will see when you publish to iOS. If you open File>Build Settings, you can confirm this by looking at the platform that has the Unity icon next to it. This is the one the editor is currently emulating.

    Your Windows machine cannot build for iOS, and the editor cannot be set to iOS mode. The worst compression you will see there is DXT.

    And yes, PVRTC is an ugly format with current compressors, especially for low-frequency information. My hope is that someone like this can break it open and make it a more generally useful format.
     
  5. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    It's really killing me, we have been working for a year on an arch viz project and looked fine on win, we took the difference between DXT5 and PVRTC4 for granted and we are in real bad situation today as we see the horrible lightmaps (and architectural textures) on the iPAD.

    I read the link, a bit technical, but is there anyway his shared code could be incorporated to an existent TGA or EXR texture to improve the horrible quality on iOS?

    When I encode my TGA textures with the PVRTexTool in windows they look great and the compression is barely visible even in low frequency areas.
    http://i.imgur.com/fk3QM.jpg
    But the tool generates .pvr textures which can not be read by the Unity editor, is there a way to utilize them? and is there a way to encode with the same tool EXR textures (it couldnt read 32bit images).

    We are really looking forward to any solution that could pull us out of this really bad situation.
     
    Last edited: Jan 6, 2013
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    pvr work fine in Unity but I guess you by error downloaded a newer version of the tool which produces pvr2 textures by default which will not work as the format is not yet supported by Unity and iOS. This format does not work on any non-multicore gpu iOS device, so the minimum is iPhone 4S, iPad2 / iPad Mini, iPod Touch 5. Neither iPhone 4 nor iPod Touch 4 will work with it.

    You need to ensure that its set the pvr generation to the old, widely support format that supports SGX530+. Then you will likely also see the correct fragments (it will look worse). It will look better than Unitys autoconversion there though (OSX the library and command line tools never created the same quality for whatever reason), but not as good as your current one.


    Naturally you can also use the exr itself if you are on Unity 3.5+ and just drop it in, setting the texture format to lightmap and switching the texture format to 16bit or 32bit at the bottom (or set it to lightmap, then advanced - that way the settings are preconfigured for lightmap but you get more choice on the texture compression to set it to specific 16bit formats etc)

    Uinsg a TGA / PNG works too but they are limited to 8bit per channel or ARGB32 unlike EXR


    Even if thats no help: It unluckily shows why all longer term iOS devs here advice anyone to test on iOS and Android early on already because the Desktop has basically absolutely nothing to do with your mobile device and any assumptions drawn from the desktop can fail (and graphical ones often will fail as the PowerVR hardware works different and its behavior can not be simulated and emulated on desktop gpus without switching to pure CPU rendering)
     
    Last edited: Jan 6, 2013
  7. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I am using an old version PVRTexToolv 2.23 (and Unity3.5) and you are right Unit does read the .pvr textures and they show in the editor although there is no options in the texture inspector. However they show up great in the viewport, a very slight difference with truecolor quality and I can't believe my eyes:
    http://i.imgur.com/E7zYY.jpg
    If I use one .pvr and build, everything is fine )looking great on the iPAD) but when I have more than one, the build just crashes,why is that happening? certainly not a memory issue since I am below 50 MB in the xcode memory profiler ( and I noticed that when one .pvr is added, an additional 2MB are added in memory, so its not weighing 2.7 MB as the inspector shows but 4.7MB, with the Unity compressor the memory was at 47MB, when .pvr was used it jumped to 49MB and crashed).

    I downloaded the newer version of PVRTextool, chose OPENGL ES 2, PVRTC 4bpp ( not PVRTCII 4bpp you mentioned): http://i.imgur.com/zC4IS.jpg

    Unity couldn't preview the file in the editor, giving me this message:
    "Unity does not understand this file. Are you sure it is a valid PVR (v2) file?"
    Shouldn't preview the .pvr normally since this is not PVRTCII4?

    I cant see any option related to SGX530 in the PVTextool.

    You are suggesting using uncompressed lightmaps. I tried this with my 2048 EXR lightmaps, but the build crahed as soon as I has just one 2048 lightmap uncompressed (16MB instead of 2.7MB), which I dont understand since I have plenty of free memory left.

    Granted that my first crash problem with .pvr texture is fixed, is there anyway I can use the PVRTextool to generate compressed versions of my exr lightmaps? the tool doesn't accept 32bit format texture? how can I achieve this?

    I perfectly agree, we did some test a year ago but quick ones with UV shells of object occupying big parts of the lightmap, so the pvrtc4 issue was barely visible plus we were checking the compressed mode on desktop which was DXT5 and NOT PVRTC4 like the Unity option showed. However we can afford having the current PVRTC artifacts, specially that this an arch viz project for mobile and not a game with super noisy coloreful contrasted textures. We are willing to do what ever it takes to get out of this situation which puts a whole year of effort in japordy.

    thanks alot for your help, would really appreciate it if you could help us through.
     
    Last edited: Jan 6, 2013
  8. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    double post.
     
  9. joe.davis

    joe.davis

    Joined:
    Apr 17, 2012
    Posts:
    14
    Hi royter,

    The reason you are unable to load PVR files generated with the latest PVRTexTool from Imagination is that, as of the 3.0 PowerVR Graphics SDK, the tool outputs PVR v3 files by default. The version of Unity you have only supports the legacy PVR v2 container format.
    In the PVRTexTool GUI, you can go to "File->Save As Legacy..." to save a file that will open in Unity.

    If you would like to know more about PVRTC and how to improve your light map compression, please visit and post on the Imagination Developer Forums here: http://forum.imgtec.com/categories/powervr-graphics

    Cheers,
     
  10. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    All right, finally found that option.

    Do PVR v2 texture consume less memory? I read the same amount 2.7 in my inspector as PVR v1?
    What are the main advantages ib PVR v2?

    Regarding lightmaps, how can I encode my .EXR lightmaps since PVRTextool doesn't accept 32bit files?

    And how can I save RGBA images, PVRTextool merges the 4 channel ina weird way? is there any guidelines on how to save PVRTC with alpha channels?
     
    Last edited: Jan 7, 2013
  11. joe.davis

    joe.davis

    Joined:
    Apr 17, 2012
    Posts:
    14
    That seems like an odd error. Have you tried to vertically flip the texture in PVRTexTool before compressing it?

    PVR is a container format for texture data. The size of the container is the same as PVR v2, but the new format is more flexible. For a full explanation, please see our "Why did we move to a new PVR file format (v3)?" FAQ item.

    For all other questions, can you please post them on the PowerVR Graphics forum? That way, I can loop in the engineers responsible for the compressor and tools to help you.

    Thanks,
     
  12. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
  13. psantoki

    psantoki

    Joined:
    Oct 24, 2012
    Posts:
    17
    Save As Legacy almost works....

    except it doesn't :-(

    $PVR Legacy.jpg
     
  14. psantoki

    psantoki

    Joined:
    Oct 24, 2012
    Posts:
    17
    Found a workaround: encode to PVRTC 4bpp and then Save As Legacy