Jump to content

Controlling animated instances


6ril

Recommended Posts

Hello,

I'm instancing a geo on a set of particles, but I need this geo to have an animation under certain conditions.

I've search for ways to instance (or copy) animated geo, but all I found is how to offset an animation randomly.

What I need (see attached .hip) is to either start an animation when a particle reach its destination (there's a popseek) or even better, to control an attribute that drives the animation (that would be the "Up" slider I made on the "geo2instance" node, at the scene level)

I'm a little confused over a few points:

- Should I instance (as in the attached .hip) or should I use a copySOP ?

- The animation I need is really simple, it's just the size in Yaxis of a box. Do I need to animate it, and then control when to start the animation ? Or can I drive the parameter later on, after copying/instancing over the particles, using condition like if velocity is lower then this, or if the distance between that particle and it's goal is lower then this ...

 

Just to be clear, I'm trying to have this : when the particle reach it's goal, then the central box should rise up.

 

thanks guys !

OD-F_instances-animCTRL.hipnc

Link to comment
Share on other sites

Hey man, houdini is down at work atm so can't check out your hip, but basically if you have a trigger set up in your pops of when you want animation to start (I am imagining if it hits a surface, or something like that, then you'd make a new attribute that starts at 0 that adds 1 per frame), you can use this for what frame of the animation it is. Using the instancefile attribute (think that is the one) you explicitly tell what file to instance.

So some sudo code would be

string Frame = itoa(i@FrameCountingFromTrigger);

//Frame is the trigger you add a value to every frame from whatever the condition is you want to start counting from

s@instancfile = "/harddrive/project/instancefil1_" + Frame + ".bgeo.sc";

Link to comment
Share on other sites

Hi, I'm also curious if there is a way to control parameters per instance.
For now, in the attached file, I used copy stamping. I also just learned that you can stamp even from outside the network! (I stamped the spare parameter "up" that you created at geometry level)

animated_instances_copystamp.gif

Houdini Indie 15.5.607

OD-F_instances-animCTRL_v2.hipnc

  • Like 2
Link to comment
Share on other sites

@rich_lord: Interesting, it got me curious about a CHOPs approach.. :)
Although the sample file on the thread that you linked to did not use a Trigger CHOP. Also, it animated the points, not the actual animated instance. Learned quite a bit from your setup, thanks!

I've attached a file inspired by rich_lord's suggestion. It's a bit of a hack.. this sample does not use a Copy SOP, but instead modifies/cheats the animation offset by modifying the primitive itself >_<
(In this instance) I suppose this technique is purely scene specific hehe.

Houdini 15.5.607

OD-F_instances-animCTRL_v3.hipnc

  • Like 1
Link to comment
Share on other sites

While I'm at it, I've got trouble getting my particles to a full stop : /

I'd want them to really stop as soon as they reach their respective goal point, instead of the current  constant swaying.

I've tried to bring the Velocity and Force to zero if Velocity < 0.1  but it's not a good idea,
so I guess I should calculate the distance between a particle and its goal point, and use it as a threshold (instead of a low velocity threshold).

There's a arrival feature, with a breaking distance and force, but it's never stopping the particles from the constant swaying.

How would you do it?


 

Link to comment
Share on other sites

So what is timer? And why does it work?

When I examine the v2 HIP file I notice you are creating a local variable called timer inside the Copy node and you enable stamping but you never use the variable in a stamp expression. If I rename the local variable timer to timer9 the animation of the rising tower never occurs.

I search through the help cards and can't find any reference to timer.

I don't understand what makes it go...

 

Link to comment
Share on other sites

Hey Atom, the timer variable on the Copy SOP is being used outside the particles object network. You will find the stamp function is up at the geo2instance object's "up" spare parameter. That is the specific bit that I mentioned on the post where I attached the v2 hip file, something new I also just learned while tackling this :D

"timer" is just a variable name that I chose, it can be anything.

Edited by galagast
Link to comment
Share on other sites

I managed to stop my particle with this :

if distance to targetP is less than 0.01 -> @P == @targetP   (where targetP is the position of the goal points)

It's not perfect (there's a little jump to the final position), so if someone knows a better way, it would help ;)

Link to comment
Share on other sites

Ah, thanks for explaining that Jeff. I guess the real test would be with some kind of animated geo sequence.

 

@6ril: You may want to try just reducing velocity instead of setting position. I tried this code in a PopWrangle and it seems to work ok.

string scatter_path = "op:/obj/particles/GOAL_points";
vector target_goalP = point(scatter_path,"P",@ptnum);
if (length(target_goalP-@P) <0.001) {
    v@v = 0;
}

 

Edited by Atom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...