CHOP/TOP 'instance-like' behavior

Hey folks!

  • TLDR;
    Is it possible to create SOP-like ‘instances’ of a TOP network that is driven by CHOP data?

For example, I have an animated ripple built from TOPS, that is driven and triggered with CHOPS, and I want to create a new one at the current mouse location every time the user clicks.

Currently the animation resets each time the user clicks because there’s only the single network flow.

I am including an annotated .tox file that has the example built out in two ways :
1 - the ideal CHOP/TOP animation setup to show the desired effect, that will only allow 1 ripple to ‘spawn’ on click

2 - the same idea, roughly built out using actual SOP instancing, with a number of incomplete aspects, and some extra trouble / erratic behavior that came about during the build out.

cont_ClickRipple_Condensed.tox (11.5 KB)

Imagine needing to create multiple instances of complex layered animations (not stuff as readily SOP-able as this ripple).

Thoughts on how to approach / solve this issue?

Thanks much!

-Casey

EDIT
Before asking, I’d scoured the forum and found the following related threads helpful, but they don’t answer the question/s posed here.

viewtopic.php?f=27&t=8193
viewtopic.php?f=27&t=7702

Here’s one approach - on click event it replicates a master node and triggers a timer so you can do the effects you have in your project. On each instance a random seed for noise is fed in… You could essentially do this with as many properties as you’d like.

Once the animation is completed you could just delete the instance.

edit - uploaded a new version (v2). The first one used instances of a container which is unnecessary. I switched it to use bases instead which then all get composited into a single container.

The way I have it setup right now, I couldn’t figure out a good way to delete the nodes once completed so to erase you have to right click.
TOP_Instancing v2.tox (4.54 KB)
TOP_Instancing.tox (3.66 KB)

Hey TimFranklin,

This is really interesting to see setup and working as an approach. I’d hesitated to go through with it, as I’d seen this post :
viewtopic.php?f=27&t=7702

From @malcom (staff)

Also, just for the sake of putting the method through the ringer, I clicked A LOT to add many ‘instances’ and time after time, touch designer locked up and became unresponsive after a point.

I wonder, is there another way to get this desired behavior?

Thanks for sharing!

-Casey

hey Casey,

I think what you’re up to could be partially achieved by using a texture 3D top (set to 2D Array). This would let you cache a number of different TOPs, then you could decide at click which one of these TOPs you’d like to use.

If you’re on a newer windows machine with an NVIDIA card you can also do texture instancing, where each instance points to a different TOP pipeline.

The other consideration here is that the Event CHOP has a callbacks DAT - this gives you the ID of the event, which means you know which sample in your event CHOP has just happened.

Those are just some general thoughts.


Looking at your specific examples:

Some color transformations can be done in the instancing step - notice in the changes here put all of the color transformation in a second instance rather than in a TOP.

You can transform your circle and set the opacity if your circle in the circle TOP - saving you extra TOPs here. Additionally, you can handle a background color with your container COMP rather than having to explicitly use an over and a constant TOP.

There are some other tricks to dig into here as well. If I can dig up some extra time I’ll try to get a few more up here.
cont_ClickRipple_Condensed_mr_edits.tox (7.03 KB)

@raganmd!!!

Much appreciation for you weighing in here.
Indeed I had originally tried out the texture 3d top as a way of achieving ‘unique animation offsets per instance’ - (as seen in your awesome workshop series "Instancing and Rendering Techniques 1-4 @ derivative.ca/Education/Bes … Videos088/) -

… but found this only seemed to work for initially populating the variation of the textures. I’m looking to have the TOPS being uniquely animated over time, and when that texture 3d is set to consistently gather samples, there is massive stuttering. I figured it wasnt meant for this kind of thing…


Regarding the color transformations, indeed I see how you’ve set initial color in the instance, but what I have failed to figure out, is how to get a particular kind of animated color shift per instance. In the case of my example, one CHOP channel value drives a ‘hue shift’ property, giving a sort of shift from yellow to turquoise over time… (as opposed to randomly populating an RGB value per instance) - it doesnt seem like this particular animated shift is easily achievable using whats available in the instance2 parameters page.

Similarly, I’m attaching another .tox that has an example of a more complex CHOP/TOP animation network that seems to me more difficult to replicate using the SOP methods. Hence why I’m asking about this ‘TOP instancing’ (for lack of a better term) Maybe it could be done using nested SOP/Geo comps?

cont_ClickCircleGraph.tox (10.2 KB)


Those last little tidbits re: the circle position/opacity were insightful, as I’d been stuck in viewing that TOP in a particular way. And that container COMP bg color was a big “of course!” for me :slight_smile:

Thanks for taking the time to look at this and work up some tweaks.

-Casey

cont_ClickRipple_Condensed_circle_graph.tox (7.94 KB)Hey Casey,

Okay, some working examples and a slightly incomplete example.

Working first.

Just like you’ve used a look-up for the scale and animation, you can also use a lookup to control color over time:
cont_ClickRipple_Condensed_color_by_lookup.tox (7.17 KB)

Another clever technique is to store animation in a texture3D then play that animation back with the W coordinate for the texture:
cont_ClickRipple_Condensed_circle_graph.tox (7.94 KB)

You can build on that same idea to have multiple animations stored that you then use. This example is almost working, but broken in the case where you’ve only clicked once. What’s happening here is that we use a limit CHOP to assign an ID then subsequently use that ID to bind specific samples to a specific geometry.
cont_ClickRipple_Condensed_multiple_shapes.tox (8.91 KB)

I ran out of time tonight to get this working exactly right, but the last little push is to make correctly handling deleting samples - the one sample if all deleted is not totally right here.

Anyway, I hope this gives you a nudge. I’ll try to carve out a little more time to fix that lingering misbehavior.

1 Like

@raganmd - daaaaang!

TL;DR
wow wow wow great great great thanks thanks thanks!


re: Color by Lookup
Agh awesome. I sometimes fail to see these kind of alternative ways of approaching a particular problem. Getting nodes to do things other than what they ‘seem’ to be meant for is something that I’m still constantly surprised by. This ‘ramp TOP to CHOP’ for color over time is great!

re: Circle Graph
Seeing that the way I’d approached using the lookup chop to add animation data to the event is a legitimate way to approach this particular problem was very satisfying.

Also, the animation COMP is something I havent used so much, cause I’m having a ton of fun generatively shaping animation graphs (very new to me!), but this was a nice reminder that sometimes its great to just draw the dang curve you want :slight_smile:

Seeing the texture 3d TOP actually working here is dope. When I was trying to use it to similar effect, I had it set to always active, so it was constantly resampling to the cache, while trying to send that info down stream… it just wasnt working. Now I see!

The only thing about the texture 3d top is that the animation is effectively ‘baked’, and you’re not able to take advantage of potentially random or generative variation over time. Though theres none of that in my example here, so I’ll come back to the forum’s with another query when the time is ripe.

re: multiple shapes
While I THINK I understand whats going on here in principal, I am having trouble wrapping my head around both how this is wired, and how it works.

If multiple samples generated by the event have the same ID, wouldnt that mean they are not in fact unique? … er, wait, I suppose the value of the ID channel doesnt matter unless you are actually using it for something. Maybe this actually does make sense.

I believe I ran into a similar problem regarding the ‘click once’ w/ the ‘event CHOP’ with my python scripting from the original post. The event seems to start with 1 sample, but when you click the first time, it changes that sample instead of adding it. It caused all sorts of problems for me and I wasnt able to get around it. If you do end up playing with it more, I’d love to see it.


This is a ton of information. I’m really pumped. Many thanks again for taking the time with this challenge.

The texture 3D is baked… sort of. It’s cached, but that doesn’t mean that you can’t perform transformations on its contents. The GLSL top can be used to make changes to a 3D texture - though that does take a little GLSL exploration and investigation. You can also still perform transformations on the geometry itself with a GLSL material. Again, you need to learn a bit of shader code, but there’s lots of exciting opportunity there.

The id isn’t unique, but the sample is unique - the id attribute in this case is just being used to parse out which animation should be used.

That invalid entry id is a real killer here. That -1 makes for a very tricksy situation. I still don’t have a good solve for that, but I’m simmering. I think the more important consideration is that you could use this to separate out instances. It’s also worth knowing that the contents of a texture3D are normalized, so you could also do something clever like if the id is 0 you use the slices in the texture 3D from 0 - 0.33, if the id is 1 you use 0.34-0.66, and so on. This would let you use a single texture3D just change where you’re pulling your animation from.

You might also look through a big cluster of instancing examples here to get some other ideas:
github.com/raganmd/touchdesigne … g_examples

In a way its good to hear that the ID thing is a big deal. Being new to programming, I often find I run into things where I think “this should be easy, I’m just a fool!” only to hear from experienced folks "oh no, thats a real sonofabitch problem you’re chewing on.

I’ll definitely be digging into these instancing examples!
Honestly, I’ve been avoiding the entire SOP category out of my irrational fear of 3d. But after finally biting the bullet, I’ve worked through some of your coursework on it, and I’m actually very pumped.

How many times might someone express thanks without it sounding like an empty platitude?

-Casey