5
$\begingroup$

I am fairly new to Blender and don't have a very firm grasp on it. I was wondering if anybody knew how to add a .png overlay on a different keyframe.

I had a wood texture on a plane on keyframe 1, and on keyframe 60 there needs to be a black circle in the center of the plane, without a transition. So (at 30fps) the animation begins and two seconds in, a black circle suddenly appears on the plane, in the center.

$\endgroup$
0

2 Answers 2

4
$\begingroup$

Assuming your circle is an image with alpha, you can use one MixRGB node to mix the circle into the wood, and another to control the Alpha.

An image texture of a circle with its alpha data being used as the factor to overlay it on another image texture

Wood texture courtesy of Pixabay

The routing from the circle image's Alpha output socket is telling the MixRGB node "hey, I've got alpha data - use this to factor the mix". A MixRGB node's upper Color1 input socket will be what gets sent through the Color output socket when Fac is 0.0, and the lower Color2 input socket will be what gets sent to the output when Fac is 1.0.

There are many ways to do this. For example, to mix in the Alpha you could use a Math node set to Multiply instead. A Fac socket is designed to receive a float value between 0.0 and 1.0, and the MixRGB node provides that, so I thought it would make a good example. As in other graphics applications, when we are dealing with alpha values, 0.0 is represented by black, which results in 0% opacity (100% transparency), and 1.0 is represented by white, which results in 100% opacity (0% transparency). (Forgive me if I'm over-explaining, but you mentioned you were "fairly new to Blender" so I'm trying to be thorough.) That's the reason the Color1 input socket is set to black in my example.

Animation

Note that the keyframing (yellow slider) is on the Value node. You can of course keyframe the Mix slider directly, but this way you allow for the possibility of letting the Value node's automation simultaneously control some other parameter, should you decide to add one at a later point.

If you end up adding several of these, it might be a good idea to start labeling your nodes to make it clear what each is doing:

On the subject of keyframes, to make an abrupt transition you can either make sure the 0.0 value keyframe is the frame immediately before the 1.0 value keyframe, or you can navigate to the Graph Editor, select the parameter you have keyframed, and press T. Then set Keyframe Interpolation to Constant. This will ensure that the transitions are immediate. First there's no circle, then suddenly there's a circle.

Setting keyframe interpolation to Constant in the Graph Editor

Customization

You might find that you want to reposition or resize your circle at some point. For that you can precede the Image Texture node with a Texture Coordinate node followed by a Mapping node. For an image texture, usually you will use UV as the mapping method. Here I've set the image extrapolation method to "Clip" so that the circle won't repeat if scaled down.

The procedural approach

Now that you know how to overlay an image with transparency, you might consider going procedural for something as simple as a black circle. With this method there's no need to think about image resolution, it uses less memory than an image, and it's very customizable. Using Object coordinates will place it on the center of the object. Add a Gradient Texture set to Spherical, then route that through a ColorRamp set to Constant interpolation to change the smooth gradient into a flat circle with a hard boundary.

A procedural method for creating a circle using a spherical gradient and a color ramp

Notes: ①"MixRGB" is the way this node's name appears in the Add menu. In recent versions of Blender the node itself is displayed with the name "Mix", in case you are wondering why I refer to it as "MixRGB" in this answer. ②The nodes on the right in my example are from the Images As Planes add-on. I imported the texture as "shadeless" so it will have a fixed brightness value and not receive lighting. Your node tree likely looks different here, but don't worry about that. ③ Technically Object coordinates will be the coordinates of the object's Origin, so there is a possibility that for you this will not be the center. There are various ways to get around this, such as repositioning your object's Origin, using the coordinates of another object, or simply offsetting with the Mapping node's Location sliders.

$\endgroup$
2
  • $\begingroup$ THANK YOU SO MUCH, lifesaver! Cheers, Mentalist! $\endgroup$ Jul 5 at 13:40
  • $\begingroup$ @DemonicGenesis Glad I could help! :-) $\endgroup$
    – Mentalist
    Jul 5 at 17:50
2
$\begingroup$

You can also try this node setup: Mix your original material with the image texture of the circle (give the color you want to your circle, keep the background white) through a MixRGB in Multiply mode, keyframe the Factor of the MixRGB in order to make the circle appear:

enter image description here

If you need to mix 2 differente shaders, use a Mix Shader and plug the Image Texture into the Factor, mix it with a MixRGB in Multiply mode so that you can make the circle appear:

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you, but unfortunately, not what I'm looking for. Cheers! $\endgroup$ Jul 5 at 13:40
  • $\begingroup$ no problem but in what way is it not what you're looking for? If you're talking about your wood texture you just need to plug it into the Color inputs of the MixRGB (solution 1) or of the Diffuse or Principled BSDF (solution 2) $\endgroup$
    – moonboots
    Jul 5 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.