Particle creation based on image colour


would like to know if it is possible in Hitfilm (free or pro) to automatically create particles as long as a specific area of the video is colored in a defined color. 

Like if these blue bars hit the red marked zone, particles will be ejected in the blue colored video parts.


If possible it might be a workaround to purchasing after effects.

Thank you! :)


  • NormanPCNNormanPCN Website User Posts: 4,033 Enthusiast
    edited December 2019

    As for triggering on a color and emitting colors from that colored area.

    You could try using a Hue&RGB key effect on a duplicate copy of the media clip. Key the exact color of blue you want. Then select the invert option on that key. Now you have a layer that is blank/empty when no blue bar exists or has something where the blur bar exists. That something is the blur bar.

    Use a layer emitter for the particle simulator. Reference the Hue&RGB keyed layer. You'll need that keyed item pre-comped (key effect baked in). When the layer is blank then no particles will be emitted since there no area to emit particles. When something is there particles will emit from that area.

    If the specific blue bar is there but you only want to emit when the bar reaches a certain area. Like the bar is expanding down toward the keys. I'm not sure that can be done procedurally and have particles emit from the full blue area. I'll have to think about that.

  • pu22pupu22pu Website User Posts: 3

    Thank you! Sounds complicated (but nothing else did I expect) and very helpful!

    But through this method, will the particles only be visible in the blue areas (/bars)?

    The goal would be to make it look like the blue bars 'explode' (see screenshot below).

    Example 2 

    The screenshots are my present state. But I work with workarounds (using the program MIDIVisualizer to produce the bars and particles automatized as one video file). Would prefer to do it manually and therefor having full control over the particle style and physics.

  • NormanPCNNormanPCN Website User Posts: 4,033 Enthusiast
    edited December 2019

    "But through this method, will the particles only be visible in the blue areas (/bars)?"

    Particles are created within the emitter area. The particles  go and move where you want them to go after creation. After creation the particle display/movement is dependent on the particle sim settings.

    "The goal would be to make it look like the blue bars 'explode' (see screenshot below)."

    Now that is another thing. From the description the blur bar is something that already exists in the existing media. To make something that already exists in the media, disappear is a major problem. This should be obvious. If you just want particles to explode from the bar and in the existing media the bar fades or disappears then fine. But if the bar is expected to explode into pieces, that is a problem if the bar is already in the existing media.

    Now if you are generating the bars in Hitfilm, then having the bars "explode" is doable. Meaning the bars break apart into particles. Using the atomic particles effect may be better for this.

    There is nothing in Hitfilm that will automatically create the bars for you. You would have to manually keyframe the bar creation and such.

    You could create a composite shot to do the bar animation and destruction and then simply reuse that composite on your timeline. Place it (the composite) per keyboard keystroke. Even have different colors, or other particle parameters, per instance using a composite template. In this way you can have visual variations per instance.

  • pu22pupu22pu Website User Posts: 3


    Right, the bars are already generated with another tool. It should just 'look like' an explosion by particles appearing from the area where the bars disappear.

    Both of your comments are very helpful and as you say, the visibility of particles is not restricted to blue areas, I will try the method you suggested in your first comment out and see which results I receive - thanks.

  • Triem23Triem23 Moderator Moderator, Website User, Ambassador, Imerge Beta Tester, HitFilm Beta Tester Posts: 18,728 Ambassador

    Ok, how are the bars brought in. As a video being overlayed on the keyboard as a different layer/comp shot, or do they already exist over the keyboard?

    I think @NormanPCN has slightly incorrectly explained a particle sim's Layer Emitter.

    A layer emitter is a quad emitter which reads the assigned video as a "texture map" before emitting particles. There is a checkbox active when using a Layer Emitter to "use layer alpha." This reads the source alpha of the underlying layer. Else, "transparent" areas of the source video will generate black pixels. A Layer Emitter always generates particles across the entire area of the quad surface and NOT only where non transparent particles exist in the video. This is a real, and very important difference from what Norman wrote, "When the layer is blank then no particles will be emitted since there no area to emit particles. When something is there particles will emit from that area."

    Since the Layer Emitter is generating particles across the entire area, a layer that is mostly transparent is generating a lot of invisible (transparent) particles. Even though you can't see then, they are calculated, and eating resources. When using Layer Emitters, you want the smallest Emitter area possible.

    So, if your bars exist in your source video, then you want to create a Composite Shot with your video, then adjust the size of the actual Composite Shot to crop. If you only want a small area of the bars to explode you shrink the dimensions of the Comp, reposition the video to only show what you need, then Pre-Render.

    It's the difference between having a 1920x1080 Emitter (about 2 million pixels) wasting mostly invisible particles or a (example) 500x100 Emitter (50,000 pixels) creating mostly visible particles... One is 40 times more efficient than the other once you take the time to set it up correctly.

    Of course, cropping down the source video size takes care of the particles only emitting from a certain area, since, now, only that area emits particles. 

    Otherwise, it looks like a simple Luminance Key should knock back the keyboard from the bars.

    So, to break this down into the checklist. 

    • Duplicate your video with the bars to its own Comp Shot
    • Move the video in the Comp so the section of bars you want to keep is centeres. 
    • Change dimensions of the entire Comp (gear/cog icon, bottom of Layer Stack/tools) so that it's only the size/area you want. This might be a little back and forth, readjusting the position and adjusting the size. Don't stress too hard on this. If you set your Comp to the example 500x100 and that's a tad large, go ahead and use a layer mask to do the last trim. The key thing is eliminating most of the wasted/empty space from the Layer Emitter.
    • A Luminance Key should be able to knock back the keyboard to transparent. A Curves before the Key should be able to refine things more to drop the keyboard darker so the key gets it. If you have a little "fringe" of dark around the bars, don't worry. We'll get this in a later step. ?
    • Pre-render this Composite Shot. Now that you've shrunk the Layer Emitter source and Pre-rendered it, you've done everything you can to make your particle sim more efficient.... 
    • In your main comp, drag in your Pre-rendered comp and align it over the main video. 
    • Mute the Comp. You shouldn't need to see it. 
    • Create your Particle Sim. Set the Emitter Type to Layer and make certain you check "Use Layer Alpha." Also, in Appearance, I'd set the Blend to ADD (which will basically get rid of leftover dark fringe - told ya we'd get there!) 

    Otherwise, my guess is a "Random" trajectory and lots of particles will give you the look you want. 

    If you want to do a little more work, you can set up a different Comp and Emitter for each bar so you can use the "Explode" trajectory type. And here's the neat thing... Setting up a separate Emitter for EACH bar doesn't take much longer than doing it once!

    So you've set up the custom comp for Bar 1... Great, in the Media Bin, select Bar 1, and CTRL+D to duplicate it and rename to Bar 2. You should only have to so a little horizontal slide to bring Bar 2 to the center... Repeat for each bar. An additional advantage here is now you've eliminated wasted space between bars, so, generating fewer transparent particles! 

    Pre-Render all the bars Comps, drag in and align as before. 

    In the Particle Sim, set up the Bar 1 Layer Emitter. Just worry about that one for now. With the isolated bar an "Explode" trajectory should do what you want... And, of course, once the Bar 1 Emitter looks good, you can highlight that, hit CTRL+D a few times, link the dupes to the Bars 2 to last-layers and you're done! 

Sign In or Register to comment.