Author Topic: Spacewarp!  (Read 396 times)

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Spacewarp!
« on: October 25, 2011, 05:13:36 pm »


                <feeling very...>

Very strange behavior in 3DS Max.  
Symptoms:
  • Rotating linked object (mandible blade) warps geometry all over the place. (Note: transforms are linear and scale is 1.0 on everything) [Edit: bounding box turns trapezoidal. The base "face" of the bounding box stays glued to original orientation. The rest of the box (and geometry) warp around it.]
  • Unlinking *everything* and reseting transforms (NwMax meshtools) warps *everything*.
  • Trying to export model fails sanity checks on the dias and all elements of the chains. Claims scale is not 1.0. Scale displays as 1.0.  Resetting scale warps elements all over the place.
I exported anyway and looked at the text dump.  Scale is 1.0. 

I'm pretty confused/frustrated :-(

<...psycho-delicate>
               
               

               


                     Modifié par Rolo Kipp, 25 octobre 2011 - 04:33 .
                     
                  


            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Spacewarp!
« Reply #1 on: October 25, 2011, 06:27:13 pm »


               This depends on what you are attempting to do.

If you are animating, it should work, if you are attempting to move an already linked object, you WILL have problems.  Max stores relationships between the two objects. (Or more if multiple links down) and absolutely hates it when you attempt to adjust things that way.

Assuming these are NOT animation related issues, IE, you are not adjusting the animations directly, just attempting to change the look of an object you can "break the link"  reset-x-forms, THEN move/adjust it, reset-x-forms again, and then finally link it back.

If this particular object has OTHER objects linked to it, then you also have to break those links first, reset-x-forms, then make whatever movements/adjustments, reset-x-forms again, and relink the entire chain of objects.

reset-x-forms resets relationships according to the object(s) pivot point.  If that pivot is not exactly centered on the object, then when you move/reset-x-forms it can cause serious movement of the objects in question.  

For creatures, this can become very painful as the individual pieces are typically linked to other multiple objects and the pivots have typically been adjusted to correct for shadow issues.

Big word of advice... save the scene file, don't worry too much about the export bit until AFTER you have saved the scene.  Another note on scene saves, is append an 01 to the first one, then when you save, Max will auto-rename each additional save by increasing the number to 02, 03 etc... IE, myfile_01.max, myfile_02.max etc... I give max the help of using the underscore "_" and "01" on first save of a scene to allow it to auto rename on each additional save.

So, save the scene
Experiment and save the scene again THEN export to test.  When/if it doesn't do what you want, go back to the scene (don't re-import) and load the scene that was prior to your last adjustments, so you can recover your previous work.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Spacewarp!
« Reply #2 on: October 25, 2011, 10:34:20 pm »


               <counting slowly...>

I hear you on the scene saves. This is Altar_11.max :-)

This is happening *before* export.  I was just trying to do a single axis rotation of the tip end of an... appendage :-P

And the wierdness is only for one (out of 6) tips... Well, the scale thing with the chains is also wierd... <sigh>

Anyway, I put the file up in the Project - though I ask people who are not advising me, try not to peek... I am hoping to make the surprise "OffToOn" anim worth waiting for the hak. If you have some ideas (and some time) I'd appreciate you taking a look at the scene and seeing if you can a) duplicate my weirdness and 2) <"b", boss> er, 'B)' help me fix it.

All that stuff I did with The Crone, I never got this kind of behavior.  Generally, I like discovering emergent behavior. But this has thrown me for a loop.

<...on his fingers>
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Spacewarp!
« Reply #3 on: October 25, 2011, 11:00:19 pm »


               I got it!  BTW, good advice, Bannor!  It turned out to be related to animation keys after all, though I've never seen a case of it this bad before. (Rolo sent me a link to check out the model)

This is what it looked like when I loaded up the scene.  This is the exact same scene with ResetXForms applied (safe pivots were on but didn't really matter in the sense of changing anything).  This is with the camera moved far away from the scene so you get a feel for how trashed everything got.  What threw me for a loop was the fact that when I played the animations nothing appeared to happen so I just moved onto troubleshooting other things. 

Rolo, it turns out there were two animation keyframes (one at 90, one at 150) for an off2on animation that had pos, rot & scale keys and the keys were for most of the objects in the scene.  Even though nothing appeared to happen when the animation was played, the keyframes existed and there was some data in there that Max was keeping track of.  And so, if I unlinked any of the objects that had those scale keys (even if I did it at frame 0), it distorted the object in a bizarre non-uniform way.  For instance, it would distort a circle into a circular parallelagram shape.

To "fix" it, I just selected all the objects in the scene and deleted those two frames worth of keys.  That fixes most of it.  There's a problem with legs and heads on the ladies and it seems that the best way to fix the whole thing is select all the objects in the scene, all the animation keyframes which appear in the bottom animation trackbar and hit the delete key.  Then you can do your ResetXForm and export successfully.

I know it's a bit draconian a solution but the alternative is going through and doing some trial and error removing (presumably only) scale keys.  Much easier to blow them all away, animation-wise, and just start from scratch.  Esp. because when you play the animation nothing appears to happen, anyway.

I'll bet most people have actually seen this problem whcih usually manifests itself much more subtly in the form of an object which, when you reset xforms, distorts or moves in an unpredictable way instead of just having the bounding box reset itself.
               
               

               


                     Modifié par OldTimeRadio, 25 octobre 2011 - 10:20 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Spacewarp!
« Reply #4 on: October 25, 2011, 11:27:43 pm »


               Rolo, I just read your update and I think you can get around any problems by having two models- one which contains the animations and one which contains the geometry but no animations on the base.  Then make the animation model the supermodel of your geometry and your geometry should pick up your animations in-game as long as both structures retain the same skeletal relationship.

I think that will work, anyway.  It sure works for creatures.  If you run into problems, drop me a PM and I can try separating the two for you.

My demon lizard man has a pure geometry model with just bones and skinmesh but no animations of any sort and that's supermodeled into a slightly-modified version of one of Ragnarok_MR4's ACP fighting styles and that, in turn, supermodels into a_ba.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Spacewarp!
« Reply #5 on: October 26, 2011, 04:04:00 pm »


               <does a little jig...>

Hah! Two different lines of investigation and something really worthwhile <he thinks> comes out of it.

While you were checking out the anim keys (excellent, btw :-) *I* was trying to trace back (as BB mentioned) where the problems first manifested.  Suddenly, I noticed something. Every object that was warping was, or was linked to, an object that had been welded - either explicitly (chainplate, collar, mount, blades) or implicitly with "Optimize" (links, dias).  This was *before* any anim keys were made. (Btw, the only anim keys on there were for start/end states, so there would have been no action.  Hadn't actually started the anims yet.)

So, a bit more investigation (2 experiments) tells me two things if you weld or optimize any object:
Do *not* weld linked objects. Unlink them first.
*immediately* reset xforms before doing *anything* else.

That seems to work.

I managed to salvage most of what I'd done, though only the first link and none of the blades... they were *seriously* warped.

At a guess, Max is referencing vertexes that aren't there in a relative way that is enourmously maginfied by iterations through anim keys...

I'd be very interested if other people can duplicate the problems and confirm it is with "inappropriate" welding/optimizing. Very.

Thanks OTR, BB.  Taking down the spacewarp file now so people don't get too tempted ;-)

<...looking *very* silly>
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Spacewarp!
« Reply #6 on: October 26, 2011, 06:36:05 pm »


               Reset X-Forms is almost a requirement.  It will definitely save you a heck of a lot of pain on exported objects, animations, basically everything.

One related item is the pivot itself.

Between the two, Reset-X-Forms is the most important, but so is the pivot.

When you "weld" verts, you are effectively changing the pivot location as well, which affects the "center" that max uses when you Reset-X-Forms.  

ANYTHING that adjusts the size/position of an object, also affects it's link to the parent object, and may also affect any objects that are children.

If you delete a couple of faces on an object the pivot point may change, and likely will.  Same as if you add a couple of faces or move anything around.

The pivot adjustment feature in 3dsmax is found here: 'Image

So... linked objects?  Well, if you adjust anything related to the parent, or child, you can affect that linked data.  This includes animation data, size, position, shape etc...

My process is to create whatever object I need.  By default, 3dsmax centers the pivot to that object, and will also turn that pivot to the default world view settings depending on how your options are setup in 3dsmax, but it is followed/adjusted to worldview by default, so if you haven't changed that option, you can trust it.  If you link that object to it's parent (mdl base, or other object, doesn't matter) the data related to that object (it's pivot, it's position, it's rotation, and it's size) are all stored and linked to the new parent.  This is both good and bad.  Good in that everything must have a center point somewhere in the scene for it to be used, and by being linked to another object in the scene, anything you do to the parent, affects that child.    IE: If you move the parent, the child will move, if you animate the parent, the child will inherit the animation, EVEN if nothing changes, all the position, size, scale, motion data is stored.  

Bad thing with the inheritance is the same as above.  Any changes to the parent are directly applied to the children as well.  The linked position etc, of the child can also affect where it ends up when exported.  So, if you created an object, say a box (simple box, but created with separate objects for each face of that box, or another analogy would be a building with four sides and a roof that are all different objects with different textures applied) and then you link those objects to a dummy, you then move the dummy of that box... the whole thing moves, all the faces move.  This could be handy during creation of something, but if possible, those links should be BROKEN and all the objects directly linked to the main parent of the item you are creating.

Multiple children will cause you great pain otherwise.  IE, parent is say a tile mdl base, but you have say a building dummy, a tree dummy, a waterwheel dummy,

parent
<<--building (as a dummy)
<--- wall side 1
<--- wall side 2
<--- wall side 3
<--- wall side 4
<--- roof
<<-- Animation dummy (typically called "A" dummy in discussions around here)
<<-- water wheel dummy (linked to the "A"nimation dummy
<--- 1 plank on the wheel linked to water wheel
<--- 2nd plank on the wheel linked to water wheel
<<-- etc...

Now you can animate the entire water wheel "object and children" as one object, and rotate it etc... the data stored at each "key" in the animation key is stored on EVERY object in that parent... IE all the children get data stored.

All simple enough.  But now if you grab that Water Wheel parent, and decide to move it elsewhere in the scene, you may end up with some severely moved/adjusted objects on the final export.  Remember, the original pivot of every object was set to world view, and aligned to that objects center.  When you move that object, most especially if you rotate it's angle (any angle, x, y, z) then the pivot is now wrong according to World View, as the object moved, but the pivot follows the object, NOT the world.  

So, if you reset-x-form, you are telling max to readjust everything according to world view, and max helps you by turning all the objects so that their pivots are correctly rotated back to world view.  Meaning, your objects can/will turn in your scene.

Basically, don't link things until you are fairly sure they are where you want them to be finally located, and are already finished.   Otherwise, you will have to break those links, make your adjustments, Reset-X-Forms and then Re-link them.

Too darned wordy... but Max stores much more information that you normally think about.  It saves all the relationships to every object in a given scene.