Slowly learning to disturb the Matrix. |
THE ART OF EMPTY-NESS
We will take respect to EMPTY object and will use this Empty with Sverchok to make something.
Today, let's talk about how we can use Empty Object in 3D scene and how we can use it inside Sverchok.
Empty is an object in computer graphics commonly use to refer to something that only have Transformation data. It does not render. It is great as reference for marking a position in 3D space. Useful when rigging and dealing with Constraints because we can see Empty in 3D view as some kind of shape.
Empty object, when brought into Sverchok, does not have Vertex, Edges, Faces data, but it actually has Matrix Transformation data. Which is actually cool.
Using Empty we can kind of have "direct control" of the Matrix in normal 3D environment, while at the same time, we can
This is a little bit similar to what happened if we are using Vertex Parent or Parent to Empty in Blender Edit Mode to control Mesh in Object Mode. But we can do more because we can start with nothing in Sverchok and output something.
We will embrace the art of nothingness or Empty-ness.
Empty => Object In => Matrix Out
Using the above recipe, we could extract Matrix information from an Empty object. This means we can get the Location, Scale, and Rotation data values.NOTE: One thing to be aware of, when dealing with a changing Matrix, we may need to MANUALLY UPDATE the Sverchok node tree to see the result updating.
Either by disconnect and reconnect on of the noodle, or I usually have Blender playback running while moving around the Empty to update the transformation Matrix.
If we have Empty A and Empty B object, we could bring those two couple and marry them as a Line like below. The Edge data is all we need.
Moving Empty A and B in 3D View (Blender) and we have direct control over the ghost Line Start and End, inside Sverchok.
Next, I will duplicate the Node Tree above and I will create Empty C and Empty D objects.
This is just a tiny screen capture, you should be able to guess what I am doing here. Just duplicate the previous node tree and connect Empty C and Empty D as a line. |
- Empty A + B = Blue Line
- Empty C + D = Red Line
Those 2 ghost Lines are inside Sverchok, they are not yet exist in Blender 3D View. You could use BMesh node to output the line if you like.
However, what I want to do is to demo this cool INTERSECT EDGES node.
This INTERSECT EDGES node does exactly what you guess it to do: to return intersection point based on edges that are intersecting.
This node has a bit of quirks:
1.
CORRECTION:
All edges that result from the mass intersection are stored as separate entities. Not removing doubles gives us the option to do other things with those edges. To keep it a general node, it doesn't assume we want any particular type of output -- just performs the operation as efficiently as possible. Effectively letting us choose if we want doubles or not. (thanks Dealga McArdle for this important correction!)
2. It needs data in to be joined using MESH JOIN node.
This is the expectation of the node because there is already another node that does the job. I believe this INTERSECT EDGES is one of very interesting "COMPOUND NODE" put together into a single node because Sverchok cannot do Node Grouping yet, because we are waiting for bigger thing.
If we take care the "quirks", we can get back the intersection points. At this moment, I think the Intersect Edges is returning the "result" of Points + Edge DATA altogether. If we want just the intersecting Points DATA, we need to filter it ourselves.
Ok, let's put INTERSECT business aside for now.
I move the Empty A-B-C-D into position like this. What I will do now is to create some POINTS in between Empty A-B and Empty C-D.
You know how to do this already from previous. I will show you again. Use EVALUATE LINE node. And for the Factor, we can give some values between 0 and 1 and it will further "divide" the points in between. This is great for laying out FENCES or legs for BRIDGES.
Will do the same thing for Empty C and D:
Now, what can we do with them?
LINE CONNECT simple example:
If you want to output a nice clean Polygon, use data from PLANE node. Don't directly use Line Connect "Do Polygons" unless you know what you are doing and can clean it up later.
Of course with data from PLANE, we need to ensure the DATA that goes in is "good" meaning it matches the TOPOLOGY output that you want.
This is a CLEAN result. |
SNIPPET EXAMPLE FROM NIKITRON
In this example Nikitron made, we can see how we could create plane using Line and Clones from Matrix.
Line Connect node got updated and now has "circle first-last" option. I don't know what it does yet, but will certainly need to check that soon.
MORE THAN JUST MESH
Now, what if we don't really want to output just another Mesh Plane because that is kind of boring (although an interesting to study)? We can certainly do that.I want to do more with INTERCONNECTING EDGES. Because this is something that is usually hard to do in Blender without scripting.
We can start doing something funny like below:
More Random Lines Connection
LIST SHUFFLE example:This is also pretty basic, we have the PAIR connecting edges, but simpler and more expandable. If we provide REAL DATA that connects 2 Points in a Map, we can actually get an interesting data visualization.
Let say Facebook Data, we have list of NAMES of FRIENDS. We could laid out the information like above to see which one connect to which.
Maybe Google Map data and to see the Intersection points where the lines would meet.
Big Data Management = start to deal with complexity |
Prettier Lines
Can those lines be PRETTIER? Yes, probably if we "smooth" the lines. Instead of LINEAR like now, we like it to be smooth and SPLINY (like a spline). In such case, we can just OFFSET push the lines from original using Vector Move, then add extra lines before the connecting lines.Bake Out, combine, remove doubles, then Subdivision Modifier. You get a nicer prettier looking spline connectivity.
Prettiful Lines. |
This Line Intersect idea can be used to generate a complex pattern. Read a bit of this thread at GitHub:
https://github.com/nortikin/sverchok/issues/181
SEPARATE LOOSE & BOUNDING BOX
We have 2 new nodes that are very handy when we really need them:SEPARATE LOOSE and BOUNDING BOX.
SEPARATE LOOSE can separate a joined Mesh into separate array of data.
In Blender, we can have an object combined or joined together and often we like to separate them by loose. For every mesh that is loose (no lined points via edges or faces), it will be a separate mesh.
Above, you see many objects joined as single object. When brought into Sverchok, they are combined and seen as a single object with a single Matrix data.
Use SEPARATE LOOSE and you will see the Data got filtered or re-vectorized back each into separate LIST ala Sverchok.
At the moment, I am writing this, the Separate Loose does not have Matrix output. It would be nice to have the Center Matrix from each separate loose so we could disturb and push the Matrix of each object at will (another cool way to say: Transform each object separate).
We can "cheat" and get the center matrix using the BOUNDING BOX node.
Bounding Box node also does not give us the Center Pivot point. We could try to find a way to get the Center position. A quick trick is by selecting the MIN and MAX corner position from Bounding Box and then the point position in between = is our CENTER PIVOT.
The Bounding Box output is interesting, it is definitely 8 points. But the FIRST and LAST are our MIN and MAX points.
It works for 1 object, does it work on VECTORIZED DATA? Or ARRAY? We are lucky, it does work with multiple data coming in.
Knowing all these, we can have more control over the MATRIX position(s) of combined object(s). What does this mean?
We can use our own Matrix and re-position each separate objects at will.
TRICK: You could create Houdini's EXPLODED VIEW node using this idea.
Continue reading below for something more interesting.
ARRAY MODIFIER x SVERCHOK
If you are using ARRAY MODIFIER using normal Blender environment, you can work it together with Sverchok in unusual way, especially knowing that we have ability to control each Matrix for each separate objects (in the past, we can only do this for Polygon Faces component).Few facts allowing us to do something like this:
1. Object In - Post Modifier option
2. Separate Loose node, to re-separate objects into ARRAY when DATA comes in as 1 object.
I thought this is simple, but quite powerful once again. We starting to have more control over the array of data, this time as Objects.
NOTE:
I am still waiting on the update of Bounding Box node or Separate Loose node to include the Matrix out to get the Center Position more easily.
A little bit stuck below where I cannot get each "Separated Mesh" into their Center Pivot.
However, below is an example node tree of how we can "explode the matrix", using Empty. In which the Position of Empty and the Scaling will affect the Matrix position of each object coming in.
Another step to create the "Exploded View" node ala Houdini 3D.
This node setup is not perfect, but also not completely failed because this is working to certain extent, however it can be slow if we have over 50000 points. Slow to bake, I mean. But 100000 points calculation is still pretty fast and will get faster, I am sure.
DISTURBING THE MATRIX
I sense the disturbance in the Matrix, just like what Yoda said:"Great disturbance in the force I feel" - Yoda
Well, not exactly the same, but anyway, below is an example where we can use SEPARATE LOOSE and then feeding in some new array of Matrix data.
TEXT OBJECT x SVERCHOK
From what we know above, even though the node tree is not "perfect" we can do something like below:
I thought that was pretty cool. The Text Object is still alive and we can feed that into Sverchok and disturb the position of each text.
INTERESTING LINKS
http://www.blurrypaths.com/tagged/codinghttp://wiki.scipy.org/Numpy_Example_List#head-528347f2f13004fc0081dce432e81b87b3726a33
http://ftp.mainframe.co.uk/mash/docs/MASH-3.0-Documentation.html
UPDATE:
Linus has added Mean and Center output port for Bounding Box! Thanks Linus! So that means our node tree is simplified and we don't need to find the Center Point manually ourselves.Ok, I realized the node setup below does not give the perfect result, something is not quite right with the Matrix. I will have to investigate and will update again when I found the better solution.
I use Random Vector at the moment, but feel free to use Noise as well.
UPDATE AGAIN:
Apparently we can solve the little "glitch" using Vector Drop.
LINUS:
Separate meshes lives at the location they come from. However we do already have node for that for realign with zero, Vector Drop.
However, Vector Drop seems to have effect on rotation of each object. So the MOST CORRECT SOLUTION and CLEAR is as below, using VECTOR MATH-ADD, we substract the position to zero out each object, before we move them again! Isn't this Vector thing fun?
You see this kind of workflow carries the essence of good programming:
1. It is definitely alright to make errors, knowing we will find a better solution later. Don't leave bugs, but do try things.
2. There are many solutions to one problem.
3. Work iteratively but as a whole. Continuous refinement.
4. Ask and search around for answers. Maybe it is already answered before.
Post a Comment