# How would one generate a texture for cracks in different materials?

I would want to have the ability to simulate different variables like brittleness, or other variables to get varied end results.

I would mainly need to generate impact cracks, so it would need to react to different impact angles and speeds.

I am using ActionScript3, but general theory answers will be helpful as well.

• Are you talking about randomly generating crack images to overlay on top of a material, or do you actually mean procedurally cracking an existing object? Commented Nov 11, 2010 at 21:48
• I just need help with the generation of a crack image, but I am going to use it to break/crack existing objects. Commented Nov 12, 2010 at 0:15

You could use a recursive function to generate a root crack, and along that root crack, generate smaller branches of cracks, and so on. You could even animate this to make the effect even cooler.

• Do you have any examples or more theory on this kind of method, your answer is a bit vague. Commented Nov 12, 2010 at 23:38
• Do you have a reference image for the kind of effect you are looking for?
– Gray
Commented Nov 13, 2010 at 4:38
• :P recursions always sound amazing, but then you have to sit down and implement them Commented Mar 12, 2012 at 22:02

Recursion sounds like the right idea, but that alone doesn't cover it. If you want to include things like impact angles things an get pretty complicated. the simple way is to just use the angle as a way of calculating approximate force. using the approximate force and the brittleness you can calculate the size of the initial cracks and the depth of recursion.

If you're really looking into breaking an object along the cracks, Binary Space Partitioning might be something to look into. otherwise, generating textures is probably your best bet.

EDIT In response to your request for an example:

You can take a line, straight or jagged, and pick several points along its length from which to draw other, smaller lines. off of those you can draw yet smaller lines. look into fractals if you want detailed examples. Are you looking for code?

For procedural destruction, I've always been a fan of Voronoi diagrams.

If all you're interested in is the shape of the crack itself, then you can use a Voronoi diagram, and discard all but the boundaries between two cells. If you wanted some variability between materials, you could adjust the number and placement of seeds.

You could probably use the same method of generating lightning to simulate cracks. Here is an example. You might need to tweak it to look right for a crack though.