{"id":1144,"date":"2009-10-15T21:08:48","date_gmt":"2009-10-16T02:08:48","guid":{"rendered":"http:\/\/gracefulspoon.com\/blog\/?p=1144"},"modified":"2012-07-11T13:40:22","modified_gmt":"2012-07-11T18:40:22","slug":"parametric-image-sampling","status":"publish","type":"post","link":"http:\/\/gracefulspoon.com\/blog\/2009\/10\/15\/parametric-image-sampling\/","title":{"rendered":"parametric image sampling"},"content":{"rendered":"

\"imagesampler021\"<\/a>
\n
\"imagesampler04\"<\/a><\/p>\n

 <\/div>\n

A simple test based on Sanghoon Yoon’s<\/a> Grasshopper definition for using the new image sampler node, I swapped out a text image for an image image, because, well I just like fonts and 3D I guess. One of the things that’s cool is that the image is “live,” so as you change the text, the grasshopper definition updates. And of course you can also parametrically control the size of the pixels, the multiplication of the heightfield and the overall size of the surface. To get a random color on each polysurface, I modified Dale Fugier’s script<\/a> located on the rhinoscript wiki page to include a function to assign the object color to the material color so it will render out in vray. See grasshopper definition and code below:<\/p>\n

 <\/div>\n

Edit: Added Link to download grasshopper definition and source image file. Click Here (zip file)<\/a>.<\/p>\n

 <\/div>\n


\n
\"imagesampler01\"<\/a>
\n
\"imagesampler03\"<\/a><\/p>\n

 <\/div>\n

\"rhino\"<\/a>
\nFrom
Dale Fugier’s ObjectColor.rvb<\/a>:<\/p>\n

 <\/div>\n

Sub SetObjectColorRandom<\/p>\n

 <\/div>\n

\tDim objects, red, green, blue, i, material<\/p>\n

 <\/div>\n

objects = Rhino.GetObjects(“Select objects for randomly color change”, 0, True, True)
\n If IsNull(objects) Then Exit Sub<\/p>\n

 <\/div>\n

Rhino.EnableRedraw False
\n For i = 0 To UBound(objects)
\n\t\tred = Int(125 * Rnd)
\n\t\tgreen = Int(200 * Rnd)
\n\t\tblue = Int(180)
\n\t\tRhino.ObjectColor objects(i), RGB(red, green, blue)<\/p>\n

 <\/div>\n

\t\tCall Rhino.ObjectColor (objects(i), RGB(red, green, blue))
\n\t\tmaterial = rhino.AddMaterialToObject (objects(i))
\n\t\tCall rhino.MaterialColor (material, RGB(red, green, blue))
\n\t\tCall rhino.MaterialShine (material, 255)
\n Next
\n Rhino.EnableRedraw True<\/p>\n

 <\/div>\n

End Sub<\/p>\n

 <\/div>\n","protected":false},"excerpt":{"rendered":"

  A simple test based on Sanghoon Yoon’s Grasshopper definition for using the new image sampler node, I swapped out a text image for an image image, because, well I just like fonts and 3D I guess. One of the things that’s cool is that the image is “live,” so as you change the text, […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,14,15],"tags":[74,39,84,85,22],"_links":{"self":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/1144"}],"collection":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/comments?post=1144"}],"version-history":[{"count":18,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/1144\/revisions"}],"predecessor-version":[{"id":2723,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/1144\/revisions\/2723"}],"wp:attachment":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/media?parent=1144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/categories?post=1144"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/tags?post=1144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}