Itoo Software Forum

Author Topic: growing numbers  (Read 1534 times)

lukx

  • Full Member
  • ***
  • Posts: 118
    • lukxCGI
growing numbers
« on: March 24, 2014, 02:39:47 PM »
Is there anyway to create changing (growing) numbers :
something like this :

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1593
Re: growing numbers
« Reply #1 on: March 24, 2014, 04:41:14 PM »
Hi,

Thanks for the interesting question  :)

There are a couple of ways this could be done but they both essentially convert the current segment index along the path into a count that can be used to select either a geometry object or a texture.

To create counting numbers using geometry.



- Create nine number meshes from 0 - 9.
- Wire these to a Selector node in RailClone and export the index.
- The next steps depend on how large the number is you want to create but let's assume it's three digits. We need to duplicate the selector so that there's one for each digit.
- Connect the 3 Selector nodes to a Compose operator and wire to the default (or evenly) input.
- Create a new Expression operator and wire it to the selector operator that will return the 1s. Open the expression editor.
- For a 3 digit number we need to divide the segment index by 1,10, and 100 to ascertain the numbers required to reconstruct the number. So for the first selector for example it's pretty simple we can just use SegmentXCounter on it's own. This will return xx0,xx1,xx2,xx3 ..... and keep cycling.
- to find out the next number, in a new expression operator divide SegmentXCounter by 10. To ensure it returns an Integer use the Ceiling function. I'm using ceiling rather than floor to compensate for the fact that all the indexes start at 1 not 0. The expression would therefore read:

ceil(SegmentXCounter/10)

-Wire this to the second Selector
- Finally do this same thing for the 100s: ceil(SegmentXCounter/100). Wire this to the first selector.

This should give you geometry that counts up as the segments increase. If you want to start at a different number just add an amount to the equation, e.g. ceil((SegmentXCounter+400)/100)

To create counting numbers using texture.



- Create an object that has 3 material IDs (1 to 3), one for each number. UVW map the object so that each ID fits a single number map. Add this to a RailClone object
- Create a multi-sub object material with ten slots, each has a bitmap with a number from 0 - 9
- Create 3 material operators each one targeting one of the 3 ids created in the first step. Wire them in sequence and attach the segment. For each material node export the From and To values
- Next we'll use exactly the same expressions as the previous example but this time wire them to the relevant material node's From To input slots. The finished style will look something like this:



I hope that helps,  I've attached a file that demonstrates how both these could be achieved.

Many thanks,

Paul
« Last Edit: March 24, 2014, 04:47:13 PM by Paul Roberts »
Paul Roberts
iToo Software

lukx

  • Full Member
  • ***
  • Posts: 118
    • lukxCGI
Re: growing numbers
« Reply #2 on: March 24, 2014, 04:48:30 PM »
AWESOME Paul ! You saved my life :)

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1593
Re: growing numbers
« Reply #3 on: March 24, 2014, 04:58:13 PM »
No problem. Glad I could help  :D
Paul Roberts
iToo Software