Hi Folks,
I have a text, in a text top, how can I have part of the text in one color e part in another color?
I thought about using 2 text and a composition, but as one of the text is a variable from a DAT I could not place in the right place
Best Rergards
Woof.
Okay… where to start.
In the attached TOX there are two different approaches. It’s hard to know what’s going to be “right” for you since there are a lot of different ways you might tackle this problem.
Here there are two general approaches. In one we use two different text TOPs and a bit of python to help figure out the width of the respective pieces of text. This approach is the most straightforward but uses twice the texture space… since we’re using two different text TOPs. Depending on what you’re doing there are some places here that this could be optimized, but without knowing a little more I think it makes better sense to leave this as it stands so you can see what’s happening.
In the second example we’ve jumped off the deep end… Not exactly, but the idea here is to try and achieve the same effect using only a single text TOP. Here we can use a ramp TOP to help with the color problem. Here we have a bit more python and scripting to get there. Truth be told, we could probably just write a little helper function instead of using all of the eval DATs, but in the end it gets us to the same place. The big idea here is that we’re finding the width of the first string and using that to help determine where the boundaries of our color difference exist.
A little bit of testing here, and it looks like v2 is actually a hair faster… maybe 0.5 ms. Both weigh in about 2.5-3.0 ms… so this isn’t the fastest operation, but hopefully it’s not something you’re updating every frame.
Anyhoo, at least there are two examples here to get you started thinking.\
base_two_colors_for_text.tox (3.15 KB)
Mathew
Better impossible, very well detailed. Thanks for the resouce … problem solved
Tks
Marcelo