View Full Version : ObjectOffset Rotation/Transform
thatoneguy 03132009, 05:14 PM I just read the help file and still don't understand what objectoffset transform information is for and when it changes.
I'm writing a library of Nuke export functions and need to write transform key data. I'm looking at another camera exporter and it adds the objectoffsetrot value on top. I can't seem to create a situation where the objectoffset value would seem to be important at the node level.
Is it just for SO data transformations and should the QuatToEuler($.transform.rotation) be sufficient? It seems like the $.transform.rotation takes this into account already. Is this not the case?


thatoneguy
03132009, 05:44 PM
Specifically I'm getting some weird results with target cameras. And aligning an object to a target camera. for example this script doesn't work at all.
Create a target camera and move it around.
a = box()
a.pos = $.pos
a.rotation = $.transform.rotation
The box ends up somewhere else. Even though I can manually type in the values and it works. What gives?
If I do quattoeuler on both they can both have the exact same rotation but if I try to apply the $.transform.rotation to the box it gets all weirded out. Is it rotating around the centerpoint of the target/camera?
magicm
03142009, 05:20 PM
Create a target camera and move it around.
a = box()
a.pos = $.pos
a.rotation = $.transform.rotation
This should properly align the box:
a = box()
a.rotation = inverse $.transform.rotation
a.pos = $.pos
Note that the rotation is performed before translation, the other way around will not work due to the way matrices work.
A simpler method however would be:
a = box transform:$.transform
I can't seem to create a situation where the objectoffset value would seem to be important at the node level.
The objectoffset pos/rot/scale properties contain the offset from the pivot to the node's actual geometry. So if you would select the target camera in your example, and move the camera's pivot using "Affect Pivot Only", the above scripts would not align the box to the camera node, but the pivot (just like it did before, but then the pivot wasn't changed, so the objectoffsets where still aligned to the world). To force the script to align the box to the camera instead of its pivot, you need to multiply the offset transformation by the node's transformation:
(
 calculate the offset transform matrix
local TmScale = scaleMatrix $.objectOffsetScale
local TmRot = $.objectOffsetRot as matrix3
local TmPos = transMatrix $.objectOffsetPos
local TmOffset = TmScale * TmRot * TmPos
a = box transform:(TmOffset * $.transform)
)
Luckily, nodes have a readonly property called objectTransform which already contains these multiplied matrices, so this would reduce the script to:
a = box transform:$.objectTransform
Hope this helps,
Martijn
gasmasocet
03152009, 08:35 AM
I just read the help file and still don't understand what objectoffset transform information is for and when it changes.
Its rare case but some people are lazy and the move cam pivot to get easy rotation in orbit style, When you do CANERA transfer you need OPTICAL CENTER LOCATION not PIVOT LOCATION. So transform node means PIVOT POINT and objectransform means "ACTUAL" OBJECT POSITION.
Read this:
A node's transform property contains the Node Transform Matrix, and reflects the position, rotation, and scale of the node's pivot point. Accessing the pivot property will return the same value as the pos property. Setting the pivot property will move the pivot point location to the specified coordinates, however the node's geometry will not be moved.
A node's objectoffsetpos, objectoffsetrot, and objectoffsetscale properties contain the component parts of the ObjectOffset Transform Matrix. A node's objecttransform property contains the Object Transform Matrix. Since this matrix is a combination of the Node Transform and ObjectOffset Transform Matrices, this property is read only. Note that these properties are always returned in the World coordinate system context.
The way I think about the object offset is when I need to get a point in a mesh in worldcoordinates where the pivot is moved from it's default position. So then there's a discrepancy between the "local object space" and pivot (the null coordinate for the local objectspace). So I need to know how much the "local object offset" is and add that to the pivot position and the point position in local space to get a point vector in worldspace.
If you make sure your modellers will always resetXform then it hardly ever comes in use at least not with me, but it's a good thing to know about because sometimes the pivot is moved and you can get back some weird results.
Johan
hey gavin,
you probably figured this out by now but the purpose of adding the cam.objectoffsetrot 90 in the camera exporter is to export the same rotation.x value no matter if the cam has been rotated in x+90 and than transformreset to set the x rotation back to zero (so it is correct in nuke) or if it has not been reset and x is still 90
in both cases 90 is subtracted but in the case of a reset camera a 90 was internally added before since the camera x.rotation was in fact offset by 90 degrees
christian
I just read the help file and still don't understand what objectoffset transform information is for and when it changes.
The objectoffset transform is the offset of the object itself to its pivot i.e its node transform. I.e if you moved an objects mesh, leaving its pivot(node transform) behind you would be moving its objectoffset relative to world space.
Its rare case but some people are lazy and the move cam pivot to get easy rotation in orbit style, When you do CANERA transfer you need OPTICAL CENTER LOCATION not PIVOT LOCATION. So transform node means PIVOT POINT and objectransform means "ACTUAL" OBJECT POSITION.
Generally with cameras, people dont tend to change the cameras actual pivot, they just parent it to another object an rotate that. If however you did and yes did infact need to get its original pivot it would be a little tricky and you would want to apply back its node transform to the the object, and the transform the objectoffset by its inverse.
Alot of people find the objectoffset and node transforms very strange and can over complicated it, max has one of the strongest matrix and node transform support. Essentially all your doing its applying an offset to a transform, the transform being the pivot and the object being the object or mesh itself.
The only reason an object would need to apply the objectoffset back onto is if the node transform itself was positionally at zero or the camera's pivot was wrong and an offset needed to be applied to it. Simliar to mocap data that needs to point up in z or y.
If your camera's pivot is correct, and its orbiting or pan etc around another object, etc or even if its just moving it space all you really need to do is store its world transform over time.
Its funny that your adding an objectoffset on top, isnt this just changing the cameras object and not its pivot? Does nuke use the actual object center? not node?
it is a bit strange, I admit, but since the goal was not to export an actual camera node but a set of numbers that let nukes camera node transform in nuke space like the max camera does in max space, this was the easiest solution.
some users create cameras and null them out at world center, some create the cam pointing down, rotate them and start animating, some (like me) prefer to transform reset the camera first so it is nulled without being parented to anything.
the offsetrotationtrick was to make sure that the chan values for an unrotated cam that points forward and not up in nuke is always zero independet of user preferences.
CGTalk Moderation
05122009, 01:01 PM
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.
vBulletin v3.0.5, Copyright ©20002014, Jelsoft Enterprises Ltd.