Notifications
Clear all
[Closed] How do you get UVW Coordinates offset by Texture Coordinates
Aug 02, 2012 4:52 pm
Im sure this has had to have been answered somewhere already
but I cannot find it.
How do you accurately combine UVW coordinate data with a Bitmaps coordinate data? In other words, what if I want to take a TVert and get the UVW of that TVert such that it is accounting for both the current TVert position but is offset by the coordinates of a texture applied to it?
This script should demonstrate the situation a little more:
clearListener()
/* Create a simple plane and convert it to an Editable Poly */
MyObj = Plane name:"MyPlaneTest" width:256 length:256 lengtsegs:1 widthsegs:1
convertToPoly MyObj
/* Apply a Planar UVW Map so we can animate UVW Data to more easily demonstrate the values */
PlanarMod = Uvwmap name:"Planar UVW" length:256 width:256 utile:1 vtile:1 wtile:1
addmodifier MyObj PlanarMod
/* Make a texture and material to use for demonstration */
myTex = Checker name:"MyTexWithCoords"
myMat = StandardMaterial name:"MyMaterialWithBitmap" diffuseMap:myTex
/* Show the tex in the viewport... if you hit play you should see the tex move. */
showTextureMap myMat myTex on
/* Assign the material to the Object */
MyObj.mat = myMat
with animate on (
/* Animate the U offset of the tex (myTex) coordinates */
at time 0 myTex.Coordinates.U_Offset = 0
at time 10 myTex.Coordinates.U_Offset = 0
at time 100 myTex.Coordinates.U_Offset = 50
/* Animate the W_Angle of the tex (myTex) coordinates */
at time 0 myTex.Coordinates.W_Angle = 0
at time 10 myTex.Coordinates.W_Angle = 0
at time 100 myTex.Coordinates.W_Angle = 180
/* Animate the rotation of the UVW Gizmo */
at time 0 PlanarMod.Gizmo.rotation = (quat 0 0 -1 0)
at time 100 PlanarMod.Gizmo.rotation = (quat 0 0 0 1)
)
function printMyUVWData obj mapChannel:1 faceIndex:1 frame:1= (
sliderTime = frame
format "
#################
UVW Data for Channel % on Face % at Frame %
" mapChannel faceIndex frame
at time frame (
format "The Texture Coords
"
format "UV Transform: %
" obj.mat.diffuseMap.coords.UVTransform
format "U Offset: %
" obj.mat.diffuseMap.coords.U_Offset
format "W_Angle: %
" obj.mat.diffuseMap.coords.W_Angle
tvertFace = polyop.getMapFace obj mapChannel faceIndex
format "Texture Vertex Info:
"
vi =1
for i in tvertFace do (
theMapVert = (polyop.getMapVert obj mapChannel i)
format "% - TV% : %
" vi i theMapVert
vi+=1
)
)
)
for f=0 to 100 do (
printMyUVWData MyObj frame:f
)
What I want to do is get the texture coordinates of a polygon with the UVW coordinates and Texture Coordinates collapsed into a single set of coordinates.