Color interpolation across a face
-
If you know the binary fileformat for some image filetype, you could write out a file in binary mode:
` img = File.open('myimage.bmp',"wb")
img.write(value)
...
img.close`
Then bring that image into your materials collection.
-
Hmmm.. I'll need to think on that...
Have you been following what Aerilius' OnScreen GUI Toolkit
or: Chris Fullmer's On Screen GUI RGB Colorpicker
-
To draw in OpenGL style (either 3D or 2D,) in SketchUp, must be done within a
Tool
class, using theView
instance's family ofdraw
methods.see:
https://developers.google.com/sketchup/docs/ourdoc/view#draw -
So.. for color interpolation within a
Tool
class, when you set the color (just prior to painting a point,) withview.drawing_color=()
you would evaluate the argument using color.blendThe receiver color would be color of one vertice, arg1 the other vertice's color, and the weight arg would be percentage (
Float
) of the distance between the two vertices. -
The API doesn't let you set vertex colour. Wish it did.
-
That's not what he wants.
He wants to draw multi-gradient color fill, on-the-fly.
-
@dan rathbun said:
That's not what he wants.
He wants to draw multi-gradient color fill, on-the-fly.
Yes - and in OpenGL you do that by defining a colour for each vertex in a polygon where the shader then creates a gradient between each vertex colour across the polygon surface.
-
Yep.. it would be nice to have more OpenGL draw functions.
Implementing a shader in Ruby is bound to be slow. -
@dan rathbun said:
... you would evaluate the argument using color.blend
color.blend
makes brown out of red and green.
In case you need a different interpolation (where you want red and green to result yellow), you need to write your own interpolation method, or takeColor.interpolate(color1, color2,...)
of https://bitbucket.org/Aerilius/color/wiki/Home -
Thanks everyone for the replies.
@Dan using the draw in a tool's view method looks like a plausible option. Let me dig into it and get back.
Thanks again.
Advertisement