Friday, 21 June 2013
Texture UV To Location
I was motivated by this thread on the mailing list (and Gustavo's excellent Motion Tools) to work on a C++ ice node to provide a quick way of finding positions from an input texture uv array (the factory-installed UV to Location node doesn't work on polygonal geometry). The method doesn't require triangulated geometry.
Since we don't have access to pointlocators in the ICE SDK, the node doesn't actually get locations directly but it does generate a position on the polygonal surface from an input UV. The custom ice node is built into a compound that then takes the output positions and generates locations using Get Closest Location. You have the option of using the position directly or using the location port.
The addon is below for 2013 SP1 (64bit only) and contains C++ source code with comments on the barycentric and triangulation methods as well as notes on some of the problems/choices related to building a custom ice node. A sample scene is also included. If you find a circumstance where it doesn't work correctly I'd be very interested in the scene file.
Updated 28 June 2013:
Crash when no geometry under UV fixed.
Texture UV To Location v1.1
Subscribe to:
Post Comments (Atom)
Wow! How did I not know about this? Great as usual.
ReplyDeleteThanks Ciaran. Let me know if you run into any problems using it...
ReplyDeleteThank you for sharing, it's one of those that should be included the distribution.
ReplyDeleteI have one issue, I can't connect any per point data, maybe I'm doing something wrong.
I don't think the node supports a per point context for the input uv data. If you use Build Array from Set to convert the per point data to an array and then use the Element Index/Particle ID to select from the output array you should be able to achieve the same thing...
ReplyDelete