Colorchange of metaballs or surface

Hello my fellow Blenderians,

I stuck on a project and maybe you can end my struggle. :-)

I made a filament with metaballs (it is more likely a sausage, see the attached pic) and over 100 frames some parts of it increase the volume. Now I tried to achieve a color change for the thick parts. Basically, the idea is: slim metaballs should be blue and big metaballs should be red. (The gradient of color is indicated below the metball-sausage).

I read about metaball families, and that these are always with one material associated. Is there a way to calculate it to a surface and make a colorchange via texture?

Sadly, I haven't found a tutorial which covers that.

Greetings and best regards, Patrick

• Cycles, Eevee, Workbench or internal render engine. – Leander Nov 9 '19 at 13:59
• I work with Eevee at the moment, but I am also familiar with cycles. I played around with coloring the faces manually, but the transition of the colors is isntant and not smoothly. – Patrick Nov 9 '19 at 17:07

You can create a gradient on separate object with no UV map, by using texture coordinates. If we use the texture coordinates of another object (like an Empty), we can easily control the position of colors by translating, rotating or scaling the empty.

Add an Empty at the location you want a color change.
In the material of the meta-ball-object, add Texture Coordinate node with the Empty selected as the Object. Separate the Object coordinates and use the first output, the X coordinate. (Adjust this to your objects orientation obviously.) Since we only want the absolute distance on X and not the signed coordinates, add a math node Absolute resulting in values >= 0.

By transforming the empty, we can move and scale the gradient.

To be able to be able to influence the overall strength of the gradient, let's use the objects Z position. To get the same value for all position on our meta-object, subtract our Geometry's position from the Empty's position. I concatenated an Add operation, to offset the 0 position. By moving the empty along its Z axis, we can control a single value.

Combine both results with a multiply operation and use this output as the factor between your desired colors.

The resulting material can be controled using the empty. By moving it along the Z axis we control the overall intensity of the second color, and by moving and scaling the X axis we control the transformation of the gradient.

If you want to alter the transition you can use

• rgb curves
• or a color ramp.

Convert your metaball object to mesh. Then apply Remesh modifier in smooth mode followed by SubdivSurface steps 2 for good topology. Apply materials the way you want it. Below is an example.