GENERATING LIST OF RANDOM VALUES
I have this curiosity on how we can "generate list" of values in AN. Some nodes do give you a changing value over time, or generate a single value, but didn't give LIST (!).
The node above will spit out list of data values. Usually indicated by "List" output label, and the actual socket is actually transparent.
Have you ever wondered why Random Vector does not give you that? It could be very useful, right?
Sverchok Random Vector List
Sverchok actually has node that generate Vector values list, all we need to do is to supply the "Count" to generate X total number of Vectors. Noticed the Random here is more like Spherical with hollow inside.Not the case with Animation Nodes (AN)... unfortunately.
Of course we can use Sverchok generated mesh and pipe the vertex positions list, so that a Cube will go into that position.
That should be fine and will work depending on your need.
However, maybe we can try building the setup inside AN node tree? Yes actually you can.
LOOP is the answer.
AN Loop to generate Vector List
You can use the Vector List, to actually generate actual Mesh points.
So far, this is actually my most elegant solution to this problem of generating value list.
AN Script node (?)
With AN Script node, I still have a trial and error result. Below for example, I attempted to create Node on the fly that will generate list of values.
I use below articles as reference:
I did manage to generate list, however, the node keeps looping itself and generating new value every cycle... Unless I use "cache". But I don't think it's very elegant.
I need to consult AN developer to find the answer... :p
UPDATE 20151110 - On Script Node.
Thanks for Jacques help, I figure out the seed thing. Apparently my mistake when using this seed was not to rename the Integer. Always rename your variable to unique name.
Also, there is this Vector object thing you can use to make the data correct.
Script node is a quick way to generate your own node on the fly. I am still only touching the surface here. Don't worry if you do not get this because understanding Script node requires some knowledge of Python. But ask around people who understand it. You can go far with this.
Once the node is built, we can just plug it into LOOP like normally. Below I am using the generated Vector list to position instance of objects.
Generating Random is an interesting topic in itself. What if, for example if we want to "scatter" random points inside a volume? Big question.
Post a Comment