Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Get texture Uaxis, Vaxis, translation and scaling of a Face
  RSS 2.0 ATOM  

Get texture Uaxis, Vaxis, translation and scaling of a Face
Rate this thread
 
64101
 
Permlink of this thread  
avatar
  • Location: Columbus, Ohio
  • Total Posts: 434
  • Joined: 01 March 2008 04:43 AM

I’m working on a script that needs to get the axis of a Face’s U/V as two normalized Point3. I know this has to be a simple thing to solve… but my lack of formal training in geometric formulas is coming back to haunt me! I’ve Googled a hundred different things that I have thought would lead me in the right direction; I can’t seem to find anything that is both relevant and makes sense to my naturally non-mathematical mind.

Going further… how would you determine the 4th variable and the “scaling” of the UV for a face to fit the following definition?

U/V Axis
The u-axis and v-axis are the texture specific axes. They hold their own designations as they are independent of the true x-axis and y-axis, but it’s easier to think of them in terms of x and y. The u-axis represents the x-axis and the v-axis represents the y-axis. These two code lines work together to define how the texture is displayed upon a face.

"uaxis" "[1 0 0 0] 0.25"
"vaxis" "[0 1 0 0] 0.25"

u/v axis ([x y z dec] dec)

The x, y, and z are decimal values representing that axis. The following value is the translation and the last decimal is the total scaling.
The values for the x y z set represent the amount of the texture to be shown in that axis. They modify how much of the texture is shown within the normal space the texture would occupy on the face. A value of one means one repetition in the normal space, a value of two would mean two repetitions in the normal space. The key is that this only applies to one axis of the texture and is applied relative to true x, y, and z axes. That means that it is possible to set the texture to appear along an axis the plane doesn’t exist in. With a flat plane in the x-axis and the y-axis definitions are only needed for those axes as any definition in the z-axis has no surface to appear on. The code sample shows how this would be generated by Hammer. The texture’s x-axis (the u-axis) is displayed in the real x-axis and the texture’s y-axis (v-axis) is displayed in the real y-axis. Which of the x, y, and z axes are showing the axes of the texture depends entirely upon the faces orientation. Negative values will flip textures and Hammer will generate errors about textures shown in a plane the surface does not occupy. The second to last value is the simple translation of the textures origin within that axis; this value is actually a decimal though Hammer will round it up when displaying Hammer will still save the correct decimal value. The last decimal is the overall scaling of the entire axis including what is defined in the x y z group.

Any help from the Code Gods would, like always, be greatly appreciated! :)



______________________________
Shawn Olson’s Creative Arts
Developer of the Wall Worm Model Tools for Source
And my Favorite Unsung Plugin: Convexity for Level Design

Max 4/Gmax, 2008 - 2013
Mudbox 2009-2011
Win 7 x64 (x4)
Geforce 480x2 | Geforce 275x1 | ATI Radeon HD 3200 | Intel Generic chip
8GB | 12GB | 4GB | 4GB
Intel Quad 6700 | i7 930 | Athlon QL-65 | Intel Quad 6700

Replies: 0
avatar

I’ve been struggling with solving this problem for weeks. Anyone have a minute to shed light on the math/formulas/functions for solving this? I’ve been trying to assimilate some trigonometry and matrix math… but it’s slow going… you know… the same problem of teaching an old dog new tricks.



______________________________
Shawn Olson’s Creative Arts
Developer of the Wall Worm Model Tools for Source
And my Favorite Unsung Plugin: Convexity for Level Design

Max 4/Gmax, 2008 - 2013
Mudbox 2009-2011
Win 7 x64 (x4)
Geforce 480x2 | Geforce 275x1 | ATI Radeon HD 3200 | Intel Generic chip
8GB | 12GB | 4GB | 4GB
Intel Quad 6700 | i7 930 | Athlon QL-65 | Intel Quad 6700

Replies: 0