{"id":405,"date":"2026-07-13T11:53:57","date_gmt":"2026-07-13T15:53:57","guid":{"rendered":"https:\/\/www.tks-designs.com\/blog\/?p=405"},"modified":"2026-07-13T11:53:57","modified_gmt":"2026-07-13T15:53:57","slug":"houdini-uvs-from-rest-position","status":"publish","type":"post","link":"https:\/\/www.tks-designs.com\/blog\/?p=405","title":{"rendered":"Houdini UVs from Rest position"},"content":{"rendered":"<h3 class=\"subtitle wp-block-kia-post-subtitle\">not sure why I couldn&#8217;t find this anywhere else<\/h3>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"672\" src=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image.png\" alt=\"\" class=\"wp-image-406\" srcset=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image.png 858w, https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-300x235.png 300w, https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-768x602.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/figure>\n\n\n\n<p>Getting uvs from rest position in Houdini is critical for texturing most of the interesting solvers especially FLIP. There are many methods but I couldn&#8217;t find anything that was just straightforward on the internet. Note this solution does not utilize animated rest positions &#8211; though it could be easily adjusted by you to do so.<\/p>\n\n\n\n<p>Since UVs are a 3 vector, we&#8217;ll convert our primary surface axises (in this case, x and z) to the first two UV values, and use the 3rd value to store a Y axis number<sup data-fn=\"cd989979-9a6c-42cf-9236-7a97d9ca6e9b\" class=\"fn\"><a href=\"#cd989979-9a6c-42cf-9236-7a97d9ca6e9b\" id=\"cd989979-9a6c-42cf-9236-7a97d9ca6e9b-link\">1<\/a><\/sup>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"380\" src=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-1.png\" alt=\"\" class=\"wp-image-407\" srcset=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-1.png 456w, https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-1-300x250.png 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/a><\/figure>\n\n\n\n<p>In this case, we&#8217;ll use the lovely min-max-average node (from labs) to determine the minimum and maximum value of our rest attribute (created in our flip container node above our solver). This node creates a detail attribute based on your specifications, so we&#8217;ll ask for the minimum and maximum values of all points.<\/p>\n\n\n\n<p>Then it&#8217;s into vex:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vector max_rest = detail(0, \"max_rest\");\nvector min_rest = detail(0, \"min_rest\");\n\nfloat distX = max_rest.x-min_rest.x;\nfloat distY = max_rest.y-min_rest.y;\nfloat distZ = max_rest.z-min_rest.z;\n\nfloat uvX = (@rest.x-min_rest.x)\/distX;\nfloat uvY = (@rest.y-min_rest.y)\/distY;\nfloat uvZ = (@rest.z-min_rest.z)\/distZ;\nv@uv = set(uvX, 1.0-uvZ, uvY);<\/code><\/pre>\n\n\n\n<p>We&#8217;re simply converting our rest position into a float value from 0.0 -> 1.0, and putting that into our uv attribute. Note we used our primary axises (X + Z) as the first two values in our uv vector, and I flopped the z so it would look left -> right from the camera.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"638\" src=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-2.png\" alt=\"\" class=\"wp-image-409\" srcset=\"https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-2.png 808w, https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-2-300x237.png 300w, https:\/\/www.tks-designs.com\/blog\/wp-content\/uploads\/2026\/07\/image-2-768x606.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/a><\/figure>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"cd989979-9a6c-42cf-9236-7a97d9ca6e9b\">UVs are in 2d space, so the 3rd number is generally superfluous, however it is passed to the shader so it could be utilized for the texture. In this case, you could use the Y value of our UVs to determine the depth of the liquid and shade those particles darker. (blood in the water anyone??)  <a href=\"#cd989979-9a6c-42cf-9236-7a97d9ca6e9b-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><\/ol>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting uvs from rest position in Houdini is critical for texturing most of the interesting solvers especially FLIP. There are many methods but I couldn&#8217;t find anything that was just straightforward on the internet. Note this solution does not utilize animated rest positions &#8211; though it could be easily adjusted by you to do so. <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.tks-designs.com\/blog\/?p=405\" class=\"more-link\"><span>Continue Reading &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"kia_subtitle":"not sure why I couldn't find this anywhere else","footnotes":"[{\"content\":\"UVs are in 2d space, so the 3rd number is generally superfluous, however it is passed to the shader so it could be utilized for the texture. In this case, you could use the Y value of our UVs to determine the depth of the liquid and shade those particles darker. (blood in the water anyone??) \",\"id\":\"cd989979-9a6c-42cf-9236-7a97d9ca6e9b\"}]"},"categories":[2,9,1,10],"tags":[],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-houdini","category-math","category-uncategorized","category-vfx"],"_links":{"self":[{"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=405"}],"version-history":[{"count":2,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":410,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions\/410"}],"wp:attachment":[{"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tks-designs.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}