Dynamically moving position of text to where a particle is

I have thousands of particles instanced in a geo node,
I want to dynamically position a text where one of those particles is, so I wanna do:
op(‘text3’)…
how do I set the position of the text to wherever I like via code?

and is it possible to even create from scratch the text and position it in the same geo where the particles are all through code? thank you :slight_smile:

so this works to move them:

      opname='t'+str(which)
      op(opname).par.tx=float(pxval)
      op('t'+which).par.ty=float(pyval)
      op('t'+which).par.tz=float(pz)

now I wonder if its possible to actually create them and all dynamically connecting them to geo node etc

Hi @javismiles,

You could create text geometry and use a replicator to create it dynamically. Given the proper context, the created Geo could just follow the particle around by fetching it’s position and referencing it in the Geo’s transform parameters.

Cheers
Markus

@snaut mmm not sure how to do that, what is a replicator? would I create dynamically just the text or also the geo; can I put multiple sop texts in a single geo node? or I need 1 for each? , for performance whats the best way to create a text? with the text Sop node or do you recommend anything else?

Hey @javismiles ,

the attached example is not necessarily pretty but should explain the idea.
In this case I’m creating particles with a Noise TOP and an Instanced point.

I fetch some particle positions using the TOPTo CHOP giving it random uv values as an input.
And that is where the replicator comes in: It creates copies of a template component. Now using expressions in the replicant’s transform parameters, I can fetch the position from the output of the TOPTo CHOP, properly tying the text geometry to the particles. To change the number of text and see the Replicator COMP in action, change the Length parameter of the pattern1 CHOP.

For Text I’m using the Text SOP. If this is performant very much depends on how much text you will want to display.

If you are looking at creating a wordcloud, then a better approach would be using 3D Textures and Instancing a single rectangle who’s material references the Texture Array. This has many benefits as you can display literally 1000s of strings but has shortcomings as well - for example you can’t dynamically change the text easily.

For more examples of the Replicator COMP - make sure to checkout the OPSnippets.

particlesWithText.tox (2.7 KB)

Hope this helps
Best
Markus

1 Like

@snaut wow this is a beautiful and impressive example indeed, loved it, thank you :slight_smile: I dont totally understand yet fully how this replicator thing works but yes I see how it replicates the geo nodes that contain the texts, fascinating; I definitely see that its not a good idea to add so many texts, it won’t make sense, so I think i will just use a few texts in key positions, maybe 5 or 6, so then it should be ok with one geo node for each and adjusting their coordinates dynamically

I liked how you used a single dot as the particle, very interesting, if you compare using a dot sop to using a circle sop, will performance be faster by using just a single dot? Im looking for all the performance speed improvements I can as I wanna be able to include as many thousands of particles as possible in a data viz im creating, thank you :slight_smile:

Hey @javismiles ,

if you are instancing a circle it should not make too much of a difference to a dot. It’s good to use a circle or rectangle if you want to apply textures… You could also use pointsprites and apply textures to that, but these are always square - so not always the right choice.
I would suggest just trying out how many particles work with a circle :slight_smile:

cheers
Markus

1 Like

@snaut thank you very much :slight_smile: