Houdini - VEX Flex

This is not really VEX flexing but I really liked that title :)

Trigonometry

Rotation

In an Unreal shader I was building I needed to “rotate back” some pixels in the normal map so that the normals was corrected when the uv for the texture sampling was rotated. The key is to use the inverted rotation to rotate back the R(U) and G(V) color values (per pixel) so that the map is corrected. Here is a hip file demonstarting the concept:

Also a big gotcha for me was that when you generate the normal map for use in unreal it needs to have the Y flipped, if not the math would not work as intended.

rotate_vector2_01.hiplc
Rotating a vector 2 and the inversing the rotation to cancel out the initial rotation