JacquesLucke / animation_nodes

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

Proposal: Loopable Evolution on Wiggle Nodes (& Noises) #1639

Open dapa5900 opened 3 years ago

dapa5900 commented 3 years ago

Hi.

A pretty common task in motion graphics is to create seamlessly looping animations (for example for social media posts, that play seamlessly forever or event visuals, etc.). Would it therefor be possible to add such an easy to access option to all nodes that generate animatable random values (eg. everything that has an evolution input like the wiggle nodes)? If so, this functionality should consistent of these 2 things:

  1. A checkbox that turns looping on and off
  2. An input to determine the length of the looping animation

I don't know if this helps but here's an example of someone already came up with an approach how to do this in AN (however this implementation is quite cumbersome und limited imho): https://www.youtube.com/watch?v=AExHc_b8yM0

If this is possible to achieve, it would be great if we could as well have a loopable evolution option for the noises in the noise falloff. In case this is not restricted to Blenders own limitations when it comes to animating and looping noises...?

OmarEmaraDev commented 3 years ago

The only method of looping noise I know of is done through higher dimensional projection. In order to loop an ND noise you need to evaluate the noise in (N+2)D space. In Animation Node nodes, the maximum dimension we support is 3D so we can only loop 1D noise, that is, Wiggle nodes. If we update our noise library to support 4D, we can loop 2D noise, but that's probably the furthest we can go.

Do other software support looping 3D and 4D noises?

harisreedhar commented 3 years ago

The only method of looping noise I know of is done through higher dimensional projection. In order to loop an ND noise you need to evaluate the noise in (N+2)D space. In Animation Node nodes, the maximum dimension we support is 3D so we can only loop 1D noise, that is, Wiggle nodes. If we update our noise library to support 4D, we can loop 2D noise, but that's probably the furthest we can go.

Do other software support looping 3D and 4D noises?

Cinema 4d have loopable noise

OmarEmaraDev commented 3 years ago

@harisreedhar Even loopable 4D noise?

harisreedhar commented 3 years ago

@harisreedhar Even loopable 4D noise?

I think it is loopable 2D noise.

OmarEmaraDev commented 3 years ago

I see. As expected.

dapa5900 commented 3 years ago

@OmarEmaraDev

I'm not sure about the type of noise but I also think it's 2d. Here you can see an example how it works in C4D:

https://user-images.githubusercontent.com/75205162/104751183-53851780-5755-11eb-9c6b-d413a02e0fae.mp4

You first set the speed of the animation and then via "Loop Period" the seconds the loop should take (in this case 3 seconds so when you set the timeline to in my case 74 (3x25-1) frames you get a seamlessly looping animation; you can see the timeline at the bottom of the video). If you leave the duration to 0 it animates but doesn't loop (which could be as well an alternative to having a checkbox for the looping option).

It would be super great if we can get this for AN as well since with loop-able noise you get of course much nicer and art direct-able patterns than with the wiggle nodes..

Thank you!

OmarEmaraDev commented 3 years ago

As a first step, we can implement looping for Wiggle nodes. Then we can look into updating the noise library and providing looping noises.

dapa5900 commented 3 years ago

@OmarEmaraDev

Awesome! Thanks

OmarEmaraDev commented 3 years ago

I will probably update to the noise library directly as I don't like the wiggle code we have at the moment and can't work with it.

genesis2303 commented 3 years ago

I will probably update to the noise library directly as I don't like the wiggle code we have at the moment and can't work with it.

If this can help someone already translated loopable wiggle expression from after effects to AN https://www.youtube.com/watch?v=IJENMB7q6Ug It even seems to work with anticolision node.

OmarEmaraDev commented 3 years ago

@genesis2303 It is technically feasible and understandable. We just need to allocate the time and effort to do it as it requires quite a bit of work.

dapa5900 commented 3 years ago

@OmarEmaraDev great. I also wanted to check back how's it going with this project? Can you say something already, what might be a reasonable time frame here? Thanks for your efforts!

OmarEmaraDev commented 3 years ago

@dapa5900 Currently, we use a library called Fast Noise SIMD to implement noise related nodes. At the same time we have separate code for the wiggle node, which is essentially a 1D noise. Fast Noise SIMD is no longer maintained and a new library Fast Noise 2 is under development. Initially I wanted to update the noise library to be the new one and unify the wiggle code with it, this proved difficult and the library is still not stable enough for us to use anyways, so those efforts went no where.

Now, I am thinking of writing our own noise library from scratch, in Python. Before we do that, we need to make some experiments on the performance loss we can expect, and if that loss will be acceptable. There are some advantages for writing our own library, however. This include allowing more features like looping all noises up to 4D, which is not possible if we use a standard noise function.

So, first step is to do the experiment and see how feasible that is. Then if proved feasible, write the library and incorporate it into Animation Nodes. Then finally implement loopable noise and the like. I am doing my final exams at the moment, so I couldn't work on anything the last couple of weeks, but I will pick up development as soon as I am done. I will keep you updated and provide a time frame when I know more.

dapa5900 commented 3 years ago

@OmarEmaraDev alright. Thanks for the detailed explanation and interesting insights. And first of all good luck to you for your exams!

As a further suggestion, when you write the noises yourself maybe you also want to have a look at the pretty extensive Cinema4D noise library for inspiration.

https://developers.maxon.net/docs/Cinema4DPythonSDK/html/types/noise.html

OmarEmaraDev commented 3 years ago

@dapa5900 Thanks, I will take a look.

OmarEmaraDev commented 3 years ago

An update on this. Using Numpy universal functions was a bad idea. Performance was not great and I somehow missed the memory usage implications of such code, so this is a no go as far as I can tell.

I am not sure yet, but I now think the ideal solution is to write the library in ISPC. The one disadvantage is the non trivial dependency we will be introducing to Animation Nodes if we do that. Maybe using precompiled libs would be a good idea here, but lets not worry about that for now.

stale[bot] commented 3 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.