Unity, I Love You, But Your UV Is Horrible
I love Unity. This is the first engine I felt like I can't make anything better than this. Of course, it's mostly due to its awesome editor. But the other day, I found one thing that annoys me: UV coordinates system.
Normally, I(or most graphics programmer, I think?) would map UV coordinates to a texture this way: top-left: (0,0) and bottom-right: (1,1)
(0,0) (1,0) +-----+-----+ | | | | | | +-----+-----+ | | | | | | +-----+-----+ (0,1) (1,1)
This one has a nice benefit: the memory layout of textures match UV coordinate system. So any UV-based texture manipulation becomes easy and straight forward. One example, would be copying a sub rect of a texture based on the UV coords.
But for some reason, Unity maps UV coords differently: bottom-left(0,0) and top-right(1,1)…. so basically it's flipped vertically.
(0,1) (1,1) +-----+-----+ | | | | | | +-----+-----+ | | | | | | +-----+-----+ (0,0) (1,0)
What..? why would you ever do that? I know some math books use this way, but I can't think of any practical benefits of mapping UVs in this way. Sometimes we rendering programmer make a wrong decision we are so used to certain notations. And, to me, this is clearly the case.
If there's any benefit i'm missing here, please let me know. But just don't tell me "it's traditionally done this way, so it must be right". If I was a person who'd accept that kinda BS argument, I'd be a good Christian believing that Jesus was reborn in 3 days after he was killed.