Procedural colouring of a surface?

Say I have a function that given coordinates x,y,z returns a value betwen 0.0 and 1.0. For example:

f(x,y,z):

  • return 0.5sin(x^2 + z^2) + 0.5

and I want to use this function to colour some surfaces in my model based on the x, y, z coordinates: Where the function returns 0.0 they are to be blue, where the function returns 1.0 to be red, to be blue. the points where the function returns 1.0 to be red, and a gradual shift via purples in-between.
So, a flat surface parallel to the x-z plane coloured this way would show a circular wave pattern around the y-axis.
Is it possible to do something like this in Rhino6? I see only predefined textures. .

Try “gradient”:

image

The picture shows one of the “preset” color schemes, but you can modify colors to whatever you need.

// Rolf

I think the GhGL component by @stevebaer can help here. Mentioning him so he can jump in.

Hey thank you guys! That seems a lot like what I was looking for, yes, a bit like the Material Room in Poser.
(my frame of reference)
Would GhGL also have nodes to bring in the direction of the normals and the curvature of the surface?

And here’s the definition
ghgl_colorfunction.gh (517.8 KB)

1 Like

normals are already available; we would have to do some extra coding to make curvature available to the shaders

1 Like

thanks guys.
I will see how I can use this to build on.
any good pointers with tutorials/instructions on Grasshopper?