JacquesLucke / animation_nodes

Node based visual scripting system designed for motion graphics in Blender.
Other
2.29k stars 342 forks source link

Animation Nodes 2.1, Lists from Particle Data have Incorrect and Changing Values/Indices when Generated from a List of Objects #950

Closed StarshipAmelia closed 4 years ago

StarshipAmelia commented 6 years ago

Instantiating objects with particle systems (using the Copy Full Object option), then getting values from a Particle Data node being fed those objects' particle systems through a loop will create output lists that slide their values up and down, as well as inserting values at points other than at the end of the list. This seems to happen per frame. These values seem to mostly be inserted at the midpoint of lists and above. (Though possibly not exclusively, my tests have been hampered by another issue, described further below)

This causes any use of the output of the Particle Data node's output to jump around, sometimes in large single jumps, and other times in a "sliding" motion.

The second issue, which I'm unsure if it's related, is that sometimes vectors and other values in a list persist even when they shouldn't, for instance, values that are generated by a particle system remaining statically in place even at frame 1 (and for the rest of the animation). They also persist across reboots of blender.

This blend file demonstrates both issues. The large blue frame is there just to demonstrate the issue in a bit easier to see manner than just the 3d Viewer node (though that node is also there). It does not seem to affect the issue. The red frame is where I believe the issue is occurring. The grey frame is a simple animation of Instantiated cubes (with particle systems).

Apologies if I've not phrased things too clearly, and thank you for your time and this wonderful addon!

OmarEmaraDev commented 6 years ago

You are appending the locations of dead particles of objects sequentially. If the particles of the second object died first, then when the particles of first object die, their locations will be introduced at the start of the list, thus the locations of the dead particles of the second object get shifted. Imagine all five of your objects doing this, the list will become highly unstable as you are seeing. So this is an expected behavior.

StarshipAmelia commented 6 years ago

Ah, that makes sense, apologies! Would there be a way of working around this behavior?

OmarEmaraDev commented 6 years ago

I am not sure what you are trying to do in general. But consider processing every particle system on its own. Or sort the locations based on the die time, you already have the die time, so this should be easy. If you could shed some light on what exactly you are trying to do, I could provide a more detailed example.

StarshipAmelia commented 6 years ago

Processing every particle system on its own would be somewhat inflexible, as I hope to eventually use this system to handle dozens of particle emitter objects at a time. However, your idea of sorting based on die time seems to work exactly as I was hoping, thank you! image

As for what I'm attempting to do in general is create a system where I can plug in any number of meshs' BVH trees (after setting them as collider objects with particle killing enabled), and then make it so that any particles (from another list of particle systems from objects) that collide (and thereby die) cause an "explosion" effect to quickly scale up and then shrink a textured sphere (as the explosion), while leaving a scorch mark/decal object aligned with the normal of the polygon they were placed on.

Essentially, I want to have it so that when particle "bullets" hit certain objects it looks like they cause an explosion and leave behind a scorch mark. Example: demo1

To be clear, simply sorting the lists by the die times seems to make everything work exactly as I want, thank you very much for your help!

OmarEmaraDev commented 6 years ago

Glad I could help. Are you the one who asked this question on stackexchange? If so, it seems you are working on something awesome! Would it be possible to share the final results with us, if you don't mind?

StarshipAmelia commented 6 years ago

Yeah, that was me! And thank you very much! I'm not sure when I'll finish the piece (I'm only about 1/4th to 1/2nd at most of the way through, and I've been working on this on-and-off for months now), but when I do I'd be very happy to share it! I'm planning on putting it on my youtube channel (and other locations) when done, so I could add another comment linking to it when I'm finished, if that's alright?

Probably worth noting that only the most recent animation on my youtube channel uses animation nodes ("The Creation of Ersatz Minds"), all the others do not, if I'm remembering correctly! Additionally, all these animations are part of a larger worldbuilding project I'm working on, so apologies if individually they don't make much sense to anyone other than me!

OmarEmaraDev commented 6 years ago

Ok, let us know when it is done.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.