PDA

View Full Version : Keep Plane Gizmo of the UVW Map oriented at camera


Breinmeester
03-04-2006, 06:32 PM
Hi there!!

I'm mapping a bitmap flat onto a sphere using planar mapping with the UVW Map modifier. I'm trying to keep the mapping oriented at the camera. I tried to put a look-at constraint on the gizmo, but Max won't allow me to perform such operations on a gizmo as it's not an object (I guess). I discovered that I can animate the 'View Align' option of the UVW Map modifier. So now, when my shot is done, I can go through each frame with Auto Key on and my camera view selected, and click 'View Align'.

I was thinking, however, if it was possible to automate this process. I tried the Max Script Macrorecorder (persuming that it works like Photoshop Actions), but it doesn't record 'View Align'. I never worked with Max Script before, but I have some knowledge of other programming languages, so coding isn't totally new for me.

Anybody any ideas??

j-man
03-06-2006, 12:01 PM
Hi,

It's not imposible to assign a lookat constraint to a gizmo, but one way is with a script:


b=box()
m=(uvwmap())
addmodifier b m
c=m.gizmo.rotation.controller=(LookAt_Constraint())
macros.run "Lights and Cameras""Camera_CreateFromView"
c.appendtarget (getactivecamera()) 100
c.target_axis=2



novalism
03-06-2006, 12:28 PM
From my basic maxscript experience i guess this piece of code should be pasted in the listener right?

It makes the box with an uvw modifier and than the gizmo gets orientated to the camera.
Well I've just done all this and I got this error.

-- No ""="" function for ((Global:LookAt_Constraint) (prop run Global:macros) (%"+"() "Lights and Cameras" empty) (%"+"() "Camera_CreateFromView" empty) (prop appendtarget Global:c) (Global:getActiveCamera) 100 (prop target_axis Global:c))

Can someone tell me whats wrong here? Ah I'm using max 7.5

I guess the modifier isnt assigned to the box in the first place?

Breinmeester
03-06-2006, 02:37 PM
Ok. So I created a sphere, added a UVWmap and created a free camera. Then I dropped this in the listener:


c=(uvwmap()).gizmo.rotation.controller=(LookAt_Constraint() )
c.appendtarget (getactivecamera()) 100
c.target_axis=2


Says that target_axis is undefined and nothing happens. This is my first shot at Maxscript. What am I doing wrong?? Can I work with object names instead?

novalism
03-06-2006, 04:12 PM
yip you can

$OBJECTNAME is the object
so assuming you took the default name for the sphere $Sphere01 will be your selection

If you would have 100 objects or something in your scene... you could select them all by just giving ... $ as selection

As for the rest of the problems I cant help you either... Im waiting for the same helping hands aswell

Breinmeester
03-06-2006, 04:27 PM
Thanx, I'll try that.


I tried a work around: I added a dummy to the scene, aligned it to the center of the sphere and gave it a Look At constraint to the camera. Then I assigned a Euler XYZ controller to the Rotation List in the Motion tab and linked the rotation x of the sphere's UVWmap Gizmo to the rotation x of the dummy, y to the y and the z to the z using the paramter wiring dialogue.
It didn't work. Aparently the Euler XYZ axis don't get updated by the Look At constraint controller.
Maybe somebody knows how to make this work around work??

Breinmeester
03-07-2006, 08:38 PM
Okay, so I got it to work using:


$Sphere01.modifiers[#UVW_Mapping].gizmo.rotation.controller = (LookAt_Constraint() )
$Sphere01.modifiers[#UVW_Mapping].gizmo.rotation.controller.appendTarget $Camera01 100


So thanks to J-man, but it's not exactly what I'm after.....:)

What I need is to execute the ViewAlign command in UVWmap modifier for each frame with AutoKey on (like I described in my initial post). I'd like to do it with script, so I won't have to do it by hand, but I can't find a way to execute that ViewAlign command for the UVWmap's gizmo. Is it impossible or does somebody know a way....??

Breinmeester
03-07-2006, 09:16 PM
I just figured out that the view alignment method has the same effect as wiring the gizmo's rotation to the camera's rotation. That's still not what I'm looking for. I'm going back to my first solution: compositing. That means I will need more complex rigs, several scene states and of course some post production, but I'm sure it will do the job. Thanks to everyone who thought with me on this one.

CGTalk Moderation
03-07-2006, 09:16 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.