Jump to content


Fish flocking system


  • Please log in to reply
3 replies to this topic

#1 blackchicken

blackchicken

    Illusionist

  • Members
  • PipPipPip
  • 268 posts
  • Joined: 21-July 08
  • Name:jan kurimsky

Posted 14 June 2012 - 09:11 AM

Hello

I creating system for schooling fishes. I choose simple setup with wires and deformable geo. But i have some prolems. I split system onto two peaces. For detailed animation I deform fishes with wires, so they bend like curves with creap, but I cant find way how inside loop add velocity atribute to rippleSOP which simulate speed of fish swiming. I look at the couple of foreachSOP tutorials but cant find right way.

Second system is easier. There I only copy fishes on the end of each wire and thats all. But i found problem. dont know why, but if I take my vel, convert it to speed and use this for driving rippleSOP wave speed, when is attribute near zero, fish start swim fast. grrr, I custom visualize my parameter, all is ok. Dont know why ripple see high value. I cant find the mistake.

there is simple system. It is vissible when particles stopping, ripples go faster.

https://vimeo.com/44051381

hip file.

Attached File  flock_odforce.hip   382.35K   95 downloads

#2 blackchicken

blackchicken

    Illusionist

  • Members
  • PipPipPip
  • 268 posts
  • Joined: 21-July 08
  • Name:jan kurimsky

Posted 18 June 2012 - 02:32 AM

Anybody? I cant still find way how to connect speed in foreach  :unsure:

#3 anim

anim

    Houdini Master

  • Members
  • PipPipPipPip
  • 910 posts
  • Joined: 23-August 07
  • Location:Slovakia, Bratislava
  • Name:Tomas Slancik

Posted 08 July 2012 - 04:45 PM

well, 2 things

1. ripple SOP is based on global time and changing wave speed is just the same as changing temporal frequency, it is changing it from begining of the timeline (time = 0s)

as a little example to understand better:

imagine you are on 10s of your timeline
ripple wave speed is 1 which lets say means 1 wave per s (it might be different but it doesn't matter for now)
so by now it already advanced by 10 waves from the beginning
now imagine you are animating it between 10s and 11s from 1 to 2 so you expect it to start getting a little faster to twice the speed within that 1s which will be around 1.5 wave within that 1s
but
what it really does it will recompute how many waves should have passed from beginning till 11s at the speed of 2 and which is 22 that is the final wave count
so it is actually animating from 10 waves to 22 within that 1s which is 12 waves instead of 1.5 and therefore that sudden speedup
if you want it to behave correctly you need base your ripple system on time as a variable/parameter which is quite easy with just modifying the existing ripple solver code, or making one in VOPs
then you can accumulate speed within CHOPs or in your original particle network, so each fish contain exact swum distance at each frame which can be used to drive time of the ripple

2. to use any attribute within the ForEach, you can simply use point() expression inside of your foreach node in the parameter value of lets say that ripple sop
so for example
point("../each1", 0, "speed", 0)
will take value of the "speed" attribute of the first point of the geometry in ../each1 node

you can of course use other like prim() or detail() to access other types of attributes
Tomas Slancik
Generalist
Slovakia

#4 blackchicken

blackchicken

    Illusionist

  • Members
  • PipPipPip
  • 268 posts
  • Joined: 21-July 08
  • Name:jan kurimsky

Posted 04 August 2012 - 01:42 AM

View Postanim, on 08 July 2012 - 04:45 PM, said:

well, 2 things

1. ripple SOP is based on global time and changing wave speed is just the same as changing temporal frequency, it is changing it from begining of the timeline (time = 0s)

as a little example to understand better:

imagine you are on 10s of your timeline
ripple wave speed is 1 which lets say means 1 wave per s (it might be different but it doesn't matter for now)
so by now it already advanced by 10 waves from the beginning
now imagine you are animating it between 10s and 11s from 1 to 2 so you expect it to start getting a little faster to twice the speed within that 1s which will be around 1.5 wave within that 1s
but
what it really does it will recompute how many waves should have passed from beginning till 11s at the speed of 2 and which is 22 that is the final wave count
so it is actually animating from 10 waves to 22 within that 1s which is 12 waves instead of 1.5 and therefore that sudden speedup
if you want it to behave correctly you need base your ripple system on time as a variable/parameter which is quite easy with just modifying the existing ripple solver code, or making one in VOPs
then you can accumulate speed within CHOPs or in your original particle network, so each fish contain exact swum distance at each frame which can be used to drive time of the ripple

2. to use any attribute within the ForEach, you can simply use point() expression inside of your foreach node in the parameter value of lets say that ripple sop
so for example
point("../each1", 0, "speed", 0)
will take value of the "speed" attribute of the first point of the geometry in ../each1 node

you can of course use other like prim() or detail() to access other types of attributes

Thats excelent, thanks a lot. Im going to integrate it. Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users