Itoo Software Forum

Author Topic: Material from Spline ID ?  (Read 3181 times)

Guillermo Leal

  • Newbie
  • *
  • Posts: 20
Material from Spline ID ?
« on: July 17, 2015, 02:06:34 AM »
i have an stadium in which i need certain chairs to be an specific color, i would like to drive the color from the spline id's. is it possible?

thanks,
Guillermo Leal

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Material from Spline ID ?
« Reply #1 on: July 17, 2015, 09:50:54 AM »
Hi Guillermo,

This can be done in a couple of ways. You could change the Material IDs of a single chair to the ID of the spline section by wiring an Arithmetic operator with the expression XSplineMatID to a Material operator''s From and To inputs.



Alternatively if you'd like different geometry as well as materials for each material ID you could create a number of different chairs and attach them to a Selector operator with the mode set to Spline Mat.ID



Either approach will work. You also have the ability to limit an entire generator using material IDs if necessary - you can read more about that in our online documentation.

I hope that helps, please let me know if you have any further questions.

Many thanks,

Paul
Paul Roberts
iToo Software

Guillermo Leal

  • Newbie
  • *
  • Posts: 20
Re: Material from Spline ID ?
« Reply #2 on: July 17, 2015, 04:24:25 PM »
Paul,

thanks for the replay, this works with an object that has a single id but how would you do this on an object with multiple ids, for example the seat stand 04 f preset?

Guillermo Leal.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Material from Spline ID ?
« Reply #3 on: July 17, 2015, 05:01:26 PM »
Hi Guillermo,

The material operator allow you to choose which Material ID you wish to replace, so in the case of the 04 f preset we need to enter a value of 6 as this is the ID used for the seat colour.



You can then either change the IDs on the splines as in the previous example, so that they use the correct Material IDs from the Multi-Sub object material. Alternatively you could use IF statements to map the spline's IDs to a different number. An example of an expression that map Spline IDs 1 - 3, to material IDs 6-8 would look like this:

Code: [Select]
if(XSplineMatID=1,6,
if(XSplineMatID=2,7,
if(XSplineMatID=3,8,1)))



I've attached this example below. I hope that helps, please let me know if you need anything else.

Many thanks,

Paul
Paul Roberts
iToo Software

Guillermo Leal

  • Newbie
  • *
  • Posts: 20
Re: Material from Spline ID ?
« Reply #4 on: July 17, 2015, 05:52:27 PM »
Excellent Paul, thanks.

wish there were more tutorials/info on expressions.

Guillermo Leal.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Material from Spline ID ?
« Reply #5 on: July 17, 2015, 06:01:43 PM »
Hi Guillermo,

No Problem, Glad it helped out. We have plans to release an Expressions primer in the the near future that will hopefully make this all clearer.

Many thanks,

Paul
Paul Roberts
iToo Software