Itoo Software Forum

Author Topic: scale along path  (Read 1360 times)

eqko

  • Jr. Member
  • **
  • Posts: 56
scale along path
« on: March 15, 2016, 11:54:16 AM »
I read a thread from 2013 where it wasn't possible.

Is it currently possible to have a segment scale smaller along the path.
so lets say the 1st segment at the start is 100% and the one on the end is 50% gradually getting smaller along the path.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1608
Re: scale along path
« Reply #1 on: March 15, 2016, 01:02:34 PM »
Hi,

This is now possible using Expressions. RailClone has a function called XSplinePosition that returns the segments position along the spline. 0.0 represents a segment at the start of the spline and 1.0 a segment at the end. Using this we can control the scale of an object based on it's current position in the array. To do that:

- Wire the Segment to a Transform operator.
- Right click on the Transform operator and export the Z, Y and Z Fixed Scale parameters, or a whichever you wish to control.
- Create two new Numeric nodes, call the first Scale Start and the second Scale End.
- Wire them to a new Arithmetic node and set the operation to Subtract. This will give you the total amount the segments changes between the start and end of the spline.
- Create a second Arithmetic note and wire Scale Start to the first input. Wire the Arithmetic node created in the previous step to the second input.

- Change the mode of the new Arithmetic node to Expression, click Edit Expression and enter

Input1-(XSplinePosition*Input2)

Where Input1 is the starting scale and and Input2 is the total scale change between the start and end of the spline.
- Wire the arithmetic node to the Transform operator's scale inputs. The final graph will look like this:


I've also attached a file with this example so you can try it out. If you'd like to know more about expressions, parameters and attributes then this chapter of the Next Steps with RailClone guide can be useful.  I hope that helps, please let me know if you have any further questions.

Many Thanks!

Paul
Paul Roberts
iToo Software

eqko

  • Jr. Member
  • **
  • Posts: 56
Re: scale along path
« Reply #2 on: March 15, 2016, 01:57:02 PM »
thanks for the fast reply, works like a charm !

RC2463

  • Newbie
  • *
  • Posts: 2
Re: scale along path
« Reply #3 on: February 06, 2018, 10:21:00 AM »
Hey,

Is there anyway to add 3rd input to control the mid scale of the spline object? Because now it goes from Scale Input1 to Input2. but is there anyway to have it Input1 to Input2 to Input3.

I got reply from Itoo if anyone needs in the future:

""... is there any way to add 3rd input to control the mid scale of the spline object?"

By adding a Conditional Operator (optionally by adding the condition directly in the Arithmetic Operator Expression) you can "split" it and add a third value in the middle based on the same principals. To "remap" the spline position (XSplinePosition values) on these parts, expressions should be adapted in the following way:

return Input1-((XSplinePosition*2)*Input2); for the first part

return Input1-((XSplinePosition-0.5)*2*Input2); for the second part"


Bests
« Last Edit: February 06, 2018, 11:04:39 AM by RC2463 »