Halloween Costume ideas 2015

SVERCHOK / In Between Blends

The networking of Blender Heads.

This post will explore a setup that can be used to create something like a Procedural Fence.

I learn this cool Sverchok technique from an example by user "Cfyzzz" at Blender Artist Forum. The Sverchok Thread below:
http://blenderartists.org/forum/showthread.php?272679-Addon-WIP-Sverchok-parametric-tool-for-architects

You can download the ready made Blend from there.

Here I am going to reconstruct and try to make sense of the setup.

SOME MAIN INGREDIENTS

  • Evaluate Line
  • Matrix Apply (Apply Matrix for Vectors)

Normal Transform VS Apply Transform

Before I start, I want to quickly refresh this topic that will be important. I mentioned before that if we modify in Vector level, it will not have Transform Matrix history.

In Sverchok, we can transform an Object using Matrix Deform and Matrix Apply nodes. The different will be clear when we bake the new Mesh.

TRANSFORM ONLY:


BAKED:


TRANSFORM + APPLY TRANSFORM:


BAKED:


You see with Matrix Apply, it is similar to using CTRL+A (Apply Transform) on an object in a normal Object Mode in Blender to freeze and zeroed out the transformation.

TWEENING / INTERPOLATING

Let create the tween setup in Blender + Sverchok. We need 3 objects minimum. 2 objects can be anything (even Empty Locators), I will use 2 Cubes. And last object is the important one that can be the "fence" object, which will tween/ghost between the 2 objects. I use Cone that will be duplicated and tweens between the 2 Cubes.

STEP 001 - Apply Matrix to Vector
In the example setup, at the beginning, we need to use Matrix Apply node to confirm the Vector at its current position. The 2 Cubes object can be anywhere in 3D space, we want to convert that into Vector information that we can track inside Sverchok.


STEP 002 - Measure Distance Between
There seems to be two ways to do that in Sverchok.


Either one is okey, pretty much the same thing. I think the later method is easier because it contained into the node and probably faster. However, later on we will also need to use the calculation for rotation. So the above method is probably better.

STEP 003 - The Formula
Next, we will use this Formula that will define the number of vertices to divide a Line. Imagine a Line to connect between the 2 Objects (Cubes).

max(x/n[0]-1,2)

The max() function there is just to ensure we never get "division by zero". If the number is actually zero, it will return 2 instead because of the max() function that will compare 2 numbers and always return highest.

LENGTH divided by the Float Value that will be our STEP value (in between steps). This number will be important to give different "tweening result".


UPDATE 20140115: ALTERNATIVE TO LINE + FORMULA 

Just use List Range, adjust STOP and DIVISIONS.


STEP 004 - Rotation Tween
Continued on, we will add this setup that will rotate the tweens object correctly.


STEP 005
This part is difficult for me to understand, but I think that is moving the line, rotate and aim the line to always pointing at the object and  bring all the data together.

Kind of like Point Constraint the Line to position of Object B, and then always aim at Object A. Something in that line.


STEP 006 - Instance the tween
Finally, bring in the tween object. Which will get duplicated in between the 2 Cubes Objects.



You should get the result like below:

You may notice the tween might be a little imbalance or not perfectly centered in either 2 Objects, that can be manually adjusted here: (STEP). Usually this number is around our (STEP value + 1).

Maybe, I need to Normalize the Vector. Just a guess.




THE BIG MAP:

You can duplicate the setup and bring in another object to create something like below.



I have to double check with  "Cfyzzz" on why the "tweens" is not quite perfect. In the mean time, that is pretty much the result for our procedural fence.


UPDATE 20140120: Thanks to LINUSY at Blender Artist Forum

http://blenderartists.org/forum/showthread.php?272679-Addon-WIP-Sverchok-parametric-tool-for-architects/page21

There is a node in Sverchok called Evaluate Line which can be used to INTERPOLATE Points Data in between 2 Vertices (or Vector DATA) that we specified. This is really handy for what we are trying to do because it simplified the network from before.

In fact, below setup is probably better in term of efficiency and result since we do not have over shoot of interpolation thing happening. However, maybe in future project, you need to use either methods. So it is always good to know many different ways to achieve the same thing.



And if you want to instance Objects, you can certainly do that.


Interestingly, it also has taken consideration of the FIRST and LAST of the original data. See if you know how to get rid of those extra bits.

Next, surely, you still need to take care the VECTOR of the instance objects created (how would you like it to be oriented, if those instances are FENCE, for example, what is the UP vector or how you like to AIM the object).

That information is already answered at Blender Artist Forum, there is an example Fence. I promise will add that information with some additional explanations.

NOTE:
I know it is still imperfect, such as the orientation of the instance Fence object. If you know how to fix it, please do let me know. Thank you!

Using Sverchok, we can finally Jazz in Blender.

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget