Home Technical Talk

3ds Max: How to create UVs that are the length of the distance between the pivot and vertices

polycounter lvl 8
Offline / Send Message
comomomo polycounter lvl 8
Hi all! I'm using UVs right now in my Unity shaders to interpolate a gradient. So a plane which is black at the bottom 0,0 , 0,1 would be white by the time the UVs reach 1,0 , 1,1 if that makes sense. I'm using this effect largely in a linear way but today I started working on a model I realized I'd like to have the UVs of radiating out from the center. In shadercode this is a rather simple maneuver: for each vertex, set the UV coordinate to be the distance between the vertex and the pivot (or center). In Max I'm just lost. 

I've tried making a Data Channel modifier which takes the vertex output and then turns the vector into a float by using its length but the length can go negative so it looks more like this...


Does anyone have good ideas for how to deal with this? I almost manually unwrapped this model x...x 

Max's creation graph doesn't make sense to me either (I dont understand how loops are supposed to work in the system? for example it seems relatively simple to iterate through every vertex and determine its length but I cant find anything that would enable me to do that.)

Thanks for reading! 

Replies

  • Swordslayer
    Offline / Send Message
    Swordslayer interpolator
    You are close :) The Point3 Length gives you a value that's out of the 0..1 UV bounds you want, you have to normalize it first to fit into that range. After that, multiply the normalized vector length by a custom vector, for example [1,0,0] if you want to apply the gradient in x direction. Then save it to mapchannel of your choice in the vertex output:



    You can also add a Curve operator right after Normalize to further tweak the values range:


  • comomomo
    Offline / Send Message
    comomomo polycounter lvl 8
    That's perfect!!! Thank you so much!! (the gif is such a great touch)

Sign In or Register to comment.