Search Unity

Please integrate the powervr tool from imgtech

Discussion in 'Editor & General Support' started by techmage, Aug 30, 2011.

  1. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,067
    If you use the commandline PVR compression utility that comes from the imgtech with the pvrtextool here http://www.imgtec.com/powervr/insider/powervr-pvrtextool.asp

    The resulting visual quality of the texture is notably better, and is the same exact size. This is a really serious issue to me because I need the superior image quality that the commandline PVR textool from imgtech provides, but unfortunately it's a pain in the ass to have to use because it's all through commandline! And unity's nice workflow for texture importing and set up becomes null when having to use commandline tools, and I would much prefer to use unity's workflow rather than commandline.

    I imagine that Unity cannot legally include the commandline pvr textool. So would you please make it so we ourselves could download the pvr textool, and configure unity to use it instead of whatever comes with unity?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,603
    The commandline pvr textool is actually included in every unity osx build, otherwise you couldn't even generate PVRs :)

    Also there is no problem using this tool and its output, since unity 3.1 or so, you can drag and drop pvr textures in from the outside, no need to generate them inside of Unity unless you want (or the restricted settings force you to)
     
  3. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,067
    Oh it is? Well then they just need to up the quality settings for it.

    I do want to use the tool inside of Unity, and not the commandline converter. The commandline converter doesn't provide as good of a workflow.

    Unless do you have any tricks to using the commandline tool more efficiently? The best I could figure to improve workflow was to write an .sh script to convert all the textures in a folder automatically.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,755
    Doesn't it also have a GUI (or is that windows only?) because the GUI version of the tool is pretty easy to use.

    But yeah, having the superior compression algorithm in Unity would be preferable. Unless there is some drawback we're not aware of.
     
  5. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,067
    There is a GUI version but I have the issue that my scene literally has like 100 1024x1024 textures all spread out in different folders and so it needs to be automated.
     
  6. Schnelle

    Schnelle

    Joined:
    Jan 17, 2011
    Posts:
    89
    Have you done this yet? I wrote a script two years ago that did something similar for a different app. This was the first script I've ever written like this so I'm sure it's terrible, but here you are. My source files were in a folder called "PNG Sprites".

    Hope it helps you get started. You might have to change the path to the texturetool binary and obviously you have control over the quality settings there as well.

    Code (csharp):
    1. #!/bin/sh
    2.  
    3. find . -regex '.*/PNG Sprites/.*\.png' -print0 | while read -d $'\0' file
    4. do
    5.   fileName=`echo $file | perl -pe 's/.*Sprites\/(.*)\.png/$1/'`
    6.   pvrName="$fileName.pvrtc"
    7.  
    8.   echo "Processing image: $fileName"
    9.   /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --channel-weighting-linear --bits-per-pixel-4 -o "$pvrName" "$file"
    10. done
    11.  
     
    Last edited: Sep 2, 2011
  7. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,067
    I got it working but the issue I ran into with the sh script is I could not figure out how to get it to convert an entire directory of images that had subdirectories, then spit out all the pvr into the same directory and subdirectory structure.
     
  8. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,101
    +1 to including an option for better quality compression (any performance drawbacks?)
    instead of having to use the external tool.

    maybe this should be in wish-list
     
  9. Toxic Blob

    Toxic Blob

    Joined:
    Jun 8, 2010
    Posts:
    18
    Unity 3.4.2 comes with PVRTexTool Version 3.11 (located at /Applications/Unity/Unity.app/Contents/Tools). The most recent version available is PVRTexTool is 3.23, though what has changed I do not know.

    Frustratingly I can’t find any option to request that Unity uses the command line option -pvrtcbest when converting. So at the moment I do all my texture conversion externally. Other than a more complicated pipeline, I have certainly not found any runtime performance drawbacks.
     
  10. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,348
    I also do my texture conversion manually. It is annoying and not a very happy situation. Also having trouble making unity load 16 bit pngs, for 16 bit output, without further messing it up. I am probably doing something wrong. Having far better 16 bit image creation would help - colour safe, dithering, dithering with alpha etc, all go a long way to a better looking app :)

    Perhaps this is a situation where asset store tools would help.
     
  11. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,067
    For as open as Unity claims to be to allowing you to do anything, it bothers me that little things like this are locked down.

    You can write an entire visual scripting system in unity, but if you want to compress a PVR texture at a better quality inside the editor, out of luck.

    This is a really stupid mistake on UT's part as well, it's like they didn't even examine the PVR texture compression tool, or do any tests with it, before integrating.

    Maybe this should be submitted as a bug?
     
    Last edited: Oct 31, 2011
  12. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Woah, I tried this

    Code (csharp):
    1. cd /Applications/Unity/Unity.app/Contents/Tools
    2. mv PVRTexTool PVRTexToolOrig
    3. nano PVRTexTool
    Code (csharp):
    1. #!/bin/bash
    2. ./PVRTexToolOrig "$@" -pvrtcbest
    3.  
    Code (csharp):
    1. chmod a+x PVRTexTool
    but my Unity 3.4.2f2 actually uses

    /Applications/Unity/Unity.app/Contents/Tools/texturetool to generate its PVRTCs.

    Try it, try renaming texturetool
     
  13. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Good news, Unity 3.5 uses PVRTexTool with the command line

    Code (csharp):
    1. -p -fPVRTC4 -pvrtcfast -iTemp/PVRT-Feed.png -oTemp/PVRT.pvr
    With file names like that, multithreaded image conversion looks a way off!

    Anyway. The good news is that by renaming PVRTexTool and replacing it with the bash script below, you can make it use best compression.

    PVRTexTool:
    Code (csharp):
    1. #!/bin/bash
    2. replcommand="$@"
    3. exec /Applications/Unity/Unity.app/Contents/Tools/PVRTexToolOrig ${replcommand/fast/best}
     
    Last edited: Jan 2, 2012
  14. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,348
    But we shouldn't need to. How absurd. Unity, how about a little fix for 3.5 final? a feather in your cap. A well-swizzled feather.
     
  15. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Couldn't agree more.

    I bet it would mess with the asset cache server. It'll be >3.5 before you see it exposed.
     
  16. Jaywalker

    Jaywalker

    Joined:
    Jan 13, 2012
    Posts:
    15
    Ignore my post below: totally missed this!

    http://forum.unity3d.com/threads/126561-PVRTC-Compression-Quality-adjustment-in-3.5



    Wow Thanks a ton for this!

    The difference is insane... it seems crazy to me that the tool isn't set to best on default.
    we've been trying to use uncompressed textures because the default Unity 3.5 pvr compression tool settings give terrible results.


    You just made my day!

    thanks again!
     
    Last edited: Mar 26, 2012
  17. heavymetalfox

    heavymetalfox

    Joined:
    Sep 9, 2008
    Posts:
    370
    Using the best settings in Unity's texture inspector iOS override doesn't seem to make a big difference, just want to know how you guys do it manually. What should I type and where in the editor?