PDA

View Full Version : Extract UVWMap rectangle?!


rsf
09-24-2005, 05:48 PM
Hello!
I'm trying to extract the rectangle from a planar UVWMap modifier but I'm having some trouble with the transformation matrices..they just don't give the data I expect...
Of course I will eventualy understand this...don't know when thought...:-(
The problem is when I transform the UVWmap Gizmo...I use "getModContextTM obj mod" but it doesn't show any rotation or scaling!??
Can someone give me some help?!
Thanks!!

Bobo
09-24-2005, 06:16 PM
Hello!
I'm trying to extract the rectangle from a planar UVWMap modifier but I'm having some trouble with the transformation matrices..they just don't give the data I expect...
Of course I will eventualy understand this...don't know when thought...:-(
The problem is when I transform the UVWmap Gizmo...I use "getModContextTM obj mod" but it doesn't show any rotation or scaling!??
Can someone give me some help?!
Thanks!!


First of all, the UVW Map gizmo has a transformation matrix that is relative to the OBJECT space of the node it is applied to. This means that by default, the gizmo with identity matrix passes through the pivot point of the object and is aligned to its local axes.

Let's say that you have a Box and have applied a UVWMap modifier to it, then moved, rotated AND scaled the gizmo in an arbitrary position/orientation.

To align another object to fit the gizmo exactly, you would have to do the following:

Create a plane with width and length taken from the modifier

p = plane width:$Box01.modifiers[1].width length:$Box01.modifiers[1].length


Then take the TM from the gizmo, transform into the object space by multiplying by the node's TM and assign to the plane's TM - it should match the UV Gizmo perfectly...


p.transform = $Box01.modifiers[1].gizmo.transform * $Box01.transform



Hope this helps...

("The Matrix : Explained" DVD coming soon from CG-Academy! :))

Bobo
09-24-2005, 06:18 PM
Of course, this works with a rectangle, too (as you asked for it)

p = rectangle width:$Box01.modifiers[1].width length:$Box01.modifiers[1].length
p.transform = $Box01.modifiers[1].gizmo.transform * $Box01.transform

Or even better, as a function


fn makeRectangleFromUVWmap theNode theMod =
(
theObj = rectangle width:theMod.width length:theMod.length
theObj.transform = theMod.gizmo.transform * theNode.transform
theObj
)

makeRectangleFromUVWmap $Box01 $Box01.uvw_Mapping

rsf
10-17-2005, 11:31 PM
Hello!
Sorry for the delay but...Thanks a lot!!! :-)

Bobo
10-18-2005, 12:35 AM
Hello!
Sorry for the delay but...Thanks a lot!!! :-)


No problem, glad I could help!

CGTalk Moderation
10-18-2005, 12:35 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.