{"id":298,"date":"2014-03-25T16:22:18","date_gmt":"2014-03-25T23:22:18","guid":{"rendered":"http:\/\/www.toadstorm.com\/blog\/?p=298"},"modified":"2014-03-25T16:22:18","modified_gmt":"2014-03-25T23:22:18","slug":"ptex-weirdness-in-vray","status":"publish","type":"post","link":"https:\/\/www.toadstorm.com\/blog\/?p=298","title":{"rendered":"Ptex weirdness in VRay."},"content":{"rendered":"<p>I&#8217;ve been messing around with using Ptex in VRay for Maya and ran into a particularly weird little problem involving a normal map exported from Mudbox. It&#8217;s probably easier to show it than to tell about it (Fig. 1):<\/p>\n<div id=\"attachment_299\" style=\"width: 160px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex.jpg\"><img aria-describedby=\"caption-attachment-299\" decoding=\"async\" loading=\"lazy\" class=\"size-thumbnail wp-image-299\" alt=\"bad ptex bottle\" src=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-150x150.jpg\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-150x150.jpg 150w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-300x300.jpg 300w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-96x96.jpg 96w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-24x24.jpg 24w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-36x36.jpg 36w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-48x48.jpg 48w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex-64x64.jpg 64w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtex.jpg 1024w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><p id=\"caption-attachment-299\" class=\"wp-caption-text\">Fig. 1. Check out the wax wrapper up top&#8230; all chunky and gross.<\/p><\/div>\n<p>That wax wrapper looks terrible&#8230; not at all like the original sculpt. The mesh is set to render as a subdivision surface (using the custom VRay attributes from the Attribute Editor), but the details are all mangled like it&#8217;s not subdividing the surface at all.<\/p>\n<p>Even weirder is what happens when I only render a small region of the image (Fig. 2):<\/p>\n<div id=\"attachment_300\" style=\"width: 160px\" class=\"wp-caption alignright\"><a href=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion.jpg\"><img aria-describedby=\"caption-attachment-300\" decoding=\"async\" loading=\"lazy\" class=\"size-thumbnail wp-image-300\" alt=\"bad ptex with region render\" src=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-150x150.jpg\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-150x150.jpg 150w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-300x300.jpg 300w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-96x96.jpg 96w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-24x24.jpg 24w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-36x36.jpg 36w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-48x48.jpg 48w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion-64x64.jpg 64w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_badPtexRegion.jpg 1023w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><p id=\"caption-attachment-300\" class=\"wp-caption-text\">Fig. 2. The details are suddenly cleaner! All I changed was enabling region render.<\/p><\/div>\n<p>This was really confusing, and although I&#8217;m still not 100% sure what&#8217;s going on in VRay to cause this (I&#8217;m fairly certain this is a bug), there is at least a solution.<\/p>\n<p>What&#8217;s probably happening here is that choosing to render this mesh as a subdivision surface is changing the point count of the object BEFORE any Ptex information is applied to the mesh during rendering. Ptex is very sensitive to your geometry&#8230; any change in point count could potentially break things. You&#8217;re not allowed to polySmooth objects that will have Ptex textures, for example, or Maya won&#8217;t know what points to assign Ptex information to.<\/p>\n<p>The way to get around this is to put the object into a VRay displacement set. Assign displacement and subdivision attributes to the displacement set like you normally would, but don&#8217;t attach a displacement map, and make sure the Displace Amount is set to 0. Rendering this way gets you the more correct image (Fig. 3):<\/p>\n<div id=\"attachment_301\" style=\"width: 160px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex.jpg\"><img aria-describedby=\"caption-attachment-301\" decoding=\"async\" loading=\"lazy\" class=\"size-thumbnail wp-image-301\" alt=\"correct ptex\" src=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-150x150.jpg\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-150x150.jpg 150w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-300x300.jpg 300w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-96x96.jpg 96w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-24x24.jpg 24w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-36x36.jpg 36w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-48x48.jpg 48w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex-64x64.jpg 64w, https:\/\/www.toadstorm.com\/blog\/wp-content\/uploads\/2014\/03\/whisky_bottle_goodPtex.jpg 1024w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><p id=\"caption-attachment-301\" class=\"wp-caption-text\">Fig. 3. This looks a lot more like the original sculpt from Mudbox.<\/p><\/div>\n<p>This seems like buggy behavior to me more than some technical thing I&#8217;ve overlooked, but thankfully the workaround is pretty minimally difficult. If you have any better insight as to what exactly is happening here or if there&#8217;s a less hacked way to prevent it, I&#8217;d love to hear it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been messing around with using Ptex in VRay for Maya and ran into a particularly weird little problem involving a normal map exported from Mudbox. It&#8217;s probably easier to show it than to tell about it (Fig. 1): That wax wrapper looks terrible&#8230; not at all like the original [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,19],"tags":[10,46,27],"_links":{"self":[{"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/298"}],"collection":[{"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298"}],"version-history":[{"count":3,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":304,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions\/304"}],"wp:attachment":[{"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.toadstorm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}