I quite like the word "deconstruct", here is the same word in Russian according to Google Translate:
деконструировать
That will be our keyword of the day. I want to take you to look at one Sverchok example, breaking it down and putting it back together.
TODAY'S MAIN INGREDIENT
- Matrix In
- Matrix Deform
- Cross Section
- Line Connect
LEVELING UP
That is the only way one can actually LEARN and MAKE and DESIGN the Sverchok way (parametric or procedural way)In term of learning Computer Science stuffs, like text-based programming, or node-based which is basically visual way of programming, we need to learn from examples. And with the examples, we will encounter range of examples from Basic Level examples to Super Advanced complicated and complex examples.
It is very tempting to want to go directly to complex advance examples right away, but it is a good idea to understand the fundamental and re-create the simple Basic Level examples, before going to the next level. If you are stuck on something complex, try breaking it down and go back to easier level.
What often frustrates learning experience is that there is a HUGE gap between Beginner Level to Advanced Level. This is very common in many fields.
You want to know my Level today? I am actually still just a Beginner, slowly going to Intermediate Level. I like the Beginner Level, because we have more freedom. Recreating Basic Level Artwork is usually faster and we can be creative and think of many solutions.
Advanced Level will take longer time and we need more planning and you want to get it right and efficient. Don't worry you will get there eventually if you diligently follow your own Sverchok path. Some of you are probably faster to grasp the concept, some a bit slower, but we will get there.
The SVERCHOK Parabola Example
There are some Blends file kindly provided by Nikita on his website:http://nikitron.cc.ua/blend_scripts.html
Some examples there are pretty complex, but very nicely organized.
Check the one that says: Parabola. Download, unzip and check the Blend.
Parabola Example |
When you open it up in Blender, you probably will see nothing.
Click on Sverchok big UPDATE button to refresh the node-tree. With Viewer Draw node at the end of node-tree, we can see an Output.
I think there are around 8 mesh there. Click on "Bake" button on Viewer Draw to see the resulting mesh.
Yes, I was correct, there are exactly 8 polygon mesh object in a shape of Parabola. Each polygon mesh is made of 81 vertices, there is only a single Face poly for each object.
The reason Sverchok preview a bright yellow is because by default, when giving preview of Polygon, Sverchok will displayYellow color for smallest Face Indices and Blue color for largest Face Indices. Well, there is really only 1 face per object created (with total of 8 objects), so it just colored it Yellow. Probably would be better if the color is not fully flat opaque, but more like transparent.
Anyway, to be more clear, we can unplug the Face data from ViewerDraw.edg_pol input socket and seeing the actual Parabola Vertices Data that makes the parabolic Curve.
You can unplug just by selecting end of noodle and drag it out. Or you can use Ctrl+LMB click drag to cut slice the noodle that you want to disconnect.
So, now we only have Vertices data and Matrix data goes into Viewer Draw and we can definitely see the parabolic shape more clearly.
Next, you can actually adjust the parameter of the nodes. I suggest by trying and change that parameter that made up the Matrix, see how the Parabola changes.
You see the List Series that is creating the Matrix is rotating in Z axis, based from that START, STOP, STEP information, we can see it is really "duplicating" the object 8 times. Because if the range start from 0 and stop at 120, with each step the value of 15, then we get 120 / 15 = 8 Matrices.
Each Matrix duplication is rotated in 0, 15, 30, 45, 60, 75, 90, 105 angle. Total of 8 duplicates, each rotated in 15 degree.
Apparently that is how you can create Duplication by supplying the Matrix. This is really quite neat.
You can have more or less of that Parabolic mesh just by adjusting the step. Be careful and watch the number though, you do not want to get too much "duplications" and you don't want to end up division by zero, it may crash Blender.
If, we modify how the data goes into MatrixIn node, let's try that Location input for example, I can end up with a different arrangement altogether:
Above, you see how it got translated 8 times in Z axis, each one of them, I bet each was translated around 15 units in Z axis, because of how the List Series node is giving the DATA input.
Let's try reroute the DATA into Location and Scale of the MatrixIn node. I use 2 different VectorsIn nodes, one for Scale and the other for Location.
I use a Formula2 node to "Normalize" the input from ListSeries.
If you want to put that Parabola on the Grid Floor, we can use MatrixDeform to deform each individual Matrix and offset the Z position up.
Baking out the result. |
This function f(x) = -x * x is responsible in creating that nice Parabolic Curve! This part should be quite clear, if not clear, you can read further, I will try to make a similar example below.
Nikita also once recorded this video giving intro on Sverchok LIVE on Google+, now available on YouTube:
http://www.youtube.com/watch?v=hLQAYTKK250
There are more useful information there presented. I watched the video few times and took some notes.
PARAMETRIC SINE WAVE POINTS
In previous post, I show you how you can take advantage of Line node to draw Sine Wave that goes forever. That is one way to do it. Line node is there for convenient.But you can also make your own by supplying Points Data using List Series and provide the Range of Numbers you want the total points to be.
Start from blank Node-Tree canvas in Node Editor. Enable the "F" to save the Note-Tree. Shift+A and create List Series node. We need Vectors data XYZ position, so we need Vectors In node before we can see anything when we use Viewer Draw.
ListSeries.output => VectorsIn.x => ViewerDraw.vertices
We can adjust the parameter START and STOP so that the Points created is more centered in grid.
You noticed the START is -10 and STOP is 11. Why don't we specify STOP value at 10? Because that is how the node function work, the series of number will stop before the last STOP. So in order to have a correct "centered" points, I specify STOP as 11, so that the actual last point on the right is placed at exactly 10 unit on the positive X axis
This is all easy. What next? We can do anything to the point. Just like if we draw a Graph, if we start modifying the other positional axis, we get points placed differently.
How about for those Series of numbers range, we use sin() function? Yes, why not, apply that to the Z axis.
That is nice isn't it? Modifying the step will give us more points within that range and we get something like below. Be careful not and never use 0 for the STEP, because that will tell Sverchok to do DIVISIONS BY ZERO and it will crash Blender.
TIPS: Hit UPDATE if you are not getting expected result.
Now, those are just Points in 3D space.
There is a handy Sverchok node to connect Points called Line Connect node. It is buggy at time and may crash Blender (when Bake button is pressed), but for simple stuff like this, it will work. That Line Connect will connect the dots basically.
PARAMETRIC CIRCLE
I attempted to re-create Points of Circle using formula above. There is Math PI is used there. Using the PI we can specifically tell Sverchok how many divisions of points we want, to create a Circle.
The trickiest part is probably just to translate Math Formula into Sverchok node-tree, however, other than that, it is still a rather simple network.
When provided snapshot of node tree like above, you can easily re-create that yourself.
NOTES: Sometimes you need to use Formula node, some other times you need to use Formula2 node. Which one to use? For simple single value input, just use Formula node. If you have array or series of values to calculate using Math formula/function, then use Formula2.
Next, how about we use the knowledge we have learn from Parabola example?
Let's create Polygon/Face for our Circle. All we need is List Join node to turn Series of numbers into DATA STRUCTURE that is needed to create a polygon Face.
TIPS: Below I started to use Blender Node-Tree FRAME to organize my node network. This is very handy to kind of group your network (but different from actual GROUP-ing of nodes!). To frame some nodes, all you need to do is select bunch of nodes one by one by Shift+LMB clicking on nodes, or you draw box around node by pressing B and dragging on nodes you want to frame, and then finally hit CTRL+J to create Frame. You can Color and give Label to the frame to make it clear.
From the Node Editor Menu, you got select Node -Join In New Frame.
We can then use the Matrix setup thing to duplicate the Circles.
All very straight forward stuff but crucial concept for us to understand.
EXAMPLE: MESH CUTTER USING MATRIX
As a bonus, I might as well add this snippet of gem from Blender Artist Forum Sverchok thread. Because it is kind of related.There is this awesome node in Svercok called Cross Section. This node is useful in creating "slices". But for that, we will need to provide Matrix information and what object to slice, etc.
For example, here, I am slicing Cone with a Plane. The result is that nice Cross Section Ring line. When we want to slice, always just think of Plane for visualization.
Someone at the forum pointing out that we can have multiple Planes into Objects In input node and use it as slicers. This is handy too.
Nikita's example on this is using Matrix duplication setup for slicing. Which is more parametrically correct.
TIPS: It is a good idea to use multiple Vector Draw nodes sometimes to be able to visualize what each Sverchok steps is doing.
With this setup, we can get some nice Cross Section mesh surfaces that is normally tricky to get in Blender. Of course here we are no really slicing the original Cone object.
If you are architect like Zaha Hadid, being able to quickly get cross sections is kind of nice.
http://www.designboom.com/architecture/wangjing-soho-in-beijing-by-zaha-hadid-nears-completion-01-08-2014
For actual slicing, Blender many ways to do slicings. It is quite fast too. Boolean can be used to do slicing.
Anyways, that is pretty much what I like to talk about today. It is only today using Sverchok and Blender that I can see more clearly how Matrix can be used this way.
2D MATRIX GRID
What if we need to duplicate using X Y like Grid? Lucky we have Circle and Plane generator:
3D MATRIX GRID
I am still not 100% sure if this is the correct or more efficient way, I am still trying to confirm this at the Sverchok forum thread. However, this seems to work alright. Maybe there is a more efficient way?I am using List Join => List Levels => List Join below and it might be a little strange, but that is to ensure the DATA STRUCTURE is correct.
It is something to do with LIST and NESTED LIST and sometimes data ends up NESTED LIST where we really want a FLAT LIST. In Python terminology, there is probably function to flatten() list. Anyway, for us, just be aware and try List Levels.
BEFORE LIST JOIN, AFTER MATRIX DUPLICATE ALONG Z:
vertices:(4) object(s)
=0= (5)
(0.0, 0.0, 0.0)
(1.0, 0.0, 0.0)
(2.0, 0.0, 0.0)
(3.0, 0.0, 0.0)
(4.0, 0.0, 0.0)
=1= (5)
(0.0, 0.0, 1.0)
(1.0, 0.0, 1.0)
(2.0, 0.0, 1.0)
(3.0, 0.0, 1.0)
(4.0, 0.0, 1.0)
=2= (5)
(0.0, 0.0, 2.0)
(1.0, 0.0, 2.0)
(2.0, 0.0, 2.0)
(3.0, 0.0, 2.0)
(4.0, 0.0, 2.0)
=3= (5)
(0.0, 0.0, 3.0)
(1.0, 0.0, 3.0)
(2.0, 0.0, 3.0)
(3.0, 0.0, 3.0)
(4.0, 0.0, 3.0)
AFTER LIST JOIN:
vertices:(1) object(s)
=0= (1)
=0= (20)
[0.0, 0.0, 0.0]
[1.0, 0.0, 0.0]
[2.0, 0.0, 0.0]
[3.0, 0.0, 0.0]
[4.0, 0.0, 0.0]
[0.0, 0.0, 1.0]
[1.0, 0.0, 1.0]
[2.0, 0.0, 1.0]
[3.0, 0.0, 1.0]
[4.0, 0.0, 1.0]
[0.0, 0.0, 2.0]
[1.0, 0.0, 2.0]
[2.0, 0.0, 2.0]
[3.0, 0.0, 2.0]
[4.0, 0.0, 2.0]
[0.0, 0.0, 3.0]
[1.0, 0.0, 3.0]
[2.0, 0.0, 3.0]
[3.0, 0.0, 3.0]
[4.0, 0.0, 3.0]
AFTER LIST JOIN => LIST LEVELS => LIST JOIN again, finally we have normal DATA for Vertices that can be output.
vertices:
(1) object(s)
=0= (20)
[0.0, 0.0, 0.0]
[1.0, 0.0, 0.0]
[2.0, 0.0, 0.0]
[3.0, 0.0, 0.0]
[4.0, 0.0, 0.0]
[0.0, 0.0, 1.0]
[1.0, 0.0, 1.0]
[2.0, 0.0, 1.0]
[3.0, 0.0, 1.0]
[4.0, 0.0, 1.0]
[0.0, 0.0, 2.0]
[1.0, 0.0, 2.0]
[2.0, 0.0, 2.0]
[3.0, 0.0, 2.0]
[4.0, 0.0, 2.0]
[0.0, 0.0, 3.0]
[1.0, 0.0, 3.0]
[2.0, 0.0, 3.0]
[3.0, 0.0, 3.0]
[4.0, 0.0, 3.0]
UPDATE 20140112
You can also do this:Having Vertices positions DATA is not enough if we actually wanted to DUPLICATE an object We need to piggy chain and Apply Matrix until we can finally use Matrix In and output the resulting Mesh Duplication.
By doing this, we really have created a true parametric Object Instancing setup, kind of similar if we were to do this using Particles Instancing in the past. Or maybe a simple version of Array Modifier.
We could actually control the Scale, Rotation, of each instances and perhaps also randomize the Position of each duplicates slightly.
Let's save that for another time, you can probably do that yourself. It is probably something to do with modifying the Matrix.
NEXT IN MIND:
- Procedural Leaves, Flower, Feather
- Procedural Fence
- Maybe back to Spider Web WIP
LINKS
http://rudycortes.com/2011/09/take-the-red-pill/http://www.designcoding.net/
I think I started to be able see the Matrix, although still vague and blurry. Do you?
Post a Comment