Search Issue Tracker

By Design

Votes

0

Found in

5.0.1f1

2017.4

2020.2

Issue ID

687128

Regression

No

PVR textures are flipped upside-down when imported in the Editor or loaded via Texture2D.LoadRawTextureData

Texture

-

How to reproduce:
1. Open user-submitted project (Repro.zip)
2. Open the SampleScene
3. Enter Play Mode
4. Note the 2 images(loaded via script and imported in the Editor)
5. Open the PVR textures outside of the Unity Editor(local.pvr or StreamingAssets/lava.pvr)
6. Compare the images

Expected result: the image in Unity matches the image preview outside of Unity
Actual result: the image in Unity is flipped upside-down

Reproducible with: 2017.4.38f1, 2018.4.19f1, 2019.3.6f1, 2020.1.0b2, 2020.2.0a3

Notes:
Expected to be projected correctly with Metal for iOS and OpenGL & Vulkan for Android

  1. Response avatar

    Resolution Note:

    The PVR compressed format does not allow Unity to flip the compressed image upon importing (in contrast to for example compressed DDS files, which Unity flips upon importing). Given that the default orientation of PVR textures does not match the required orientation of Unity, Unity renders these textures upside down. Hence Unity asks for flipped PVR textures (a warning is given: 'Unity expects vertically flipped PVR file.'). PVR encoders such as PVRTexTool allow PVR images to be encoded with a vertical flip, signaled in the PVR image header, hence the image source file does not have to be flipped. If it is not possible to encode the PVR images y-flipped, then the only solution is to manually flip the uvs in the shader. When using PVRTexTool, pass the arguments '-flip y,flag' to flip the image vertically and signal in the metadata that it was flipped.

Comments (2)

  1. Bd86813484ccd8ef1e508e0399a40bce?d=mm

    tswalk

    Nov 28, 2016 17:34

    5.4.x and totally not fixed, also occurs with PVR images.

  2. D50535f95763ab6a72da96fa22854338?d=mm

    Gaello

    May 13, 2015 16:27

    5.0.2 and still not fixed..

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.