Rendering exported .ply file (with uv texture) in Blender (tip)

If you want to render textured OF meshes in Blender, I realized two things need to be adjusted.

.ply files saved from OF include properties called “u” and “v”, but Blender expects them to be called “s” and “t”. To fix this, I edited the .ply file with a text editor and replaced

property float u
property float v

with

property float s
property float t

The second issue I had was that the texture was upside down. Since I use ofEnableNormalizedTexCoords(), I could flip the “v” coordinate (“t” in this case) in Blender like this:

In words: take the uv coordinate, split into xyz, replace y by (1-y), pack xyz back into a vector and use that vector with inverted y for the texture mapping. If I had a bunch of textures I could have flipped the images upside down on the command line.