[Bf-committers] Randomness in arrays

Patrice Gmail patrice.bertrand.eu at gmail.com
Thu Feb 6 14:44:09 CET 2014


    As a first contribution, I considered adding randomness to arrays.
    Indeed there are many occasions where arrays of objects are too
    perfectly aligned, and require some manual tweaking to look natural,
    but this implies applying them.

    I found that someone had worked on this back in 2011, Fabio Russo,
    with the project of an "advanced modifier array
    but it didn't go further than a 0.5 beta, and

    In February of 2013, someone mentioned it again
    here, and many seemed to agree that this would be a useful feature.

    Fabio's advanced array modifier covered more than just randomness,
    including star-shaped arrays which I don't particularly like, and it
    seemed it had some issues with the handling of randomness. In
    Blender we need repeatable randomness, in the sense that the same
    file should produce the very same pseudo-random result.

    So I started working into it, and now have a working array modifier
    with (repeatable) randomness into it, which is only like 20 lines of
    code added to the array modifier. One difficulty was that the array
    modifier always takes the last duplicated instance as input to build
    the next instance, so if we let this happen then randomness builds
    up in an increasing way from the first to the last copy. But I found
    a way around this.

    Then I encoutered another issue, that is more serious, and it is the
    reason of this post. The array modifier is one-dimensional, so
    another array modifier, and sometimes a 3rd, are used to build 2 or
    3 dimensionnal arrays. If randomness is a parameter of the first
    array modifier, and the first "line" on objects is indeed nicely
    randomized, the second modifier takes this first line of objects as
    input to build the second line instance. So even though the second
    modifier adds its own randomness, because its input is the first
    line, it will always be that the second line resembles the first in
    its random pattern, i.e. if instance 7 of the fist line happens to
    be translated by 0.13 on the Z axis due to randomnes applied, then
    instance 7 of the second line will also be shifted similarly, even
    though it has added a new random shift.

    I hope this is clear. There is simply no solution to this issue, it
    stems from how modifiers are piped, and so it is impossible to build
    a good random array of more than 1 dimension in this way.

    I would like to propose another approach, maybe more flexible, and I
    would like your advice on this. It would be in the form of a
    "random" or "noise" modifier that can be added to the stack anywhere
    and thus possibly after 3 layers of arrays. After array duplications
    have been done, the "noise modifier" would not be able to identify
    what is the original mesh, and what are the instances of the initial
    object. So it would consider loose parts, as in the "separate by
    loose parts" operator. The noise modifier would take each loose
    part, assume it is the initial mesh, and apply random translations
    and random rotations to it. Of course this does not work when "merge
    option" has been requested, but merging and randomness don't go
    together well for obvious reasons.

    And it could be used independant of the array modifier too, just
    taking loose parts as they are. Plus it could be limited to a group
    of vertices.

    If experienced blender developpers believe this is the right
    approach, I believe I could make such a modifier and I'm ready to
    give it a try.

    Thank you for your feedback.

More information about the Bf-committers mailing list