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
Toolclass, using theViewinstance's family ofdrawmethods.see:
https://developers.google.com/sketchup/docs/ourdoc/view#draw -
So.. for color interpolation within a
Toolclass, 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.blendmakes 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement