nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.23k stars 232 forks source link

Distance Cross Over #1083

Closed enzyme69 closed 7 years ago

enzyme69 commented 7 years ago

I feel the itch to explain this Distance node "Cross Over" at some point @nortikin is showing a way to use this as Influence. I still don't quite get it.

screen shot 2017-01-03 at 19 39 16

enzyme69 commented 7 years ago

So if we have 2 points and bunch of points, what can distance do? How to mix the value from both to have more useful effect?

Rhino Grasshopper artist always loves to use this "influence" by distance. I like it too, but I rather use Dynamic Paint.

enzyme69 commented 7 years ago

I am especially feel challenged to do what Commotion AddOn can do. https://github.com/mrachinskiy/commotion https://www.youtube.com/watch?v=gLj4PvHbm4s&feature=youtu.be

I think AN is trying to get to that point.

Wonder SV Object ID and Action can do offset, I think it's not that simple. Not so familiar with Blender Action BPY that can offset slide animation fcurve...

....

studying.

enzyme69 commented 7 years ago

Maybe can do something with these attributes: action.fcurves[0].keyframe_points[0].co

Old blog post, I did try to use BPY. http://blendersushi.blogspot.com.au/2013/06/procedural-domino-array-animation-using.html?view=classic

enzyme69 commented 7 years ago

screen shot 2017-01-03 at 22 00 30

This actually does something to the keyframe points....

enzyme69 commented 7 years ago

screen shot 2017-01-03 at 22 16 16

Hmm... offsetting f-curve animation means dealing with many numbers apparently. Above should work, but probably not quite right.

I am pretty happy if we can control blocks of animation in and out. like sequence.

enzyme69 commented 7 years ago

screen shot 2017-01-03 at 22 21 25

NLA seems simpler to work with, but no access to this yet via Sverchok.

ly29 commented 7 years ago

Using a distance to influence design is like getting a simple factor. It is more productive to think like functions.

Say height = dist(p0, loc), so if you have two points, you need a function that maps this in a sane way.

Could be height = min(dist(p0, loc), dist(p1, loc)) for example, letting the minimum influence it. You could even weigh the influence of the points this way.

Anything you can think in functional form should work well with sverchok.

For animation a certain other system has more helpful functions,.. I don't have clue about animation so I havn't tried to implent such functionality. I am not against it however

zeffii commented 7 years ago

@enzyme69 you want to turn Sverchok into an animation goldmine, but you have to realize that we've stayed mostly focused on geometry/topology. (almost like a mission statement).

There's an old saying

if all you have is a hammer, everything looks like a nail.

Sverchok isn't intended / equipped to do everything with the least amount of effort, this means there will be some horribly convoluted setups for things that seem trivial. But this will be because there aren't dedicated Sverchok nodes for a feature, or you haven't taken the time to try to make a node-script and get your head around the bpy involved. yet.

enzyme69 commented 7 years ago

Ok back to topic. Thanks @ly29 I'll try a simple setup first with this Distance. "Cross Over", Niki said was wrongly named. I don't get it.

I will try with 2 points.

With animation stuff... I realized something:

enzyme69 commented 7 years ago

@zeffii Yes, you are right. I go back to Distance stuff.

zeffii commented 7 years ago

I take no pleasure in repeatedly saying Sverchok isn't for all needs. believe me :)

zeffii commented 7 years ago

but just to stand with what @ly29 said, i also have no objections to add more animation stuff. but with the caveat that i also don't do animation, so not only do i not need these features, I think it's better implemented by someone who does know that side of bpy and all its pitfalls/shortcomings/pros/cons/conveniences..

ly29 commented 7 years ago

Cross over gives the distance between all points,

[v0, v1, v2]
[u0, u1]
# crossover
v0u0, v0u1, v1u0, ...

@zeffii Totally agree

enzyme69 commented 7 years ago

screen shot 2017-01-03 at 22 40 00

Ok this part I understand now that I use brain.

enzyme69 commented 7 years ago

https://gist.github.com/d922601979018837629cd7b5685e436d

enzyme69 commented 7 years ago

Trying to mix 2 or more points....

enzyme69 commented 7 years ago

I think Distance is not what I think it is.

screen shot 2017-01-03 at 22 50 43

https://gist.github.com/a7b8897166babfb32e845b4f54636071

ly29 commented 7 years ago

It would be more clear to reformulate the problem with list cross match and distance using the vector math node and staying away from the distance node.

zeffii commented 7 years ago

what you're looking for sounds like an attractor / proportional editing kind of interaction between 1 or more points and a mesh. If so I do plan to implement something like that https://github.com/nortikin/sverchok/issues/914#issue-182487380 but no eta.

ly29 commented 7 years ago

This is what crossover does if you want to dig into it...

    def calcM(self, list1, list2):
        ll1, ll2 = len(list1[0]), len(list2[0])
        if ll1 > ll2:
            short = list2
            long = list1
        else:
            short = list1
            long = list2
        dists = []

        for obsh in short:
            obshdis = []
            for vers in obsh:
                for obln in long:
                    oblndis = []
                    for verl in obln:
                        oblndis.append(self.distance(vers, verl))
                    obshdis.append(oblndis)
            dists.append(obshdis)

        return dists[0]

So for each point in the shorter list you compare to each point in the longer list. Then you return the first result.

enzyme69 commented 7 years ago

Looks simple and elegant.

enzyme69 commented 7 years ago

I will make few Live Noding Videos using Distance, but I think Ly makes a good point: It would be more clear to reformulate the problem with list cross match and distance using the vector math node and staying away from the distance node.

And Zeffii, you read my mind clearly.

I guess I can play a bit with this.

nortikin commented 7 years ago

who dealing now with "everything in nodes" stuff of blender?

enzyme69 commented 7 years ago

Maybe only Lukas Tonne? He and his "Particle Nodes".

nortikin commented 7 years ago

lukas went out of BI as i know

ly29 commented 7 years ago

Everything nodes is not an immediate goal any more, but they try to lay the foundation for it.