Repeating mask? Procedural textures in compositing?

Is there any way to make a repeating process using compositing nodes? Imagine you want to generate 120 box masks using some formula and a driver, is there a way to do this in compositing nodes?

I’m making a video animation from on a collection of audio-only interviews. I’ve used the AudVis add-on to generate audio spectrograms from my recordings. Currently I’m using the spectrogram texture on a displacement modifier which is applied to a cube which has been duplicated using the array modifier. This creates a series of cubes, to which the texture is applied, giving each cube a different height. Then I render these out with full-alpha background and combine them in the compositor.

This process is breaking down though. I have 69,460 images in one scene, and I’m trying to render at 4k resolution. I can’t even transfer these files between folders, my computer (a mac) seems to have gotten stuck trying. This is why I asked the initial question, I’m wondering if there’s a way to get the same result directly in my compositor.

Another idea would be to make a procedural texture and use that in the compositor, but is that even possible? Not sure… The bars are about 140px tall, and span the width of the frame, meaning 3,840px wide, and there’s 120 bars, so that’s 32px each, with some gap in between each one, so that’s about 16px of bar and 8px of alpha on each side.

If I make one box mask for every bar, it’s a lot of manual work. It seems I have to type in the driver function for each individual bar, and this is currently error prone, meaning I have to use trial and error to get the driver correct, then go update every single mask node.

Okay, so right after posting this, I discovered the brick texture, and I was able to work out the math to generate the 120 bars, but I still don’t know how to scale each bar by a different driver value.

Okay, I think writing this out helped me solve the problem myself. I think what I can do is render out 69,460 small resolution images (1 for every frame), being 120px wide by 140px tall, and use these as a mask over the bars I’ve generated.

One remaining question: Is there a way to produce these shapes from my spectrogram images using a procedural texture (instead of rendering geometry)? Here’s what that spectrogram image looks like.

AudVis Spectrogram-00050

Have you looked here for answers ?

Or on their YT channel ?

You seem to be doing this in a bad way…

AudVis doesn’t have much of anything for compositing use. If you think this is a bad way, what do you think would be a good way?

Every video I have ever seen has used scale on the equalizer bars. AKA bake the sound to the Z scale. You are working with texture instead of scale.
Admittedly I have never used that add-on.

1 Like

Can I ask why do you use compositor for this? Is it really necessary? Is it for performance reasons?

Here is my proposed “solution” (but I’m still not sure about the motivations behind your compositor solution):

  • scene 1 with transparent background + animated bars / cubes / geometry nodes / whatever + AudVis Sequence Analyzer enabled
  • scene 2 with whatever you want
  • compositor in scene 1 with rendering also scene 2
    image

There is much more to do in Compositor nodes, this is just really dummy mockup.

edit: this way, you can combine rendering with different engines, like Cycles for main scene and Workbench or Eevee with minimal settings for sound visualization squares

2 Likes

The reason to use the compositor is that most of each frame is either still image, or from a shorter repeating sequence, or needs a film grain effect.

The blue background behind the audio visualization is an animated procedural noise, and only needs to be 720 frames long, cycled on repeat. There’s no reason to continually calculate new background textures for 30 minutes of video when I can just loop 720 frames and composite it together with the other scene elements using an alpha mask.

I was able to solve this using a pre-rendered mask. Because the size of the mask is 120 x 140, when upscaled it’s blurry. I don’t know how to prevent this, so I just applied a color ramp to make a hard border between the black and white areas.

So you’re talking about generating keyframes for the scale value? I don’t see how that would really change much, the result of that part of the workflow is the generation of the animated geometry, which is what I have now, and isn’t relevant for the compositing step.

What would be really useful is a procedural texture node which can create an array of drawings in the same way that the array modifier works. Because we can use procedural textures in the compositor, we could do a lot of useful 2D effects in the compositor. But texture nodes are apparently going away, so I guess people have decided that nobody needs procedural stuff in compositing. Doesn’t make any sense to me.

Something like Geometry Nodes, but 2d? It would be cool. But not very useful for most of Blender users, I guess