Matching two objects that are the same from a vertices point of view but dif.

Matching two objects that are the same from a vertices point of view but dif.

Anonymous
Not applicable
5,995 Views
10 Replies
Message 1 of 11

Matching two objects that are the same from a vertices point of view but dif.

Anonymous
Not applicable

Hope I'm explaining that right.. I cannot work out a way to do it..

 

Basically the two objects are exactly the same from a vertices point of view, but I need to find a way to manipulate them to match each other, obviously one of the objects has been taken from a camera angle so as to effect its placement with FOV, frame size etc.. so trying to realign that object back to its original shape before the camera was introduced (outside Maya). Then I can use that transformation on the group to bring everything back to the same object.

 

Does that make any sense?

 

Has been killing me trying to work out how to do it for the last week. Basically have the two objects side by side in Maya and cannot make them match no matter what scaling, shearing, transformations I do.. cannot work out what it is that I need to do.

 

Mark

0 Likes
5,996 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

I'm not sure if I'm understanding this correctly or not. You say the two objects are the same from a vertices point of view, but you want them to match. I'm thinking either you want to align them in the viewport or from the camera's perspective, or you still need the vertices placement to 100% match each other. Either of these correct?

0 Likes
Message 3 of 11

Anonymous
Not applicable

Yeah thanks for the response mate,

 

It's just like having two obects, one being a duplicate of the first.. but one has been twisted, and skewed like it's being looked at thru a camera lens and the fov has altered its perception. So im trying to match the second object to the first. 

 

The reason i can't just delete the second object and duplicate the first is that the second is now attached to a group that is moving with it.

 

Does that make sense. I feel like there is no way to do it, but it feels so possible. Matching the vertices somehow as they are exactly the same amount of vertices, normals etc all the same

0 Likes
Message 4 of 11

Anonymous
Not applicable

Have you thought about using the component editor? If you haven't, or you're not sure what it is, go to the top and look under: Windows > General Editors > Component Editor. From there you can get the coordinates for the vertices of the normal mesh and copy them over to the warped object. It might be a bit tedious, especially if it's a high poly model, but I've got no other ideas. Sorry!

0 Likes
Message 5 of 11

damaggio
Mentor
Mentor

Is this what you want to achieve?

Same mesh, same poly count...different shapes.

0 Likes
Message 6 of 11

Anonymous
Not applicable

Thanks Damaggio,

 

This looks promising, I will try this. It looks like it will do what I need it to do.. let me find out.

 

0 Likes
Message 7 of 11

Anonymous
Not applicable

ok not working.. so let me explain a little further..

 

say you open a maya session and create a rectangle.. then you randomly move the centre point on the object and put in random values in the shear section for all three values of an object.. and the same in the scale section.. then you deleted your history. so the values are returned to zero.

 

so you then want to get that rectangle back to being a rectangle.. you have an object that is a rectangle that you can use to verify the movements, but you can't just copy the values of the vertices from the rectangle.. you basically need to use scale and shear to return that object to a rectangle.. is there a way? what would be the best way to do that?

 

Does that make sense?

0 Likes
Message 8 of 11

Anonymous
Not applicable

I know the answer to my problem is in an equation in this document.. but I don't know how to implement it..

 

http://web.iitd.ac.in/~hegde/cad/lecture/L6_3dtrans.pdf

 

 

0 Likes
Message 9 of 11

giovanniakp
Participant
Participant

So...you basically want to match object B with object A, both have the same vertex/faces count but modified shapes?

 

you could either replace the object B with the object A with Replace Objects (Modify>replace objects).....

 

or try making the object B as an instance of the object A.

 

Try this script I found on the internet (select object B, Shift+select object A, run the script):

 

/* jooMakeInstancesOfLastSelected.mel  0.1
 
  Authors:     Janne 'Joojaa' Ojala
  Testing:     if it works after a suitably long time without 
               much problems let me know. Report any problems.
  License:     Creative Commons, Attribution, Share Alike
  Request by:  fatih gurdal
 
  About:
  A simple script that will replace a bunch of objects with a 
  instance of the highlighted object.
 
  Install Instructions:
  place this text in a file named:
       jooMakeInstancesOfLastSelected.mel 
  that resides in your personal Maya script directory.
 
  Usage select all objects to be instanced then add the master object
  to selection and execute:
 
     jooMakeInstancesOfLastSelected();
 
  Changelist:
      10.09.2011  - Original file 
*****************************************************************/
 
proc string[] justShapes(string $list[]){
  return `listRelatives -shapes $list`;
}
 
global proc jooMakeInstancesOfLastSelected(){
  $master = justShapes(`ls -sl -tl 1`);
  $all = `ls -sl`;
  $allShapes = justShapes($all);
 
  if (size($master) != 1) 
    error "script does not account for transforms with multiple shapes";
  for($i=0;$i<size($all);$i++){
    $item = $all[$i];
    $shape = $allShapes[$i];
    if ($shape == $master[0])
      continue; // skip its a instance
    delete $shape;
    parent -add -shape $master[0] $item;
  }
  select $all;
}

 

 

The caveat is that the objects need to have the translation X,Y,Z and orientation intact. If they've been frozen, you need to bake the objects' pivot (modifiy>bake pivot) to get the translation info, and then you can force the object B to be an instance of object A.

0 Likes
Message 10 of 11

giovanniakp
Participant
Participant

oh and you also need to add this line in the script editor to call the script:

 

jooMakeInstancesOfLastSelected;

0 Likes
Message 11 of 11

Stuart_Coutts
Community Visitor
Community Visitor

Hi - I know this thread is old, but thought I'd throw this idea in here:

 

Did you try using a blendshape? if the vertex order etc is identical, you should be able to apply the original to the deformed version as a blendshape

0 Likes