Generate Keyframes from Phys sim

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Generate Keyframes from Phys sim // Archive: Tech Forum

1  |  

Post by W!ZARD // Feb 20, 2008, 2:22am

W!ZARD
Total Posts: 2603
pic
Before I shift camps and join the folks who bag trueSpace I need to check that the crazy results I'm getting are not a result of user error :D


I'm trying to generate keyframes from a physics simulation. I have a wall made of 155 bricks:

- Step one, assign physical attributes - no problemo

- Step two, run physical simulation - no problemo - ball hits wall, wall falls down - poetry in motion.

- Step three, generate keyframes from simulation - no problemo, simulation runs, newly create procedural anim clip populates looks great.


- Step 4, play back keyframed anim - Mucho grande problemo!! entire wall leaps thirty feet higher in the scene and starts keyframe playback from there! This just looks silly.


Questions - has anyone else experienced this problem?

What causes it / what can I do about it? Is this a bug or my own error?


The manual describes a simple scenario of dropping a single rhinoceros but totally fails to effectively address using the generate keyframes function when using a simple wall of stacked bricks? It does touch on the object/sub-object situation but only in passing.


I've lost three days of productivity banging my head against this and my sense of humour is wearing thin - please help me. :(:(:(


Wizard



EDIT - I'e just found and read Jaywats thread about procedural animation - it was not at all easy to follow for someone new to this area of trueSpace. Is what I'm experiencing a function of the same issue or a different one?

If it's the same it would have been nice to receive some sort of direct notification about this before I lost 3 days to trying to get it to work. Having to search and trawl through the forum to discover known and established glitches seems a little inefficient.

Post by TomG // Feb 20, 2008, 5:52am

TomG
Total Posts: 3397
Can you post the scene? Sounds like it might not be anything top secret or commercial, just a scene to test things, so you may be able to share it. If so we could take a look directly.


There are a couple of things I could think of - eg if the wall is a hierarchy or not, if the clip has Procedural or Additive Blend mode checked, and best way to have a look would be to see the scene itself.


Sorry that you've got a bit frustrated with this one!


Tom

Post by W!ZARD // Feb 20, 2008, 11:55pm

W!ZARD
Total Posts: 2603
pic
Hi Tom


I'd appreciate it if you could take a look so I've attached the scene. I'm not frustrated with trueSpace as much as I'm frustrated by my inability to figure it out!


I'm aware that some of the info in the manual applies to tS 7 rather than tS 7.5 so I'm not that confident in following the manual. I've tried all sorts of different combinations but... well, hopefully you'll see when you play the anim.


Just to re-cap; Phys sim runs fine (apart from a few bricks acting like they are lighter than air instead of having the attributes of iron!).


I record base tracks for the Ball (a single object)and the Wall (a hierarchy) , use "Edit in new track" and create a new procedural clip for both objects.


I deselect all clips to record Keyframes for both objects and click Generate Keyframes. Phys sim runs fine (apart from those odd floating iron bricks) but on playback the bricks act like a flock of starlings!!!

Post by jamesmc // Feb 21, 2008, 3:59am

jamesmc
Total Posts: 2566
The thing about physics is that it must calculate completely before it works properly.

What I think the deal is about using the timeline in tS is that users will try to get something to do something over a span of time without having the physics calculated.

Forces, which are directional vectors, path themselves immediately, but the effects of the physics associated with the scene are calculated dependent on the CPU.

In general terms, the last key frame must invoke the entirety of the physics calculation before any other key framing can take place. If you make additions or changes to keyframes after the calculation is done, your out come will vary. :)

Post by Norm // Feb 21, 2008, 6:35am

Norm
Total Posts: 862
pic
When I loaded the scene, the scene was way too large. The wall was at location 52 in z axis. I felt that if the scene were recreated to a reasonable scale, one could perhaps troubleshoot what is happening.

I would loose the tower for moment and focus on the wall and the ball and perhaps a ramp that would simulate the tower roof if desired. In short I would simplify. I saw tremendous number of cubes in the group called wall. If you test with say 10 cubes/bricks and figure out how all the functionality works together, you could then take that knowledge and apply to a scene like you are showing. I always like to simplify and conquer.

I am confident trueSpace can handle the math on a complex scene. Having a complex scene delays/retards the investigative process. I believe is easier to analyze what happens to 5 bricks in a given scenario, rather than hundred or so bricks.

Post by TomG // Feb 21, 2008, 7:17am

TomG
Total Posts: 3397
The problem here is the wall is a grouped object. I thought this was something to do with it the minute I heard the problem, which is why I asked to view the scene :)


The physical properties are applied to the group, and not the individual bricks. On recording, odd things happen, as the group takes on the animation rather than just the individual bricks, and I think odd things happen due to the groups owner matrix.


I deleted everything except the wall and the ball (not because I have to for it to work, just because it was easier to do tests). I deleted animation for the wall, split it into separate bricks (using the Model side for now), applied physical properties to each brick individually, then regrouped them into one object (attached).


This did the trick, I was then able to record the animation and have it play back as intended. So the solution is not to apply properties to the group, but to each individual object within the group that needs them :)


I'll raise this on beta and see if there is a way to create a tool that when you apply properties to a group will apply them to the individual objects and not the group, to avoid the slow step of applying the properties one by one.


(Note you probably dont need to split the group, but you would need to remove physical properties from the group I believe - you could just apply the properties to the objects in the group without splitting them, I just wanted to split them first as wasn't sure it would work when regrouped and wanted to test them separately and when re-grouped).



HTH!

Tom


EDIT - as a PS I just used default phys properties here, but the result seems more predictable and "as expected" less bricks flying away as if too light, so it seems to help on that score too.

Post by frootee // Feb 21, 2008, 7:27am

frootee
Total Posts: 2667
pic
Ok so if we want to build a brick wall that supports physics, then we would need to create a single brick, apply physics properties to it, then clone that brick repeatedly to construct the wall.

Post by TomG // Feb 21, 2008, 7:36am

TomG
Total Posts: 3397
That'd work :)


HTH!

Tom

Post by trueBlue // Feb 21, 2008, 7:49am

trueBlue
Total Posts: 1761
pic
Nice idea Froo. Then use Dele's LineMup:
http://forums1.caligari.com/truespace/showthread.php?t=3978

Post by trueBlue // Feb 21, 2008, 1:26pm

trueBlue
Total Posts: 1761
pic
Tom: If I may ask... what are the steps neccessary in the Animation Editor to get the results that you have done. I take it that you are not generating keyframes, correct? Also if you would not mind maybe you could mention something about the Save Animation in the PhysEngine.

Post by TomG // Feb 21, 2008, 1:41pm

TomG
Total Posts: 3397
I enabled phys properties for each brick; then encapsulated into one object. I ran physics, and the ball (unchanged from the original scene) hit the bricks and knocked them as expected.


With the wall selected, I hit record to create a blank track, then add track, then add procedural clip on that new track. I then right clicked the procedural track and used Generate Keyframes, which recorded the phys sim into the keyframes. I then both scrubbed back through the keyframes, and ran the play button. I had to adjust the balls existing procedural animation track, as the wall was exploding prior to the ball reaching it (the proc track for the ball in the scene starts later in the timeline - I could of course have moved my wall's explosion to later in the timeline too, that would work), and that was that!



Thanks!

Tom


PS track settings in the AE were defaults too, didnt need to adjust those with the steps above, so that means the second track did not have additive blend mode enabled (otherwise it wouldnt play back properly). Also I didn't adjust any settings in the Phys Engine it was default in the new scene - Save Anim was not checked. Attaching the final test scene too rather than just the wall object, havent adjusted the timing here yet, this is right after generating keyframes for the wall.

Post by TomG // Feb 21, 2008, 1:56pm

TomG
Total Posts: 3397
You will note too that although I had to enable phys properties for each brick, once that was done and they were grouped, I only needed to create one procedural animation clip for the group and the generate keyframes into that in order to capture the animation of all the bricks at once.


So while the bricks needed their own phys properties, they don't need their own individual clips.


HTH!

Tom

Post by W!ZARD // Feb 21, 2008, 3:22pm

W!ZARD
Total Posts: 2603
pic
Damn! I knew it had to be a simple step I was leaving out! Because I could apply the physical attributes to the group and the sim would run it never occurred to me to try putting the physical attributes on brick by brick - but now I think about it it makes perfect sense!


A huge thank you to Tom (and Norm) for solving this for me - all along I had the feeling it was user error so at least I got that bit right! In my defense the manual is rather vague on this topic.


I did come up with an inventive work-around though - I used Camtasia 3 to capture the screen while the phys sim ran and then re-recorded the resulting video 800% faster which gave me a good result :D. Of course it had it's limitations but next time I'll be able to do it the right way.


Norm, I take your point about simplifying the scene - that would have been a smart move if I'd thought about it - rest assured I'll use that sage advice next time I run into a problem.


Thanks again gentleman - I'm most grateful!

Post by Burnart // Feb 21, 2008, 4:27pm

Burnart
Total Posts: 839
pic
Interesting thread - makes me want to rush home and give it a try.

Post by W!ZARD // Feb 22, 2008, 3:37am

W!ZARD
Total Posts: 2603
pic
Interesting thread - makes me want to rush home and give it a try.


Despite the occasional frustrations it's a lot of fun. And the real-time rendering means you can produce a lot of animation in a much shorter time than waiting for a ray tracer to render the scene.

Post by Norm // Feb 22, 2008, 6:28am

Norm
Total Posts: 862
pic
One of the interesting facets of the Physics is the settings. I was full-of-wonder when Anton mention in aside to me one day that objects of huge mass will actually create their own gravity. One of the scenes in the Physics chapter demo's this. I thought was way cool.

Ability to restrict physics to xy axis only is also very interesting. AirHockey based on this feature.

I moved the wall down to ground level as it was. I resized it and had to delete all the animation information. But I got to square-one with the wall and then did same for the ball. I set ball to move horizontally at the wall with keyframes, set the physics to zero "z" gravity .... then let the ball hit the wall.

check it out!. Then if you had 1000 bricks and slammed a cube into the wall, heh heh ... yes it is fun for sure :)

Post by TomG // Feb 22, 2008, 11:29am

TomG
Total Posts: 3397
Some new info on this from the developers, and from trueBlue. Here is an easier way to create the desired effect -


Take your grouped object (no need to apply individual physical properties to the elements in the group). Apply physical properties. In the LE, enter the group.


Now you will see all your objects, plus an extra object named PhysObject. This will have a property on the panel Phsyics Group Attr, which is exported (you'll see the link in Developer view, or just the round blue half circle with a white circle in Artist view).


Delete this object. This removes the properties for the group as a whole, and leaves the properties applying to each individual element in the group.


Now it will work as expected, saving you the time of applying physical properties to each object in the group one by one :)


HOWEVER in the scene that Wizard posted, there is one other thing that needs changing before this will work. Back at the scene level, there is an object in the LE called PhysSpace. This has an attribute Space Attr, and this is exported - you must break this link for this to work!


How that link gets set, if it should be set, etc, is something still being discussed :) But for now if you ensure you break that link, then follow the above steps for the wall, it should work fine, and be easier than having to apply attributes to each brick one by one.


This will also work for other groups when you want to apply physical properties to lots of elements all at once.


HTH!

Tom

Post by W!ZARD // Feb 22, 2008, 10:54pm

W!ZARD
Total Posts: 2603
pic
check it out!. Then if you had 1000 bricks and slammed a cube into the wall, heh heh ... yes it is fun for sure :)


LOL! Yes it's quite cathartic and therapeutional to smash down brick walls! And the beauty of it is you don't have to sweep up afterwards - just return to the start of the anim! :D


@Tom - wow that's cool! A most useful tip - thanks for sharing that.


I must be starting to get the hang of this - that post made perfect sense to me! :D
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn