"Grow Black" Node?

I want to get a texture , for example, a muscgrave texture, and then get a version of the musgrave as if I has selected the black in gimp, then used selection > grow. And then painted the selection black again, with the same falloff the original black and white image had.
Is there a way to do this?

Unfortunately, there is no pixel measurement within material nodes - which is why there is no blur and no dilate-erode (what you are describing relates to the dilate-erode node in compositing nodes).

1 Like

that’s too bad; seems like a basic thing.
Do you know if there are plans for it?

I always thought there could be some kind of pre-processing step before rendering where these kind of operations would be performed - blurring, sharpening, growing, shrinking… any kind of filter that operates on pixels would just transform the existing texture into a new one stored in memory, that would be sampled like a regular (untransformed) image during rendering. I guess that’s too much hassle for something you can just do beforehand in gimp.

1 Like

Sounds like a reason to resurrect texture nodes. That and being able to mix a few textures into a displace modifier.)

You can’t go that way if you want unlimited resolution. If you’re required to bake down the procedural first, then sure, I guess it’s possible to do the effect but still hard to try and adjust.

To be honest I’m not so keen on these relating to pixel measurement in compositing mode - it means that if you go from half res to full res you have to change all your settings.

Yeah, this so much. Especially the displace part.

I meant doing pixel filtering operations for procedural (or image) textures, not compositing. Imagine how much more useful the default voronoi settings could be for bumps if we could smooth out the currently hard transitions.

1 Like

Would something like this be enough for your needs??

Hummm… I use this script for that effect… Here I’m using a Gaussian curve, but there are other options:
(I didn’t use metadata neither clamped Chaos and Size… they produce strange effects if set too high)

color cellnoise_color(point p, float c)
	float r = (cellnoise(p)-0.5)*c + 0.5;
	float g = (cellnoise(point(p[1], p[0], p[2]))-0.5)*c + 0.5;
	float b = (cellnoise(point(p[1], p[2], p[0]))-0.5)*c + 0.5;

	return color(r, g, b);

void smooth_voronoi(point p, float chaos, float scale, float da)
	int xx, yy, zz, xi, yi, zi;

	xi = (int)floor(p[0]);
	yi = (int)floor(p[1]);
	zi = (int)floor(p[2]);

	da = 0.0;

	for (xx = xi - 1; xx <= xi + 1; xx++) {
		for (yy = yi - 1; yy <= yi + 1; yy++) {
			for (zz = zi - 1; zz <= zi + 1; zz++) {
				point ip = point(xx, yy, zz);
				point vp = (point)cellnoise_color(ip, chaos);
				point pd = p - (vp + ip);
				float d = dot(pd,pd);
                float s = pow(M_E, d*-scale);

shader node_voronoi_texture(
	float Scale = 5.0,
	point Vector = P,
    float Chaos=1.0,
    float Size=1.0,
	output float Fac1 = 0.0)
	vector NP = Vector*Scale;
	float da;
	smooth_voronoi(NP, Chaos, 5/Size, da);
	Fac1 = fabs(da);


Using 2019-05-20, I’m not able to get the code to work for bump height, but looks nice for color.
I also no longer can resize my nodes? Click-dragging when the resize indicator shows will only translate the node.
Also, what is this “Toggle Node Preview” about when you right click a node?

The input Vector must be connected to some other node… just an old cycles’ limitation.
The rest are bugs waiting to be fixed.
And the ‘Toggle Node Preview’ is the same as the one in the node editor header menu. It’s for nodes that have a preview window.

Doh. Me so stupid. I wasn’t aware of the limitation, but I should have tried vectors!
Ok. I think it’s the first time ever I have right clicked a node (that I remember).

I’m sure it has its uses, but for a general blur, I was more thinking of using Cells Color output to use as randomized flat areas of normals (think metal plates that are not evenly flat).