Itoo Software Forum

Author Topic: Last segment of chain  (Read 712 times)

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Last segment of chain
« on: November 12, 2022, 04:41:10 PM »
Maybe simple but i don know how to do it :)
I have simple chain. And i want to change last element of array depending on number of default segments
Best
Michal

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #1 on: November 12, 2022, 05:02:01 PM »
I'm on the phone so can't give you full solution, but you could use segment counter and mod operation do determinate is the current number even or odd.
Return
Mod(sxegmencounter,2)+1;

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #2 on: November 12, 2022, 05:17:15 PM »
Thx for idea,
Now ill play with it but at first look doesnt work, so probably i am doing sth wrong:)

return mod(SegmentXCounter,2)+1;
« Last Edit: November 12, 2022, 05:27:01 PM by arch3d »

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #3 on: November 12, 2022, 05:42:59 PM »
Ah, yes...
The counter is separated for start/end, default, evenly...
So, I guess you should do everything in default pipeline.

For your workflow:
The easiest way should be to go with dividing spline length with segment length (export x size attribute after transform scale) to determinate final number of segments and then use this in mod operation.
« Last Edit: November 12, 2022, 05:46:07 PM by Dragan »

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #4 on: November 12, 2022, 05:58:02 PM »
ok ill try

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #5 on: November 12, 2022, 07:02:11 PM »
like this?
never use mod before :)

works ni tile mode not every time in adaptive mode what is obvious
« Last Edit: November 12, 2022, 07:14:17 PM by arch3d »

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #6 on: November 12, 2022, 07:10:47 PM »
Yes
Arithmetic expression:
Return
Mod(round(input1),2))+1;


Mod 2 should return either 0 or 1 and +1 is for selector input start hrom 1

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #7 on: November 12, 2022, 07:13:42 PM »
This more or less issues could be solved by rounding/flooring division result

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #8 on: November 12, 2022, 07:15:19 PM »
You could also try evenly workflow. Evenly now has an option for odd, even results

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #9 on: November 12, 2022, 07:21:38 PM »
You could also use division result with some expression to force odd or even and  use it in the count mode for default rule.

Another way using conditional operator multiple by 2 mode...

Could be solved on many ways...

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #10 on: November 12, 2022, 07:43:33 PM »
True, now i see
Thanks!

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #11 on: November 12, 2022, 07:45:46 PM »
Glad to help 😏👍

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #12 on: November 12, 2022, 07:47:47 PM »
I think best is count mode with round modifier :)

arch3d

  • Sr. Member
  • ****
  • Posts: 251
    • arch3d.pl
Re: Last segment of chain
« Reply #13 on: November 12, 2022, 07:52:53 PM »
btw i saw your style with wParallax files
I made it before and i can advise you one thing - copy mutimat and apply *.jpg instead of *.exr.
Keep material with .exr on segments and thick use segment material for style.
You will have preview in viewport and exr as render :)

simple but works
« Last Edit: November 12, 2022, 07:56:28 PM by arch3d »

Dragan

  • Hero Member
  • *****
  • Posts: 1298
Re: Last segment of chain
« Reply #14 on: November 12, 2022, 08:04:00 PM »
 ;D ;D ;D
I did that yesterday!!!
Art from wParallax supported me with all bundles few days ago and I have made new style that has embedded planes with 1k, 3k and jpg for preview. Since many users requested option without curtains I need some time to remap everything. Didn't find any sutable script to copy material and remaping.