Jump to content

Capture at the change of attribute


Recommended Posts

Hi, 

 

This is one of the things that is just impossible for me to do in Houdini.

 

Lets say I'm using the attribute "active" to trigger everything in my setup. I don't want to do any key animation. 

 

So everything before activation is inactive(active=0), and onces activated (active=1) some things happen.

 

Yeah thats just simple. You get an instant activation.

 

But what about detecting the change of this attribute? Lets say I have a rock that is beeing activated, it falls down, and debris comes, and so on, and so on. But what if I want to do some exploding debris to happen just on one frame - activation frame? 

 

How do I detect if the activation has happened?

 

I had a similar problem before but the help I got was pretty complicated, there was a solver sop involved, which is just a magic for me, I really dont get it.

 

I mean this should be very simple

Edited by Juzwa
Link to comment
Share on other sites

I think you're missing the fundamental fact that SOPs in general do NOT have history. When the viewport asks the SOP node for its geometry, the node says, I need this input's geometry or that input's geometry. In turn, the corresponding input repeats the process up the chain of nodes until some generator node (eg. Box SOP) says, here I can give you my geometry without needing anyone else's geometry. So the generator SOP creates the box geometry and gives it to its output, and then the geometry gets modified and then passed down again, and so on until it ends up back with node the viewport was trying to display. Now when you advance a frame, the viewport says hey, this geometry I'm displaying is time dependent (ie. changes when the frame is changed), so it goes and asks for the display node's geometry and the whole process repeats itself. So in theory, cooking a frame in SOPs gives you a NEW copy of geometry every frame. In practice of course, there's lots of caching behind the scenes so that things that cook to the same result don't actually cook again every frame. But in theory, that's how it works. So if you're at frame 10 and then jump to frame 20, Houdini just cooks the SOPs again at frame 20, WITHOUT cooking frames 11-19. This is what I mean by "history independent", the geometry at a particular frame does NOT depend on the geometry of any other frame.

 

So when you want to detect a change of an attribute across frames, you need to store what the attribute value was in the previous frame right? Well, you can't do that in general inside SOPs because the geometry is new every frame. So this is where the SOP Solver comes into play. What the SOP Solver does is cache its input geometry from the previous frame and feeds it to the SOP nodes inside itself that older piece of geometry to work on every frame. So this is why it works in the SOP Solver. You can save the attribute say prev_attribute and then you can compare the value of prev_attribute with (modified) attribute this frame. But this makes you history-dependent. So if you were at frame 10 and then jump to frame 20, the SOP Solver needs to cook frames 11-19 before it can accurately give you the geometry of frame 20. So if you've got a heavy SOP Solver network, it's going to take a lot more CPU power if you only wanted to look at frame 10 and frame 20.

  • Like 1
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...