That is one strange looking flower. I bet it smells...! |
By now, we should start to get a hang of using LIST (generating sequence of numbers) in Sverchok and know how we can really use LIST of NUMBERS as DATA for Vertices (positions), Edges (which really list of integer pair of Vertices Indices to connect edges between vertices), which would result in a usable and bake-able Mesh (made of vertices and edges).
In this post, I want to go to the next example and again reverse engineer, de-construct and re-construct of FLOWER Blend example.
Download from here:
http://nikitron.cc.ua/blend_scripts.html
The file "Svercho_basics.blend" example is good prequisite before you go through. I don't need to go through that one file.
Remember you need to:
- Download latest Sverchok
- Download the updated examples
- Sometimes you may need to have latest Blender (official)
The given Sverchok examples are varies. Some are actually pretty advanced and complex, but "don't be afraid of complexity", quoted from Nikita.
Luckily, with this Flower example, is not difficult, all quite logical, very straight forward.
In fact, I think this Flower example is a very good example to show how we can prepare VERTICES DATA + POLYGON / FACES DATA to create a complete polygon mesh with Faces (instead of just Vertices and Edges).
Flower node-tree is clearly divided into 3 parts: Vertices DATA, Polygon DATA, and Matrix DATA.
INGREDIENTS
- List Series
- List Shift
- List Reverse
- List Zip
- List Join (joining 4 pair of numbers)
- Matrix In
- Matrix Deform
TIPS: OPEN TWO BLENDERS
Maybe you know this already, maybe not. But I believe when learning about procedural construct, especially when you are provided with actual examples, it is a very good idea to have 2 Blender programs running side by side. Place the example node-tree on the LEFT and your own clean blank node-tree on the RIGHT. Then slowly start building the whole node-tree just by COPYING from examples. Not copy paste, but create the required node and connect the node to required ports until you complete the whole node-tree.(Similarly you can do this when learning Python) => see LEARN PYTHON THE HARD WAY.
However, while we are building the construct, we take notes and try to slowly understand what is happening. Use Viewer Draw and Viewer Text node and check:
- what DATA is created?
- what DATA is required?
- what goes INPUT and what come OUTPUT?
- how the DATA changes when passed into one node?
- what FORMULA is used?
- which PARAMETER control what?
You can be able to recreate the whole node-tree without looking at the example anymore. ONLY IF you really understand it. You can make simple notes along the way, not about which node connected to what node, but the real important essence of the construct, the recipe.
BREAK DOWN THE FLOWER (DECONSTRUCT)
With this FLOWER example, we can break down the whole node tree like this:1. Create the Flower Petal
The Petal, can be created manually by hand, but the advantage of procedural is that we can quickly randomize it, when needed. What makes the petal? Well, it is quite simple really. We already know how we can create Points in 3D space and placing the points in Parabola or any shape.
For flower, it is exacly the same, simply by using List Series node. We can make it wavy by using sine function. And that is really what required for this. We need to create 2 series of points, left side and right side, which then later connected and turned into Polygon Faces.
Up to you how much details you want for the flowers, you can have more or less points, as long both list have a matching number to pair.
When I look at the FLOWER example, I started by breaking the node like this:
You see the INPUT ports required for this FLOWER is Vertices, Polygon (edg_pol) and Matrix. I cut the INPUT DATA connection for Polygon and Matrix and studying just the Vertices output. It is very clear that it is rather simple. Having 2 lines, which made of series of Vector positions. What important is how they to joined together into useful list.
Join Level Lists is 2 and Mix is checked. When you are recreating your own flower, and combining 2 series of lines, you will need this.
2. Turning Vertices into Faces.
Here, let's look at the DATA using Viewer Text:
polygons:
(1) object(s)
=0= (49)
[2, 0, 1, 3]
[4, 2, 3, 5]
[6, 4, 5, 7]
[8, 6, 7, 9]
[10, 8, 9, 11]
[12, 10, 11, 13]
[14, 12, 13, 15]
[16, 14, 15, 17]
[18, 16, 17, 19]
[20, 18, 19, 21]
[22, 20, 21, 23]
[24, 22, 23, 25]
[26, 24, 25, 27]
[28, 26, 27, 29]
[30, 28, 29, 31]
[32, 30, 31, 33]
[34, 32, 33, 35]
[36, 34, 35, 37]
[38, 36, 37, 39]
[40, 38, 39, 41]
[42, 40, 41, 43]
[44, 42, 43, 45]
[46, 44, 45, 47]
[48, 46, 47, 49]
[50, 48, 49, 51]
[52, 50, 51, 53]
[54, 52, 53, 55]
[56, 54, 55, 57]
[58, 56, 57, 59]
... and so on
Can you see the number pattern in this list? Try looking at the COLUMN of this 4 pairs of numbers per line. See how we have series of numbers:
- COLUMN 1: 2,4,6,8,10, 12, ....
- COLUMN 2: 0, 2, 4, 6, 8, 10, 12, ...
- COLUMN 3: 1, 3, 5, 7, 9, 11, 13, 15, 17, ...
- COLUMN 4: 3, 5, 7, 9, 11, 13, 15, ....
Then I am looking at the node-network and make notes:
- The number MUST BE an Integer (Float must be converted to Integer)
- These are really some series of numbers
- What interesting is the use of List Shift and List Zip to create 4 pair numbers.
It is rather simple after all.
3. Duplicating the Flower Petal using Matrixes.
The Flower example generates 8 petals, this is possible by duplicating the petal 8 times, and rotating along Z axis [0,0,1].
You can then adjust the setup if you want to have more petals.
MORE GEMS INSIDE FLOWER EXAMPLE:
Looks like Nikita provided extra examples: the BULB Straight and Screw. Make sure you check them out as well.STRAIGHT
SCREW
Despite the complex looking node-tree, they are similar to flower actually.
RECREATING THE FLOWER (RECONSTRUCT)
REMEMBER: You want to activate "F" button in Node-Tree (Fake User) to ensure you save your Node-Tree and network. Otherwise when you reopen the file, you might see nothing.Ok, once you activate the "F", you are save to create your Flower Node-Tree.
PART ONE: Points for Petal
The parametric Flower example is not one way we can create Petal of Flower, but it is one solution. There are after all many kinds of Petal and Leaf.
Sometimes, it is probably a lot easier just to draw the Petal or Leaf by hand, then just simple "randomize" the edge of flower or petal. Not everything need to be 100% procedural. Keep this in mind.
If you are to create your own specific flower, start from reference.
In Flower example, the Petal base is at (0,0,0) and the end is pointing down the X axis. We will do that too, this is usually a good thing to do when we are creating Instance.
What values really changes? Let's check it out:
We can say that the FORMULA that creates the wave variation is applied to Y axis and Z axis. While the X is really just a number going from 0 to the maximum value.
I will start by just drawing one side of the Petal.
List Series => Vectors In (X) => Viewer Draw
Next, we want to have the nice curve. We can use sine function, sin(). Just by trial and error, try how you can control the frequency, amplitude, and offset it if you need.
sin( (OFFSET + x ) * FREQ ) * AMPLITUDE
Keep adjusting the number until you are happy.
I am happy with this:
Then, we will just "mirror" the function for the other side of the leaf, by using MINUS at the front, which effectively inversing the numbers.
To combine the two, you simply use List Join, with Mix activated and List Joni Level set to 2. Don't forget to do this otherwise later on when you do the Bake, Blender may crash.
I will ignore the Z variation and continue with the POLYGON FACE creations. We can always come back and add more details. This will be a simplified re-creation of FLOWER example. What more important is you understand the concept.
PART TWO: Face for Petal
In the note above, I have mentioned that the polygon faces can be made just by giving list of Integer pair of four numbers (representing the Vertices Index Number/Indices), all in a repeating sequence, anti-clockwise direction, and we are creating QUAD (4 sided) polygon in this case.
How many 4-PAIR list do we need for the polygon? Well, in my case, I have a total of 40 vertices, which means, I will need 19 LIST in total for the Polygon DATA.
Anyway, don't worry too much about that, let's just create 4 series of DATA required and join them.
"DATA COLUMN 2"
"DATA COLUMN 3"
"DATA COLUMN 1"
Shift the DATA from COLUMN 2 by integer 1. Remember it needs to be Integer (full number) and not floating values. In List Shift, turn off the "enclose".
"DATA COLUMN 4"
Similar to "DATA COLUMN 1", shift the DATA from COLUMN 3 by integer 1. In List Shift, turn off the "enclose".
Now that we have PAIR-OF-FOUR, we are ready to join these guys into one good list using LIST ZIP.
You can now join the DATA for Polygon Face and DATA for Vertices."
Oops... missing 1 face! |
If we don't have enough Polygon, like missing a list, simply modify the number while watching the DATA using Viewer Text.
Corrections:
Now, you can continue refining the node-tree so that it become more efficient. It is totally up to you. Basically, it is best to keep the node less and not repeatable. However, if read-ability is important, you can leave it like that.
If you really want to have control over the DETAILS of the petal and having everything procedurally updated nicely, feel free to do so and play with the NUMBER and VARIABLE.
PART THREE: Petal Duplication
We are nearly there.
All we need to do now is to do some DUPLICATION using the Matrixes.
LIST SERIES => VECTORS IN => MATRIX IN
Usually, the way I construct this is by creating (List) Series node and Matrix In node. From Matrix In, I got reminded that I need a LIST of LOCATIONS as VECTOR, so I use Vectors In node.
Now, we just need to ROTATE the Petal to make 360 degree.
For ROTATION, we need actual ROTATION AXIS and ANGLE (in degree).
ROTATION AXIS is either:
Around X axis = [1,0,0]
Around Y axis = [0,1,0]
Around Z axis = [0,0,1]
(of course we can also do values that use more than single axis!)
ANGLE = up to you, 360 is full rotation.
I make my setup like below so that I know which part of parameter I can change to get the result I want.
I can make something like below if I want to:
Play with the Scale as well if you like.
LIST DEFORM is probably not compulsory, but you can use it to deform the previous matrix.
So, that's pretty much how our Flower get re-constructed. Thank you for the Sverchok "Flower" example, Nikita and Sverchok team!
Do you like FLAT FLOWER? No? Fix it! |
To write "FLOWER" in Russia is apparently like this, how to pronounce it? Well, maybe ask Russian friend.
цветок
NEXT CHALLENGE: Nautilus Shell!!!
Golden Ratio and Fibonacci Sequence, this classic example makes you appreciate Math and Nature. And how complexity comes from simplicity.
Golden Ratio Formula?
1 - (x + pow(x,2))
Then, I cheated using Solidify (sorry!):
UPDATE 20140424:
On the Sverchok Thread, with the Sverchok latest update. Zefffi created a true Fibonacci sequence generator using his Script Node for Sverchok.http://blenderartists.org/forum/showthread.php?272679-Addon-WIP-Sverchok-parametric-nodes-for-architects
Looking at his scripted example, I was reminded that there are many ways to get to certain FORM. Whether it is via CODE (can be faster) or via NODE TREE. The Sverchok Script Node is really powerful and it can generates NUMBER SEQUENCE magically using Python.
RAFFLESIA FLOWER
... and many other flowers, admire them. Nothing beat properly looking at real world references and trying to see the Matrix and the Math behind it.
Even if you don't have Blender + Sverchok in front of you, try thinking about it every day. Take picture, write notes and draw sketches.
This smelly giant flower is also an inspiration for one Pokemon character. |
NEXT: Insects and sea creatures?
LINKS
http://plus.maths.org/content/os/issue3/fibonacci/indexhttp://cgfromspace.blogspot.com.au/2013/12/non-periodic-tiling-in-blender-chapter-2.html
Post a Comment