How to compress .EXR textures in PVRTextool?

This topic contains 5 replies, has 2 voices, and was last updated by  royter 4 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #31099

    royter
    Member

    Unity does it, but the quality of the pvrtc is horrible nothing to do with the quality the PVRTextool:
    http://i.imgur.com/E7zYY.jpg
    I managed so far to compress 8bit textures (diffuse textures ) and utilize them inside Unity as .pvr textures.
    But how can I compress my .EXR 32 bit lightmaps? PVRtextool wont read them?I really need to do that, Unity pvrtc compressed lightmaps are just not an option, they are really horrible.

    #36484

    Hi Royter,

    Unfortunately PVRTexTool doesn’t currently support EXR files. However, PVRTC compresses to and from 8-bit only, so you should be able to just turn your EXR files into 8-bit PNGs using an image editor, and use those to create the PVR textures – there would be no noticeable difference between the two.

    Thanks,
    Tobias

    #36485

    royter
    Member

    Hi Royter,

    Unfortunately PVRTexTool doesn’t currently support EXR files. However, PVRTC compresses to and from 8-bit only, so you should be able to just turn your EXR files into 8-bit PNGs using an image editor, and use those to create the PVR textures – there would be no noticeable difference between the two.

    Thanks,
    Tobias

    But wont that kill the dynamic range of the lightmap?
    The problem is that its impossible to verify this, you see there is an option for textures in the Unity editor where you can flag the texture as a “standard” texture or a “lightmap” texture but the .pvr texture don’t have any option in the inspector window.
    Is there anyway to flag the .pvt as a lightmap?

    #36486

    royter
    Member

    I think you are wrong about the “no noticeable difference between the two”, when using an exr converted to PVRTC4 inside Unity, Unity does something magical, I turns the 32bit exr into pvrtc4 and it conserves the dynamic range (really dont know how it does it). But when using directly an 8 BIT PNG lightmap the result is different, devastating in my case if this is what I should expect from your method (converting the 32bitexr to 8bit png then to pvrtc4):

    View post on imgur.com

    #36487

    Hmm, it’s possible that Unity does something odd to their data before compression, but they’re definitely working on 8-bit values, as that’s all that the PVRTC compressor will accept. At a minimum, they are possibly determining the min/max values ahead of time and adjusting the values before compression, or using two channels to create a mantissa/exponent style pairing to maintain the dynamic range, then recombining in the shader. Unfortunately I’m not sure how they do it, but it’s not something present in PVRTexTool at this time; I will consider it as a feature for a future update however.

    Your best bet at this point is to ask the Unity guys about how they do it, or if there’s an update with a more up to date version of PVRTexTool. I’m not sure what version you’re on, but as I understand it, the last 3.5 update should have the most up to date compressor. Also, just to check, have you tried adjusting the PVRTC quality level in Unity? By default I believe Unity only uses the fast compressor, which will limit the quality of detailed textures – you should be able to toggle this to normal, high or best, hopefully getting better output?

    Sorry I can’t be of more help at the moment. We’ll also ask Unity about this out of curiousity, if I find anything out I’ll let you know.

    Thanks,
    Tobias

    #36488

    royter
    Member

    Your best bet at this point is to ask the Unity guys about how they do it, or if there’s an update with a more up to date version of PVRTexTool. I’m not sure what version you’re on, but as I understand it, the last 3.5 update should have the most up to date compressor. Also, just to check, have you tried adjusting the PVRTC quality level in Unity? By default I believe Unity only uses the fast compressor, which will limit the quality of detailed textures – you should be able to toggle this to normal, high or best, hopefully getting better output?

    Sorry I can’t be of more help at the moment. We’ll also ask Unity about this out of curiousity, if I find anything out I’ll let you know.

    Thanks,
    Tobias

    As I mentioned before the 3.5 version Unity compressor has nothing to do with your most up to date compressor.
    Yes, I tried the ”best” quality in the Unity compression option but it still way horrible specially for lightmaps.

    Please keep me informed bd send a private message if you ever have insight on how Unity converts exr to pvrtc and keeping the dynamic range, and if there is anyway we can achieve this ourselves.

    Unfortunately, there is no solution for us when it comes to pvrtc lightmaps, and this was our last hope.

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