Question to Gurus: Material changing when stretched.

I try to create a material (nylon) which will get the more transparent the more it will be streched.
The object is modified with the cloth physics.

But I can’t find any possibility to change the material depending on the grade of modification of the mesh.

Has anyone an idea how to manage this?

you could try the tension-map addon…I personally haven’t mess with it, but theoretically it should work (making a vertex-colour layer to drive the opacity, with the attribute node).

1 Like

After a “few weeks” experimenting (from time to time)…
The “tension-map addon” seemed to have been discontinued. (I can’t find it)
But I’ve worked out a possibility.
After all I’m not good in geometrical maths and so it’s running aceptable but not perfect.
A little Script in OSL like a “Mix Shader”:

shader grid(
	closure color material1=0 [[ string help="grid material"]],
	closure color material2=0 [[ string help="filling material"]],
	float width=0.1 [[ string help="relative width"]],
	int lines=50 [[ string help="lines in grid"]],
	point uv=0,
	output closure color material_out=0
)
{
	if(lines<1) {
		material_out=material2;
		return;
	}
	point origin=point(0.25,0.25,0.0);
	float du=distance(origin,dPdu);
	float dv=distance(origin,dPdv);
	float d=min(du,dv);
	//float d=distance(dPdu,dPdv);
	//printf("%2.2f / %2.2f\t%2.2f\n",dPdu,dPdv,d);
	float x=abs(uv[0]);
	float y=abs(uv[1]);
	float dist1=x*lines-int(x*lines);
	float dist2=y*lines-int(y*lines);
	float dist=min(dist1,dist2);
	if(uv[0]<uv[1]) {
		if(dist1<width/dv || dist2<width/du) { 
			material_out=material1; 
			return; 
		}
	} else {
		if(dist1<width/du || dist2<width/dv) { 
			material_out=material1; 
			return; 
		}
	}
	material_out=material2;
}

So if someone stumbles across this thread and has a better formula, I would be happy…