Wednesday, 13 March 2013

Horizontal unwrapping

"Horizontal unwrapping" is something I've been wanting to do in UDK for a while now. The idea is that if you can perform simple unwraps in-engine based on world position, you can use that information to apply things like grunge really easily and ensure its the correct way up, even if your asset has been rotated.

Theoretically, one could even apply that same grunge to all objects in the scene, and it would harmonize them by applying the same dollop of grunge to all objects in close proximity, a bit like a decal might.

The problem I've always hit is that unwrapping based on world position is essentially planar mapping, and suffers all the same problems (stretching at oblique angles).

I tried again to solve the problem by incorporating the user-unwrapped UVs, with no great success, and also by examining the direction of any given face to choose which direction to "project from". Also unsuccessful, resulting in weird stretching and squashing. This was the best result I could come up with, and it wasn't good enough to use: