10
$\begingroup$

I'm making a video, and I have two identical objects that start in the same place and then separate. I want to have a dotted line connecting them which appears only when the two objects start separating and continues to grow as the objects continue to separate. This takes out using the array modifier.

$\endgroup$
2
  • $\begingroup$ What about animating the visibility of the dotted line object so that it's invisible before the objects separate? $\endgroup$
    – gandalf3
    Dec 17, 2014 at 23:15
  • $\begingroup$ Okay, then how would I animate the line appearing as the objects get farther apart? $\endgroup$ Dec 17, 2014 at 23:17

4 Answers 4

15
$\begingroup$

Make a curve, attach empties as hooks to each end of the curve, parent then those hooks/empties to the objects. That way when the objects move apart the curve will follow and grow.

enter image description here

For the curve to have some thickness, make it 3d and add some bevel.

enter image description here

CYCLES rendering

To create the dotted lines for the curve, use a checker texture to control the transparency on a material .

enter image description here

enter image description here

$\endgroup$
7
  • 1
    $\begingroup$ Thats wonderful! It works just fine! Is there a way that you could do that in Blender Internal? I use it for my 2d-like animations, and so That would be great! $\endgroup$ Dec 17, 2014 at 23:44
  • $\begingroup$ And did you bevel the curve to see the material? $\endgroup$ Dec 17, 2014 at 23:50
  • $\begingroup$ Yes. See updated answer. $\endgroup$
    – user1853
    Dec 17, 2014 at 23:55
  • $\begingroup$ Okay. Its working! Thanks again! I'll find out how to make the lines dotted in blender internal, but your instructions were AMAZING $\endgroup$ Dec 17, 2014 at 23:57
  • $\begingroup$ @DragonHeart please add an answer for blender internal :) $\endgroup$
    – user1853
    Dec 18, 2014 at 2:05
8
$\begingroup$

It is actually possible to do this with an array modifier, if you also use a curve. On the object that will serve as the dot in the dotted line, you need a modifier stack like this:

modifier stack

The most important part is changing "Fit Type" to "Fit Curve", and putting the curve modifier below the array (the inverse will cause it to make enough copies but leave them in a straight line).

I used this with the "curve with hooked empties attached to cubes" scenario from cegaton's answer, and got this:

enter image description here

One thing to watch out for with this type of array, is that the series of copies always stops rather short of the curve; I guess it's erring on the side of never going over. You may need to move the end of the curve farther into the object to compensate.

$\endgroup$
1
  • 1
    $\begingroup$ Oh my gosh, I never thought of having the fit curve option! thank you for that! $\endgroup$ Dec 22, 2014 at 18:05
3
$\begingroup$

For Blender Internal

Although there is a checkboard pattern available in the Texture Node Editor area, it appears to only be a 3 color channel texture but Blender Internal seems to require that alpha masks be contained within the 4th channel of the texture(I think there is a way around this by changing a setting, I forget the details). However!, you can use GIMP to make the texture. (EDIT: or follow the advice in the OP's answer regarding channel re-routing)

Here's the final result you should have by following the steps outlined below.

enter image description here

Start by using the CheckerBoard filter

enter image description here

Then try and follow what I have done in the following .gif animation. (I did try to go slowly but LiceCap removes frames so it ends up looking like it's in fast-forward. :( Too many print-screens, creating, pasting, cropping and saving images becomes stressful.)

Step 1) Copy the checkerBoard image

Step 2) Add an Alpha Channel

Step 3) Add a Layer Mask

Step 4) Make the Layer Mask editable

Step 5) Paste the copied check texture.

Step 6) Anchor the new layer so it drops into the Alpha channel

Step 7) Save the image as a .png or any other format that supports an alpha channel.

enter image description here

Here are the relevant Material and Texture settings that can be used for Alpha Masks.

In the Material, activate Transparency and set the type to Mask(the other 2 are showing artifacts) then set the Alpha value to 0.0.

enter image description here

In the Texture Settings, activate the Alpha channel and leave it set to 1.0. Set the Mapping Coordinates to Generated. This seems to be the only stable one since the curve doesn't seem to be UV-Mappable while it is still a curve.

enter image description here

When you move the objects around, the dotted line will become stretched or squashed. The only way I can think of to deal with this is to animate the Texture's Mapping->Size parameters to compensate for the distortion. You can insert Keyframes for the numerical input fields by hovering over them and pressing i. The field will then become colored to show it's been key-framed.

Also, to keep the dotted lines the same width, in GIMP, be sure to end the checker pattern with the opposite color that each row started with. The crop tool works fine for this. I left this mistake in so you can see the result without having to find out the annoying way.

enter image description here

On a side note:Here is a printScreen of the Texture node area mentioned earlier since this is one of those more hidden features that can be useful to people. This area can be used to make custom procedural textures that are also accessible in Texture Paint and Sculpt modes.

enter image description here

$\endgroup$
1
  • $\begingroup$ Oh wow! that works great! Thanks for the wonderful help! $\endgroup$ Dec 19, 2014 at 1:01
2
$\begingroup$

Okay, so I had some people ask me how I did it with blender internal. I used the same method as cegaton, but with a bit of a twist. I wont go into detail about how I got the curve to hook onto the objects, but you can find that HERE: Rig a rope spanning two objects
So after I got the curve spanning the two objects, I went into the curve settings and turned up the bevel. Then I assigned the curve a material, and a texture. I went into the node editor (you can use the node editor in internal) and in the texture portion of the node editor, added in a pattern->Checker node, and connected it to the output node. Then I went to the material portion of the node editor, added an input->texture node, and selected the texture of my checkers. Then I hooked up the Color output of the texture node to the Color AND alpha input. Then I went to the Material SETTINGS and under "Render Pipeline Options" enabled transparency.

$\endgroup$
1
  • $\begingroup$ Oh good idea about using nodes to re-route the color to alpha. I didn't consider that. I should edit my answer since I gave the impression the checker pattern wouldn't work. Thanks for the update. $\endgroup$ Dec 19, 2014 at 1:48

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.