Grasshopper

algorithmic modeling for Rhino

Hello everyone,

I am trying to create a formula in GH that would translate XYZ and RGB values into a colored flat mesh that would create a sort of image. (reverse of Image Sampler?)
Would I use the Mesh Spray component? 

Also how should I combine the 2 sets into one that represents all: XYZRGB values for each point as a single set.

1. XYZ + 1. RGB = 1. XYZRGB

2. XYZ + 2. RGB = 2. XYZRGB

etc.

Thank you very much for your help.
Still learning!

Views: 1118

Replies to This Discussion

Hi PJ,

[Mesh Spray] is for when you only have a few points of interest and want to interpolate the colour of the mesh in between. If you want to set every single vertex, you're better off using the [Mesh Colours]. It takes a single mesh and a list of colour values, one for each vertex (well actually it will cycle the colour list, but you want to provide one colour per vertex).

If you want to make an image (ie. an actual bitmap) by setting pixels, there are more efficient ways of achieving that, although that will require custom scripting and you won't be able to preview the data in GH or Rhino.

Finally, if you want to format a bunch of data into a comma separated list or some other kind of template, your best bet is usually the [Format] component. You'll need to increase the number of inputs to cater for all your data (6 in your case), decompose the points into XYZ values and decompose the colours into RGB values. Then you plug the x, y and z values into the 0, 1 and 2 inputs respectively, and the r, g and b values into 3, 4 and 5. Then the format you'll need will be something like:

{0}, {1}, {2}, {3}, {4}, {5}

Or, if you want to display all point coordinates with exact three decimals:

{0:0.000}, {1:0.000}, {2:0.000}, {3}, {4}, {5}

Or if you want to use semicolons to separate the point values from the colour values:

{0}, {1}, {2}; {3}, {4}, {5}

etc. etc.

Thank you very much David. That's very helpful. Will definitely use the Format component.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service