[WIP] Random Polygon Generator

EDIT: Latest version: [ATTACH]415376[/ATTACH]

This probably has been done before, but I’m making a ‘generate-randomised-polygon’ addon – so why not share its development here, right? :eyebrowlift:

The idea is to generate a (2D/XY) polygon/face, by ‘randomly walking’ along the vertices/edges of it. So we’d walk for a (randomly generated) length/distance along a (randomly generated/updated) direction from the current vertex to the next. You can specify the number of vertices, a range for the lengths of the edges, and a range for the angles to turn at every vertex. If requested, I’ll happily go into some more detail about how this works and/or why this might be useful.

Here’s the addon: randomPolyAdd.zip (2.21 KB)
Here’s a screenshot:

The output might not be as clean as expected, but it’s nice to play around with. It probably could even be nicer…

I don’t know where can we use it. But if it is done as a random 3d mesh, then we can it as rock

it would be useful if made into tilable rock wall.

This is a way to set it up manually:


On a sunny day, you brought even a bigger smile to my face :smiley: thank you & happy thoughts to you too
a fast way to generate flakes

Update: randomPolyAdd-20151202.zip (3.11 KB)

. Added a random range for the number of vertices
. Added a random rotation to the extruded (or only) face
. Added an option to put the objects on the XY-plane (ie, move them up a bit)
. Cleaned up the interface (I hope)

Thank you for the work done and the addon

Update: randomPolyAdd-20151205.zip (3.65 KB)

Added (optional) control over the dimensions of the resulting meshes. This could be useful when generating some oblong/elongated variations of the bricks. You may want to increase your number of vertices (*) to obtain the desired result.

(*) we might want to look into that (and/or its relation to the vertex angle range), sometime…

Update: randomPolyAdd-20151218.zip (4.3 KB)

Added an option to try (!) and keep the generated polygon convex. ATM, this only looks at the first and last vertices, as that’s where the concavity/non-convexity tends to turn up. I’m not sure this totally guarantees convexity, but it does rule out some obvious cases.

Convexity, btw, is a very important thing to have, especially if you want to physically simulate your results, as mentioned above. If you have convex geometry, you can use the ‘convex hull’ as a collision shape, rather than ‘mesh’ – the latter of which more accurately simulates your (possibly non-convex) objects, but is (much) more costly (will take (a lot) longer). Please let me know if you come across any settings that produce non-convex meshes – with ‘Keep Convex’ turned on, and without negative vertex turning angles, of course…

The ‘Origin -Z’ option sets the z coordinate of the origin of the generated object to the z coordinate of the cursor. This may also be useful for positioning your objects in the scene for further use/simulation. The previous version already might have had this (unexplained) option.

Update: randomPolyAdd-20151220.zip (4.63 KB)

Just for completeness, I added a Z/X redimensioning option. It allows the same ‘X-dimension-drivenness’ on the Z-dimension as the aforementioned Y/X option does for the Y-dimension.