Page 1 of 1

curve force

Posted: 04 Nov 2016, 22:23
by sant0s
hey SI'lers,

actually, I guess thats a really simple question - but somewhere I have a logical prob.

Long time ago, I followed this tutorial here: https://vimeo.com/1313863

The points are driven by the curve and as closer to the curve, as more speed.

Used that technique alot for different things.

Today I was trying to modify it with 2 more curves that will controll the distance and flow speed from the main curve.

I'll attache an image to explain what I mean.

I was trying to get the distance bewtween the middle curve and the two outer curves, rescale that and use that as a new force to drive the points.

But its totally messing up the force.

My goal is, that as closer the points get to the outer points, as slower the move.

Thy alot!

Re: curve force

Posted: 05 Nov 2016, 03:12
by Mathaeus
So how you connected these additional curves. Usually there's 'get closest location' node inside compound. If all three curves are connected at once, using 'group' node or something, it just takes the closest one, and that could be different curve, during time.
If there's a sort of modulation along distance/fallof to curve in compound, maybe it is easiest and safest way to have a three compounds, plugged one after another. First one to get a force from central curve. Second and third for modulator curves, having a slightly smaller, negative influence (just multiply the output of compound by -1).

Re: curve force

Posted: 05 Nov 2016, 14:27
by sant0s
hey :)

yea, actually I used the "get closest location" to have the simple flow.
than I thought, I can get the distance between the middle curve and the outer curves and feed that.
I tried to get the distance between the curves with the "get closest location", plug that into a rescale and use that to get a result.
The way I try to get the distance between the curves and use that as the fallof is wrong, I know - I just dont get it :D
the first picture shows, whats wrong.

Re: curve force

Posted: 05 Nov 2016, 15:51
by rray
just an idea for a different approach, don't know whether feasible or not
look up closest location on central curve, then get U attribute at that location
use same U's on other curve to get corresponding points
do interpolation based on angles and distance
-rr

Re: curve force

Posted: 06 Nov 2016, 02:52
by sant0s
hey ray,
I dont understand your idea. :)
just testing around with U's and so on, but dont know how to use it.

for now I just have a cheap solution... cached the particle flow and used a lattice to deform it.
not the perfect way but working.

Re: curve force

Posted: 07 Nov 2016, 16:27
by Tekano
I think the simplest solution for this is to affect each particles drag force by proximity to the two outer curves. eg closer to outer curve = more drag.

for you to calculate the distance between curves you would either need an ice tree on each curve calculating the relative distances beforehand to feed to your particles or, as rray mentions some kind of point U reinterpretation.

btw did you see this tutorial for multiple curve forces by pooby?

https://vimeo.com/36709750

Re: curve force

Posted: 07 Nov 2016, 17:07
by Pooby
Yes If you have some kind of vector field that 'holds' the force, you can apply as many curves to the field as you want, and smooth the vector flow out across the field as you need.

the 'field' could be a mesh, or a 3D grid of particles if you don't want it just working across a surface.

Doing it by curves alone might seem easier, but its harder to work out the interpolation across spaces between the curves, as you'd need to assess every curve in the vicinity, and work out the influence with a home made interpolation algorithm.
By doing it on a field, you can let ICE do the hard work. The points/vertices in the field can just get the tangent of the nearest curve, store it as say 'self.tan' Then average neighbours 'tan' attributes to create a 'flow' as seen in the video above.

Then your particles just have to 'getclosest' 'tan' from the field object and use that as the force.

Re: curve force

Posted: 07 Nov 2016, 17:57
by sant0s
ahhh, thank you guys, I think its working now!!! :)

I took the outer curves and calculated the distance between them and points and multiplyed that with the tangent stuff.
The tan is like Pooby mentioned, calculated on a grid and than used it to force the particles.

only "problem" was, that outside the curves the points started moving again faster - so I used Milan's compound "Execute InOut Curve".

I'll attache an image, maybe you have some better ideas/improvements.

muito obrigado! :)

Re: curve force

Posted: 07 Nov 2016, 19:28
by rray
Nice solution. I think what I had in mind can't be used for this application. What I meant was you can use the U value you found on the central curve to look up the same U value on the other curves using "UV to location". But using this would distort your field unless you place the curves very carefully. Maybe it's useful for another case.

Re: curve force

Posted: 13 Nov 2016, 15:48
by sant0s
hey ppl,
if anybody is interested, I made a little scene with the curve flow stuff.
the flow is based on Paul Smith's aka Poobys Tutorial on Vector Flow, so thx for that again :)

the outer curves now outomatic follow the outer edge of the riverbed.
the vector_flow model can be used to position the river level.

i created the outer curves by plotting a new curve with lots of points that the curve shrinks nicly into the riverbed.

i tried to do the vector stuff directly on the riverbed, but the vector will mess up all directions.
if anyone has a better idea about doing that stuff more easy, I am interested.

the controll inputs in the compounds are a bit messy, but its quite easy to understand, so just test around.

greetings,
sant0s