PDA

View Full Version : newtons cradle, toolbox


HornBerger
09-02-2010, 01:13 PM
hi!
started playing around with toolbox again (got distracted by rayfire) the new doodle is newtons cradle.. (below is a reference .gif)

http://www.iqmagtoy.com/image/Newtons_cradle.gif

i created a similar setup in max and glued everything together but when i simulate my cradle works for the first couple of collisions and then starts decaying.. (i have setup the restitution values for the physX shapes to 1.0 and 0.0 for static and dynamic friction also i have set the sleep threshold value to 0.0 and bounce value in the physX world to 0.0, but still the system starts decaying over time) also the system is very jittery and unstable (slight changes in parameters reflect a total change in the animation, especially changes made to the density of the connecting rods)

i know this is very simple piece of animation and does not require use of any RBD at all, hand animation would suffice, but this is for experimentation purpose only

[attached max 2010 file]
thanks!

Glacierise
09-02-2010, 02:54 PM
I don't think thats a useful experiment dude :) CG-wise, it doesn't make sense - you said yoursel it's easier to do it otherway. As for learning PhysX it's not making sense either, because you go into solving problems that will never actually occur. The elasticities and frictions are a small portion of your life doing FX with PhysX or anything. I'd focus on layering, making a complex simulation out of many pieces - that's where the real candy is :) Cheers!

HornBerger
09-02-2010, 03:22 PM
thanks for the post
i think the setup is loosing its momentum because the spheres have 3 axis of freedom.. if there were a way to constraint them to one axis alone..

I'd focus on layering, making a complex simulation out of many pieces - that's where the real candy is

actually i am trying to recreate a portion of this advertisement http://www.youtube.com/watch?v=s0jheZLhJB0 using RBD but i am facing problems with transfering 100% momentum from one object to another so i thought i would first create the newtons cradle and i encoutered problem with the most simplest physics! (i will try this out with the realflow RBD at work.. i think that is more suitable for this (this meaning the advertisment and newtons cradle :P ) than physX ) (Anything but the havok reactor) i will post the result if i can get something close to the advert..

thanks! :)

PsychoSilence
09-02-2010, 04:23 PM
I like it :) Glue is always a good thing to pick back up since it's the heart of box2 imo.

Similar to a test Johnny Random did a while ago: http://4rand.com/r-d/pf-tools-box2-box3/ I'm sure he has some tips for you about the momentum.

@ Glacierise: You sound kinda rude! The sounds makes the music...He said he's just picking box2 back up. Besides you should do a complex layered effect on your own, your demo reel could sure use it ;)

Ansi

JohnnyRandom
09-02-2010, 05:27 PM
I don't have the scene with me, but I do recall running into the same issue.

Off the top of my head, the most important thing I seem to remember was the placement of the wires. They were actually offset on the x-axis from center (ie the bind to the collision object boxes) as to put some force on the sphere next to them. The only one that was centered being the middle sphere. This seemed to help with the loss of kinetic enegry, since there was a slight but of pressure on the next sphere it was almost a direct transfer without loss due to bounce. Everytime the spheres bounce off of each other they lose a great deal of engery, if they are tight enrgy transfer is more efficient.

My scene was around 800 frames and at the end energy was still good, the only problem I ran into other than the aforementioned , I used geosphere and each sphere contact point was a vertex, which meant it was a sharp point (you could really notice it when you zoomed way in), and as soon as this point got off center with its neighbor the deflection bounce got a out of alignment.

Not sure if it is possible but it would be cool to have some sort of soft-selection based collision to dull down the impact accuracy and make it a little more forgiving.

You could subframe samples, you could easily get away with 12-20.

When you "initiator" particle moves out the rest pose of the others should be still. If they move you system is already lost energy transfer.

byvfx
09-02-2010, 05:39 PM
yeah if mr HornBerger wants to do it its not 'stupid'. its his business. the helpful and polite thing would be to help guide him to a solution you might learn something in the process.

OlegB
09-03-2010, 02:13 AM
I used geosphere and each sphere contact point was a vertex
It should not be a problem if you use Sphere as collision shape instead of Convex Hull ( or Geometry ).

Thanks,
Oleg B.

HornBerger
09-03-2010, 11:41 AM
thanks for the posts and support guys! :thumbsup:

@jhonny:
My scene was around 800 frames and at the end energy was still good
amazing work with cradle. I like the rendering too.. (800 frames!! and with a subframe factor between 12-20! thats very impressive!! :thumbsup:)

I tried out all your suggestions, i was able to make the system a bit more stable but the spheres at the end continue to loose energy over time.. its like a damped sine wave the first collision is higher than the next and so on.. here's is a Gif

http://img34.imageshack.us/img34/7273/newtoncradle00.gif

btw i tried both geosphere and sphere with convex hull (as using a sphere shape in physX shape does not make a difference as noted by Oleg in the previous post). i set the geoshphere segments to 3 and type to octa and rotated it 90 degrees to gimme a pointed edge of contact between every sphere, but the system still continues to degrade over time

my spheres are very close to each other (i created them using the array tool and the distance between them (from there center) is there (radius*2) my wires are at an angle of 30 degrees from the line passing through the center of the sphere, i tried different angles but the results were same) btw. i am using rigid bindings between the wire and sphere and distance binding between the wire and cradle (i have set the max limit to 100% as in the max file i attached in the previous post)

thansk! :)

PsychoSilence
09-03-2010, 02:49 PM
Looks like "mission accomplished" to me :)
How about you make one sphere at the end a really wobbly soft body just for fun :D

good job!
Ansi

Glacierise
09-03-2010, 03:27 PM
Looks cool, I'd say it looks much better then the reference you posted (no perfect momentum transfer, some is kept in the intermediate spheres) ;)

And I didn't wanna be rude at all, of course :) And the result looks nice. And Anselm, I wish I could send you my viewport now, but alas, until next year :) You're right though, point taken :)

PsychoSilence
09-03-2010, 03:57 PM
And I didn't wanna be rude at all, of course :) And the result looks nice. And Anselm, I wish I could send you my viewport now, but alas, until next year :) You're right though, point taken :)

Would love to see! Keep in mind tho we are talking home shots here. No one wants to see a breakdown out of the pixo reel 10 other people have in their reel as well. That's a group effort under studio art direction hence people with alot more experience then u ;) nuf said, lets stay on topic here.

Glacierise
09-03-2010, 04:06 PM
I got explained that I come up as arrogant, and I wanna apologize if I do, because that would be so wrong, I really am not AT ALL. Thanks for bearing, and cheers :)

JohnnyRandom
09-03-2010, 06:55 PM
Hristo, dude you are soo freakin rude! Don't be such a jerk...i'm kidding :D

Anyway, I found the scene file, it was done in beta .69, so I opend it and checked to see if it worked the same I did a couple of tweaks , as apparently there were some differences. There definitely is loss of energy transfer, as you'll notice by the point helpers, my opinion is since physx expects a perfect setup any thing that deviates from it will affect the outcome. And since a "real" cradle is relatively "perfect" with the exception of minor differences in the spheres weight and imperfections in manufacturing process...well you get what I mean.

Pull the scene apart and tweak it if you wish.

Max2010 box#2 1.06 Newtons Cradle (http://4rand.com/TEST/ParticleFlow/Box2/NewtonsCradle/B2_069_Pendulum01_20.zip)

Glacierise
09-03-2010, 07:34 PM
I've been away from PhysX for a while, but wasn't there a param called 'Restitution' or so, that defines energy loss? Pushing that could even give particles more energy from collisions.

JohnnyRandom
09-03-2010, 07:48 PM
Yes there is, it almost seem like you need to be able to have box#3 access to it and have the ability to overdrive it, the scene I posted is set to 1.0 (the Max) which is supposed to equate to zero energy loss, which it seems to work as described in some other test I have done. Overdriving it you could create some interesting effects, I'll have to ask about that.

As I mentioned though due to things like collision shape you are limit in the amount of real world perfection that you can achieve. For instance you cannot get your particle collision shape dense enough to create minor imperfections, they can only create basic form at best (which in most cases seem to sufice fairly well, as we all learn how to cheat), if your where to be able to create collisions of that magnitude of scale it would kill the system, unless you could pre-calculate impact areas and dynamically tessellate the collision faces to achieve greater accuracy. Something like that would in in nVidias hands and I doubt that that has even been considered, more than likely not very practical.

HornBerger
09-03-2010, 08:15 PM
@PsychoSilence @Glacierise @jhonny @oleg @byvfx ......
thank you all for the posts, support and appreciation! you guys are the best :bowdown: ! toast to CG society :beer:!

@jhonny :
i cannot thank you enough! the setup is perfect.. the key difference i figure is the pivot point of the wires (i haven't tested it yet but i think that plays an important role too!).. The realflow RBD can solve for meshes and it gives some pretty accurate results.. i guess the main purpose of the physX RBD solver is realtime simulation for games thereby scarificing accuracy for speed.

thanks again!

CGTalk Moderation
09-03-2010, 08:15 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.