Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

Xforming a texture to sweep in maxscript
show user profile  3joez
I'm facing this task:

I have a lot of splines with different lenghts(with a sweep modifier on them and generate mapping on).

I have one texture for all of them.

I have to uvxform every piece in order to fit correctly the texture repetition.

Can you suggest a way to do it via script?


Practically and in other words, say the texture is 2048x256.

Say I need to repeat it horizontally in a segment which is 10 meters long and then adapt it so it has the same aspect on a segment which is 1 centimenter long.
Manually, I'd go with uvwxform modifier and in every " u tile" spinner, I'd be changing it's value.

Edit: The effect would exactly be the same of using real world map size (but of course I can't use it, for the sake of this specific task)

read 403 times
7/1/2014 3:30:37 PM (last edit: 7/1/2014 4:24:39 PM)
show user profile  Dub.
You can get the length of the spline with this:

splineLength = curveLength yourSpline curveIndex

Curve index is the index of the spline you are interested in - a single spline shape can have multiple "curves" in it - this index ensures you are getting the length of the right one.

yourSpline is obviously the splineshape object you are talking about.

With the length information, you can just calculate an appropriate tiling number and apply it to the tiling attributes of the spline UVs.


read 364 times
7/3/2014 4:25:54 AM (last edit: 7/3/2014 4:25:54 AM)
show user profile  3joez
Done. Thanks Dub!

read 355 times
7/3/2014 8:21:52 AM (last edit: 7/3/2014 8:21:52 AM)
#Maxforums IRC
Open chat window