Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: Alex.S on December 17, 2016, 01:19:32 PM

Title: Continuous UVW?
Post by: Alex.S on December 17, 2016, 01:19:32 PM
I can't really see a way to do this accurately.

I have separate start and end objects and then a default segment in the middle, and I'd like to have continuous UVW to map decals on my wall. I've tried setting up uvw offsets etc but I can't seem to get it work, mostly as I can't tell how many normal segments there have been from the end point.

The decal spans half of a segment, and needs to continue over to the next one. The mapping controls in the segments are very limited and can't be put into a modifier, so I can't create a uvw of say 0.5 length wise per segment. I just have to modify what is already there.

I'm playing around a bit with arithmetic for offsetting the uvw and I've kind of got it working. The issue is I want to limit the mapping to the spline mat id, and I can't see anyway to do that.

It'd be nice to have the option to have continuous uvw generated, so instead of repeating the uvw it adds it onto the end of the previous segment (somewhat similar to loft mapping)

Title: Re: Continuous UVW?
Post by: iToo on December 18, 2016, 09:14:46 AM
Hi, this feature is available from Segment->Deform->Mapping (http://url=http://docs.itoosoft.com/display/RAILCLONE/Segments#Segments-mappingMapping).
Once Segment is mapped, you can modify it using a UVW XForm node, but by default it creates a continuous mapping along the object.

Please note we have found recently a bug with Mapping, when segment is scaled by an operator (as Transform). We are working to fix this issue.
Title: Re: Continuous UVW?
Post by: Alex.S on December 18, 2016, 06:10:02 PM
Can I find the length of the section with a certain spline ID?
Title: Re: Continuous UVW?
Post by: Alex.S on December 18, 2016, 11:22:46 PM
The way I see it I would need to be able to find out the percentage of the spline that this material id started at, and the percentage of the spline that this material section takes in total. With this information I could modify the mapping correctly. But that's not possible atm - i think?
Title: Re: Continuous UVW?
Post by: Alex.S on December 19, 2016, 12:18:04 PM
But even then there are some issues with the box mapping, I'm getting strange gaps inbetween segments...

(I set the box mapping to the size of the object so it should be one tile per object).
Title: Re: Continuous UVW?
Post by: Paul Roberts on December 19, 2016, 02:27:35 PM
Hi,

We'll look into the UVW issues. As we mentioned there are some issues at present, especially with getting seamless mapping across default/end/evenly segments. In the meantime maybe the attached file will helps. It assumes your pattern spans two segments and should work with Start and End segments too.

To create this the Start segment's UVW map is adjusted using an UVW XForm modifier so that it displays only the U space 0 to 0.5

The default then alternates between segments that use U 0.5 - 0 and then 0 - 0.5

And finally the end segment, which is the tricky one, uses a few equations to work out how many default segment's there were on the spline. To do this first we use this expression

(XSplineLength-Input1-Input2)/Input3


(XSplineLength-Input1-Input2) finds the length of the section minus the start and end inputs, this is then divided by the size of the Default segment (Input3)

Default Adaptive mode has a percentage value that decides when a new segment should be added. To account for this in our equation I've used this:

if(Input1-floor(Input1)>Input2/100,floor(Input1),ceil(Input1))

It is testing to see if the fraction remaining from the results of the first equation exceed the Adaptive value. If the answer is yes it returns the integer below first value, otherwise it returns the integer above.

Finally this value is used with a modulo function to determine if the number of default segments is odd or even and selects the correct segment for the end accordingly.

if(mod(Input1,2)=1,1,2)

(http://i.imgur.com/1l5oxb8.png)

It's a bit complex but it works!

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

Many Thanks,

Paul
Title: Re: Continuous UVW?
Post by: Alex.S on January 09, 2017, 03:17:49 PM
I had segments of the same width and different geometry, and was getting some weird disconnects in certain situations. So in the end I just use segmentXcounter to know how many tiles I've had.
Title: Re: Continuous UVW?
Post by: Alex.S on January 09, 2017, 03:27:08 PM
Hang on, in your example,

> if(Input1 - floor(input1) > Input2/100, floor(input1), ceil(input1))

aren't the return values in the if statement the wrong way round?

edit: yes, that was why I couldn't get your method working in all situations.
Title: Re: Continuous UVW?
Post by: Alex.S on January 10, 2017, 11:32:22 AM
Running into issues when trying to scale the uvw so it only have a complete tile. Each segment (start, end and default) only does a third of a tile and then I increment. I can kinda get around it by having hardcoded values for start, end and default x lengths. But ideally it'd be nice to be able to edit uvws after the RC geometry has been built and then you can scale uvw according to size, segments etc. That's quite a big ask to add I imagine though.

edit: got it working, after resolving a few headaches, and unintended divide by 0 issues..