pvrtc_compress quality issue

This topic contains 6 replies, has 2 voices, and was last updated by  oiram 5 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #30782

    oiram
    Member

    hello, I use pvrtc_compress of the latest 2.10 release sdk to compression texture.

    But when I check these images between PVRTexToolGUI and pvrtc_compress, quality much different.

    I’v confirmed they are same params passed in, same width/height, same as 4bits.

    Some pixels missed at pvrtc_compress image, and with many artifacts.

    And, would you please give come tutorial or sample for how to use these lib?

    thanks for great work.

    #35561

    Hi Oiram,

    The library “pvrtc.lib” is now considered legacy so starting next release, support for this will be completely removed. This library uses different compressor entry points to PVRTexTool/PVRTexLib which is probably why you’re seeing differing images between the two. It should also be noted that the “quality” argument also differs slightly – a value of 0 in pvrtc_compress is the equivalent of ‘Normal’ (1) in PVRTexTool/PVRTexLib. Basically all the values are one lower in pvrtc.lib.

    Thanks,

    Tobias

    #35562

    oiram
    Member

    Hi Tobias,

    OK, I know that. Then I change to use PVRTexLib.lib.

    Could you please show any sample code to use it?

    I just want to use it to compress tga/png/bmp/jpg to pvr in my 3dmax export plugin.

    Thank,

    Oiram

    #35563

    Hi Oiram,

    The PVRTexLib manual shows examples of how to compress bitmap data into a pvr file. For conversion from the various image file formats you’ll need to use your own code or functionality within 3dsmax if available.

    Thanks,

    Tobias

    #35564

    oiram
    Member

    Thanks for reply.

    I just follow the manual:

    unsigned char* bytes = new unsigned char[width * height * 4];

    memset(bytes, 5, width * height * 4);

    PixelType PVRTC4BPP(ePVRTPF_PVRTCI_4bpp_RGBA);

    CPVRTextureHeader header(PVRTC4BPP.PixelTypeID, height, width);

    CPVRTexture texture(header, bytes);

    bool r = false;

    r = texture.saveFile(“2.pvr”);

    delete [] bytes;

    but colour of the image is not correct.

    any advice?

    #35565

    Hi Oiram,

    You’ll actually need to convert the texture seperately, essentially what you’ve done is tell PVRTexLib that your RGBA data is actually PVRTC 4bpp data. What you’ll need to do instead is this:

    unsigned char* bytes = new unsigned char[width * height * 4];

    memset(bytes, 5, width * height * 4);

    CPVRTextureHeader header(PVRStandard8PixelType.PixelTypeID, height, width);

    CPVRTexture texture(header, bytes);

    PixelType PVRTC4BPP(ePVRTPF_PVRTCI_4bpp_RGBA);

    //This line converts from RGBA8888 to PVRTC 4bpp
    bool bSuccess = Transcode(texture,PVRTC4BPP,ePVRTVarTypeUnsignedByteNorm,ePVRTCSpacelRGB);

    bool r = false;

    r = texture.saveFile(“2.pvr”);

    delete [] bytes;

    #35566

    oiram
    Member

    Thanks, it works now!

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.