Page MenuHome

Add support for flipping an image in X and Y
Needs ReviewPublic

Authored by Bill Currie (taniwha) on Feb 26 2019, 10:42 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

It seems that DDS images have no standard for orientation (particularly in the Y direction), so support every possible orientation, and for all(?) formats supported by blender

Diff Detail

Repository
rB Blender

Event Timeline

This seems like its something we should try to avoid, we could use this only for DDS and read in flipped at load time - if this is really undefined, this way it's not a post process which slows down the load.

The main problem is Blender provides no means to efficiently flip an image once loaded (the only way I've found is to use python code to run through the pixels doing the flip, and this is quite slow). The only efficient option I've found is to add a UV-axis flip node in the material, but this makes it very difficult to edit the UVs because they do not match the image they are mapping.

In the end, I realized that with DDS images not specifying the orientation and there being conflicting standards, it is impossible for Blender or an import script to reliably guess the correct orientation (though game-specific import scripts do have the advantage that a game probably uses the same orientation for all its DDS images). Thus it seemed most reasonable to make the orientation selectable post-load and to expose the options to the user as the final decision as to the correct orientation does come down to the user.

However, with the options exposed, supporting the flips for only DDS made little sense and seemed like it would become a source of complaints from users.