1
$\begingroup$

I'm relatively new to coding and I'd self-describe myself as an amateur in Blender. I've been working on a project where I can pull long arrays of characters and assign each individual instance to its corresponding color. I want this to be a procedural effect, so any individual can load in anything, and not have to individually change the color of each letter.

I'll insert a photo of the essence of what I'm trying to achieve with B3D geometry nodes: "hello world' text, where each letter corresponds to a different color

I have a general idea of how to set it up. I've created a group that takes a user's input, and extracts the length of the string, so it may be used to create that same amount of instances along a curve. I've realized the instances, so I can access each individual point.

I have a feeling I may need to write a bunch of true/false statements through the bool function, but I'm at a bit of a loss now. Any advice would be much appreciated!

$\endgroup$
3
  • $\begingroup$ please show us what you have done so far (included blend file would be best) $\endgroup$
    – Chris
    Commented Jul 31, 2022 at 3:21
  • $\begingroup$ I'm gonna try quellenform's suggestion, and then send the .blend if I can't manage it $\endgroup$
    – entr0pic
    Commented Aug 1, 2022 at 1:07
  • $\begingroup$ quellenform's suggestion worked out perfectly! $\endgroup$
    – entr0pic
    Commented Aug 1, 2022 at 14:48

1 Answer 1

2
$\begingroup$

If you want to assign different colors to the letters, but you want the same letters to have the same color (as shown in your image), then you would have to somehow generate a unique value for these letters.

However, with instances, there are no processable values available here, so you might be tempted to create this unique value based on the individual splines.

This is obvious, but it does not work. Because if you convert the instances to curves with Realize Instances, you get separate curves (for example, an "O" has two curves).

For example, you could use the length of the splines to generate these values, and accumulate them with the index of the instance as a group.

But this doesn't work, because all values you store with Capture Attribute or Store Named Attribute in splines are not preserved after using Fill Curve.

So here is a possible solution:

enter image description here

  1. You could capture the size of the faces with Face Area after converting the curves to a mesh with Fill Curve and Realize Instances.
  2. If you then accumulate these values with Accumulate Field and grouped by the index of the instances, you get a unique value per type of a letter.
  3. This must be increased accordingly (depending on the scaling of the letters) so that it can be used as a unique integer value for the random generation of an ID in combination with the node Random Value. This node then generates a random value between $0-1$, which is unique per type of letter.
  4. This unique value, which is stored with Store Named Attribute in the domain Face, can then be further processed in the shader (colors should basically be processed there) by reading this value with the node Attribute.


(Blender 3.2)

$\endgroup$
3
  • 1
    $\begingroup$ hehe.. I tried [number of vertices per mesh island] .. but there are duplicates... $\endgroup$
    – Robin Betts
    Commented Jul 31, 2022 at 11:13
  • $\begingroup$ I'll give that a go asap! will follow up asap $\endgroup$
    – entr0pic
    Commented Aug 1, 2022 at 1:06
  • $\begingroup$ That worked perfectly, thank you for the insight! I didn't even consider using the face area data to help me out. This was very helpful :) $\endgroup$
    – entr0pic
    Commented Aug 1, 2022 at 14:47

You must log in to answer this question.

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