6
$\begingroup$

I'm doing text animation in geometric nodes. I'm trying to animate the letters around their center, but all the transforms are only applied relative to the bottom left corner. Is it possible to do transformations from the center of the letter? Blender 3.0 enter image description here

I'm trying to make a random rotation of each letter from the center point enter image description here

$\endgroup$
2
  • $\begingroup$ Do you spawn the text inside the geometry node tree using String to Curves node? We need more details to help $\endgroup$ Jan 20, 2022 at 16:31
  • $\begingroup$ You need to pivot on the bounding box center rather than the origin. $\endgroup$ Jan 20, 2022 at 17:56

3 Answers 3

11
$\begingroup$

Blender 3.0

  • move letters apart,
  • use Bounding Box node to get a cube for each letter,
  • remove all but top face from each cube,
  • for each instance find the nearest face coming from the Bounding Box (that's why letters have to be moved apart, so the right face is matched),
  • take the position of that face, which is the center of the bounding box,
  • rotate around that center,
  • move letters back together.

$\endgroup$
8
  • 2
    $\begingroup$ It looks like it's working as it should. I wouldn't have thought of that myself, thank you! $\endgroup$
    – Kogoduos
    Jan 20, 2022 at 21:22
  • $\begingroup$ I'm loving this method, and I can't see anything wrong with its logic. But I'm intermittently getting 'misses' on the pivot-point .. some chars rotating around the wrong pivots. Dependent on string. Varies with different separation methods. It's looking like a bug in 'Nearest'? Even if my separation is huge, it persists. Late here, so will look again tomorrow. Can you tell me your Blender version? Me: 2021-12-03 3.0, Linux. $\endgroup$
    – Robin Betts
    Jan 20, 2022 at 22:35
  • $\begingroup$ @RobinBetts 2021-12-02 18:35 f1cca3055776 Windows. If you get a wrong face, then perhaps the Delete Geometry deletes wrong faces? Maybe you spawn your text aligned with a different axis? I'd like to see your setup and test if I can reproduce your problem on my end. $\endgroup$ Jan 21, 2022 at 10:16
  • 1
    $\begingroup$ @RobinBetts I debugged it: find the setting when the rotation is wrong, connect the Realize Instances after Bounding Box to the Group Output, and you can see there's no face. This is probably due to floating point quirkiness... So the solution is to add Math > Greater Than 0.001 node between the Distance and Delete Geometry. $\endgroup$ Jan 21, 2022 at 15:46
  • 1
    $\begingroup$ @RobinBetts in general comparing floats without a threshold is a dangerous game... Though lately I try to investigate when exactly the threshold is needed... For example, according to the IEE 754 standard, the result of subtracting two identical floats must be 0. However, C++ is one of the languages that doesn't comply with the IEE 754 standard fully (depends on compiler flags AFAIK). Still, in this case the problem comes from the normals sometimes not being exactly 0;0;1: You can see that if you apply the geomod for b.box and print(*(p.normal.z for p in C.active_object.data.polygons)). $\endgroup$ Jan 21, 2022 at 16:11
6
$\begingroup$

If you're prepared to use a recent Blender 3.1a, a couple of new nodes make this method possible. You can type in your text as a single object.. it will be interpreted as a Mesh by GN.

Then, this set of nodes will spin each mesh island in Y, around its mean X, by the input Angle:

enter image description here

There might be some edge-cases requiring more nodes, for example where characters are more than one island, off-center .. but something based on this may do the trick.

enter image description here

Blender 3.1a, at answer's date.

$\endgroup$
5
  • $\begingroup$ Thanks for the answer, but for now I need to deal with the 3.0 version :) $\endgroup$
    – Kogoduos
    Jan 20, 2022 at 21:10
  • $\begingroup$ @Kogoduos Okydoky... I don't think the 3.1 release is too far off. $\endgroup$
    – Robin Betts
    Jan 20, 2022 at 21:11
  • 1
    $\begingroup$ if there is no convenient way in 3.0, then I will take your way $\endgroup$
    – Kogoduos
    Jan 20, 2022 at 21:14
  • 1
    $\begingroup$ Wow these new utility nodes are awesome ! $\endgroup$
    – Gorgious
    Jan 21, 2022 at 6:45
  • 1
    $\begingroup$ Seeing your nice animation and great answer i thought you wrote "Instagram" :D :D :D $\endgroup$
    – Chris
    Mar 9, 2022 at 14:02
1
$\begingroup$

Because you didn't post the node tree I can only give you a generic answer. It should be enough to point you in the right direction.

The reason their Origins are bottom left

By default instances use the origin of the instanced geometry. Blender can't guess where you wish the origins for the letters were, it can only work with the coordinates you're actually passing to it.

If your text has a bottom left origin because the original text mesh was created using a Left, Top Baseline alignment that's how the instances will be spawned.

Solution 1: Text-specific method

Create the text using a Center, Middle alignment. This method will center the letter relative to the text's line-height. It'll make the origin of the various bits of text consistent, but it won't return the real, geometry origin.

enter image description here

Depending on what you're doing you'll want to use this method.

Solution 2: Generic geometry method

To set the text on its real geometric origin you'll need to figure out its width and height, then halve it by 2 an multiply it by -1 to offset it in the correct direction.

The old way to do this was to perform calculations on the Min/Max of a Bounding Box. Thanks to the new Attribute Statistic node, you can simply grab its Mean point.

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ In Solution 2 you realize instances, and then look for the mean of all vertices - it will give you the center for a single letter string, but not individual centers for individual letters (and how could it move multiple letters so the origins are in their means, if there's only one origin since the instances are realized?) $\endgroup$ Jan 20, 2022 at 19:22
  • $\begingroup$ Thanks for the detailed answer. I've added a node tree. The first solution is not suitable, and I tried use the second for my task, but didn't work $\endgroup$
    – Kogoduos
    Jan 20, 2022 at 20:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .