Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: tonyinseattle on October 06, 2021, 03:23:13 AM

Title: Any way to rotate UVWs per segment using Arnold?
Post by: tonyinseattle on October 06, 2021, 03:23:13 AM
Hey, everyone...

I realize that when using Arnold and UVW XForm and Box Mapping, you often need to turn off "Use Instancing Engine." I guess there's some limitation in Arnold that prevents that tool from working? (Is there any chance this will change?)

But, is there a way for me to fake it by exporting parameters or any other way?

Let's say I have nested generators... I have an array that puts 16 boxes in a grid. (Let's say, for the sake of argument, I have to do it this way because I want to randomize some empty spaces in that grid.) Then, I have a line generator that runs those arrays along a spine. I turn on Box Mapping and turn off Use Instancing Engine (bc of Arnold) and I apply a simple checkerboard pattern. Then I apply a transform operator before the array generator because I want the grids to be randomly rotated along the spline.

I would like to accomplish 2 things:

1. Is it possible to get the checkerboard to line up exactly with each array "segment" rather than be mapped the same across all of them?
2. Is it possible to line the checkboards up precisely with the four corners of each array "segment" so that you don't get half-checkers at the edges.

All of this using Arnold? Or am I out of luck?

Please see the attached images as well as the file. Thanks!

Tony
Title: Re: Any way to rotate UVWs per segment using Arnold?
Post by: Paul Roberts on October 06, 2021, 01:04:55 PM
Thanks for the question.

This particular usage isn't really an Arnold limitation. The box mapping feature was intended to create seamless UVW mapping along the length of the final spline, in this example, we're trying to do something a little different.

That said, I've attached a solution that appears to be working OK. To achieve it I've had to take into consideration that the UVW Modifier rotates and offsets from the start of the spline, not per object. Knowing that we can use a bit of trigonometry to try and offset and rotate the UVs to reverse their new orientation and position along the spline.

In any case, it might be easier to UV map the geometry before adding it to RailCLone for this kind of thing, alternatively, you could create the nested geometry as a separate RailClone object and then import it using a Segment node. Since you need to disable instancing anyway to use UVs, there would be no performance hit when using this technique and actually you might find it's more efficient because you could leave instancing enabled for the second RC object.  I've added a second file to illustrate this approach.

I hope that helps,
Paul
Title: Re: Any way to rotate UVWs per segment using Arnold?
Post by: tonyinseattle on October 06, 2021, 10:21:59 PM
Hey, thank you tons for both of these! Of course, I like the "easy" version. The trigonometry version takes me back to high school! The one question I have is why does the Y Adaptive macro need to be included as part of this? Is this to fix errant blocks showing up beyond the end of the X and Y splines? Or for another reason?
Title: Re: Any way to rotate UVWs per segment using Arnold?
Post by: Paul Roberts on October 07, 2021, 09:15:25 AM
That's it exactly - I just added adaptive behaviour to both axes to stop random blocks appearing outside of the array.

Paul