09 Getting ready to simulate the world with XPBD

  Рет қаралды 22,750

Ten Minute Physics

Ten Minute Physics

Күн бұрын

Пікірлер: 74
@LowLifeGraphicsProgrammer
@LowLifeGraphicsProgrammer 3 жыл бұрын
Wonder why so few followers.... Every graphics researcher & developer should follow this channel. Everytime I see the name "Müller" in any real-time physics simulation paper, I know it's gonna be good.
@OsedayCan
@OsedayCan 2 жыл бұрын
This channel is a gold mine
@sivabalan_m
@sivabalan_m Жыл бұрын
Thank you so much!. I can't believe that I have the opportunity to directly learn from Matthias Muller!!!
@Mr4NiceOne
@Mr4NiceOne 2 жыл бұрын
Thank you so much! So many other resources are filled with fluff, but this is clean and straight to the point. Perfect introduction for someone with physics/math background who might be interested in simulations
@shantih19
@shantih19 3 жыл бұрын
Your videos are amazing, thank you so much! I started watching because I wanted to try to implement XPBDs in Blender and I can't wait for the tutorial about rigidbodies!
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Thanks. It will come. In turn, I have written a few "static" plugins for Blender and would also like to write some simulation code there. Is there a template plugin to create time sampled geometry?
@shantih19
@shantih19 3 жыл бұрын
@@TenMinutePhysics I couldn't find any specific template or example, but there seem to be a few open-source addons that could provide some reference
@XAPKOHHEH
@XAPKOHHEH 11 ай бұрын
single most brilliant cg physics channel!
@7steelrainbow
@7steelrainbow 2 жыл бұрын
The comparison of force, impulse, and position based simulation gives me a clue (although not mathematically understandable yet) why they make such different characteristics. For more than a couple of years of studying how to make physics code , I've looked through those three ways, but failed to figure out why modifying the particles' status via force/velocity/position makes so different ends - apart from using different integration schemes -. You are the first teacher for me to give such a 'big picture' of simulation methods using easy words. Thank you!
@Christobanistan
@Christobanistan 7 ай бұрын
OK I can't even figure out what integration means. 😿
@mariovelez578
@mariovelez578 5 ай бұрын
@@Christobanistan In physics simulations you numerically integrate acceleration to get velocity, and then you numerically integrate velocity to get position. There are different ways to approximate integration, but the most common is Euler integration, which is basically v1 = v0 + a*dt (acceleration to velocity integration), x1 = x0 + v*dt (velocity to position integration), where dt is the time step.
@Christobanistan
@Christobanistan 5 ай бұрын
@@mariovelez578 So integration is just plugging in a factor to an equation to get another value?
@mariovelez578
@mariovelez578 5 ай бұрын
@@Christobanistan integration is turning a function that describes rate of change of a variable into a function of that variable. In other words, it's the reverse of a derivative. For particle kinematics, this means finding the new velocity at the next time step given the acceleration at time t, and then using that velocity to find the new position. I recommend taking classes on calculus and a physics class on mechanics (more specifically the subject of kinematics).
@kiaranr
@kiaranr 3 жыл бұрын
Thank you for these videos. They are a fantastic supplement to your papers.
@bankrupt3am932
@bankrupt3am932 Жыл бұрын
This channel actually has the best most helpfull easy to under stand information i could find for the past few weeks. Thank you ❤
@mariovelez578
@mariovelez578 5 ай бұрын
This video is incredible! Everything is making sense now, thank you for sharing!
@toshi4186
@toshi4186 3 жыл бұрын
Thank you so much! Unvaluable learning material...
@ivanhoffmann7266
@ivanhoffmann7266 3 жыл бұрын
I am always so excited to see a new video from you! Your work makes writing physics simulations fun. Thank you! P.S. The tires in the rc car demo dont use the volume conservation constraint, do they? That would be a nice improvement.
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Right, I used shape matching there because it is stiffer. We have volume conserving sm now so we could fix it.
@motbus3
@motbus3 Жыл бұрын
Hey dude. Your videos are great. This series is fantastic
@Stefanhimself
@Stefanhimself 3 жыл бұрын
Thanks matthis, great stuff. Really cleared things up for me.
@imadetheuniverse4fun
@imadetheuniverse4fun 2 жыл бұрын
at 15:00 shouldn't the gradient vectors have length 1, and thus be equal to the normalized cross products of the opposite vectors, instead of just the cross product?
@zhitongcui6471
@zhitongcui6471 9 ай бұрын
Very excellent tutorial!
@danielpihlquist2664
@danielpihlquist2664 Ай бұрын
Pure gold, thank you so much!
@lawrencesmith2861
@lawrencesmith2861 3 жыл бұрын
Thank you for this wonderful video Matthias. Is there a mathematical difference between increasing the number of substeps by a factor N, and reducing the timestep by a factor N? Or are we just playing with the refresh rate of the plotting function in this case, with the underlying math being identical?
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Hi Lawrence, this is a very good question! I should have mentioned it in the video. It is exactly the same as simply reducing the time step size. The idea is that if you have a fixed computation budget per time step you should use it for substeps, not for iterations. This is a non-trivial observation. In other words, you should move forward in time when iteratively solving the equations.
@themlnsshow
@themlnsshow 3 жыл бұрын
Thank you for another amazing tutorial, I was so excited by your demos in the rigidbody PBD paper I have decided to write my College Master's Thesis on the topic :D You truly are making a great job at making physics simulation more accessible than ever. I'm planning on comparing the results while using Gauss-Seidel methods, Jacobi(on GPU) and SSOR or any other variations I can find. Any tips? I would also love to know more about how you did that inverse kinematics demo!
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Thanks. I have lots of ideas for future tutorials, one will definitely be about IK. A comparison would be interesting.
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
Doing a comparison would be interesting. In the PhysX SDK we use constraint coloring for doing GS on the GPU.
@themlnsshow
@themlnsshow 2 жыл бұрын
@@TenMinutePhysics That's great to know, thank you! Is there any resource on what type of collision response popular simulators use? It would be really helpful to know what methods PhysX uses for simulating rigid bodies for example. Thank you for the response, looking forward to future videos!
@TheGameLix
@TheGameLix Жыл бұрын
Fantastic work! Very helpful!
@user-gy6cw7sx3q
@user-gy6cw7sx3q 7 ай бұрын
Hi ! I don't really understand why at 1:45 you say a large stiffness implies stability problems ? I don't know if the link is obvious, but for me it isn't so if anyone has an explanation I'm open to it ! Thanks for all the work and resources you put out :D
@Christobanistan
@Christobanistan 7 ай бұрын
I wish I could follow even a little of this. It looks very cool.
@stewieyan
@stewieyan 3 жыл бұрын
Thank you very much! I hope I could implement a physics engine from scratch based on your video in Rust! So if we want to add constraints to prevent an object hitting a wall, does that mean the constraint has to be applied to all inner particles of the object? or we need to precalculate the convex points somehow and only apply constraints on those? Can we skip some calculation based on the distances between the wall and particles. what about a softbody hitting a wall? I also hope you could compare the technical choices of some of the most famous physics engines (if they are not position based), like mujoco, physx and bullet etc. Basically I'm curious if XPBD should be the way to go to implement the ultimate physics engine for a game engine? For example, why does NVIDIA have both physx and flex, is physx not PBD? I also hope, in the later stage of this series, you could cover some approaches on implementing XPBD on GPU. Thanks!
@andriinikolaiev8255
@andriinikolaiev8255 3 жыл бұрын
Hi Matthias, Thank you for you work in popularizing of physics simulations. Just got impression that slide "Example: Distance Constraint" has wrong signs in expressions for grad(C_1), grad(C_2) and delta(x_1) Did I miss sign somewhere? Thanks, Andrii.
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
You are right. I noticed it too and fixed it in the pdf, cannot fix it in the video.
@andriinikolaiev8255
@andriinikolaiev8255 3 жыл бұрын
@@TenMinutePhysics I still feel that expression for delta(x_1) should have opposite sign in the same slide in pdf i.e. all x_1 and x_2 should be swapped
@davidalbert7860
@davidalbert7860 2 ай бұрын
@andriinikolaiev8225 Pretty sure you're correct. On slide 10 in the corrected PDF, dx1 is positive (i.e. moves in the direction of x2-x1). On slide 15, it's negative. Both are defined in terms of the vector x2-x1, so one of them is wrong. The slide 10 definition of dx1 seems correct to me. If l > l0 (i.e. the particles are farther away than desired), we want to move x1 in the direction of x2-x1 (i.e. positive) to make the distance smaller. While the gradients on slide 15 in the PDF are fixed, it doesn't look like the derived dx1 has been corrected: it's still negative. I think the clearest correct version of slide 15 would be as follows: GradC1 = -(x2-x1)/|x2-x1| GradC2 = (x2-x1)/|x2-x1| dx1 = λ * w1 * GradC1 = w1 * λ * GradC1 = w1 * -(l-l0)/(w1+w2) * -(x2-x1)/|x2-x1| = w1/(w1+w2) * -(l-l0) * -(x2-x1)/|x2-x1| = w1/(w1+w2) * (l-l0) * (x2-x1)/|x2-x1| In the PDF, both GradC1 and GradC2 are fixed, but GradC1 has been defined in terms of (x1-x2). Above, I defined the corrected GradC1 and GradC2 both in terms of (x2-x1), as they were in the video. The correction is just to swap the signs. I've included the intermediate steps in the definition of dx1. Both λ and GradC1 are negative, which cancel each other out, yielding a positive dx1 that matches the definition on slide 10. /cc @TenMinutePhysics
@fredda6787
@fredda6787 2 жыл бұрын
Thank you for this fantastic channel, very helpful. How you would setup a friction constraint, static and dynamic? Do you have a video or paper on that?
@yunjay99
@yunjay99 Жыл бұрын
I'm a great fan, hope to be on your team some day.
@GermanTutorials
@GermanTutorials 4 ай бұрын
Why did you not use the stiffness/compliance parameter in the calculation of the correction step/the Lagrange multiplier in the "Example Distance Constraint" section? I am a little confused, how would the stiffness actually come into play in this constraint for XPBD? Thanks for this great video and your contribution to computational physics!
@ollied2025
@ollied2025 Жыл бұрын
these videos are great. I'm struggling to understand how you would do the constraints simultaneously. How would you vectorise applying the delta distances from the edge length constraints?
@alexiseutrope6213
@alexiseutrope6213 3 жыл бұрын
Hi, First of all, thanks for your tutorials, they are really fantastic Also, I was trying to understand and reproduce your softbody demo, I was able to use tetgen in order to create some tetmeshes, and export tetras, tris, edges, vertex data However I'm having hard time to understand how you generated thoses variables: dragonAttachedTrisIds, dragonAttachedVerts By looking at your demo the tetramesh seems to approximate the base mesh (Likely for performances reasons) and the real mesh is just "pinned" by some vertices to the tetramesh softbody simulation Am I understanding it correctly ? Also how did you achieved to generate the dragon simplified tetramesh and keep the vertices "match information" with the base mesh ? Thank you !
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Hi Alexis, you are a few tutorials ahead. What I do is called "mesh embedding" and I will explain it in a new tutorial soon. I will also do a tutorial on tet meshing.
@yizhang7027
@yizhang7027 3 жыл бұрын
2:20 Why does't impulse-based simulation have overshooting problem? How exactly does it control velocity update?
@yizhang7027
@yizhang7027 2 жыл бұрын
The difference here is that forces take effect over time, while impulses take effect at an instant.
@aydencook03
@aydencook03 2 жыл бұрын
Can everything still be achieved with only local constraints (a list of constraints attached to a single particle that the particle itself accounts for in its own update)? Or do you need to introduce global constraints that themselves contain a list of participating particles?
@voxelltech
@voxelltech 3 жыл бұрын
Thanks for the video! For collision detection in substeps, is it recommended to do the collision detection every substep or do we do it once only at the start of the simulation? Is there any cost or benefit from both methods?
@themlnsshow
@themlnsshow 2 жыл бұрын
I think it's done once per time step, instead of once per substep. Collision detection is very computationally heavy so I doubt you could get real time if doing it at every substep, but it would be more accurate
@voxelltech
@voxelltech 2 жыл бұрын
​@@themlnsshow Hi thanks for the reply! I looked into the XPBD "Small Steps in Physics Simulation Paper" and they indeed only did it once per frame.
@ghostbusterz
@ghostbusterz 10 ай бұрын
Confused about gradient calculations C1 and C2. C1 is shown visually as facing the opposite direction of C2, and yet its calculation is the same. Shouldn't it be X1 - X2 to go from X2 to X1?
@maximiliankaluschke9273
@maximiliankaluschke9273 6 ай бұрын
There's a minus in front of the rhs of C2
@Madlion
@Madlion 2 жыл бұрын
Hi, first thank you again. I posted in your other channel but then saw that you had moved over to this channel so I want to post my question here as well: Thank you for this video, I have been attempting to implement PBD with some degree of success for ropes. But once I tried to give the rope some stiffness it becomes very unstable, especially if I enforce length-preserving constraints at the same time such as LRA. But even without LRA it is quite wobbly and not stable enough. I'm trying to avoid using additional "ghost" particles to enforce stiffness because of performance issues. Do you have any tip on how to give thin ropes some stiffness like rods while keeping stability?
@TheLoneWolfling
@TheLoneWolfling Жыл бұрын
Beware. As written in 5:55 or 7:06, you get inconsistent results with permutations. Consider a chain of N identical particles ABC...Z, linked with N-1 distance=1 constraints, one between A and B, one between B and C, etc. Assume the order of constraints is AB, BC, .... Now, let's say something shoves particle A by 1/2 a unit towards B. What happens? The AB constraint updates, moving A back 1/4 unit and B forward 1/4 unit. Then the BC constraint updates, moving B back 1/8 unit and C forward 1/8 unit. Net result is an exponential decay, but, notably, particle Z is affected in a single timestamp. Now, let's say something shoves particle Z by 1/2 a unit towards Y. What happens? The YZ constraint updates, moving Y back 1/4 unit and Z forward 1/4 unit. And then... that's it. That's the timestep. X isn't affected at all in the first (sub) step, and in general, the effective speed of sound is one unit per (sub)step. In other words, the speed of sound is dependent on update order of constraints. A relatively straightforward approach to avoid this is to accumulate updates instead of updating positions 'in-place' in the constraint loop. Unfortunately, this does require additional memory, and also results in a speed of sound of 1 constraint / (sub)step, which can be good or bad depending. There are other more complex approaches, of course. For instance, color the constraints graph such that no two constraints with the same color share a particle, and iterate over constraints in order of color. This also allows for parallel solving without locking, as all constraints with a given color operate on independent sets of particles. Maintaining a dynamic graph coloring, even approximate, is itself a task, however. And this approach falls over if you have a single particle with many constraints. The other main issue with this approach is that it often ends up dissipating excessive amounts of energy. Consider your bead on a wire example again. Your projection to the nearest point on the wire results in a slightly shorter distance than the original timestep. And as that is used to calculate the next velocity vector, this means that every timestep the velocity of the particle decreases. Luckily, in this example the velocity loss per timestep scales with timestep^3, and so the velocity loss per unit time scales with timestep^2, but this still can be a problem in some cases.
@choonsy
@choonsy Жыл бұрын
fascinating how this is so similar to how deep learning algorithms work by seeking the minimum error
@BrezhnevStan
@BrezhnevStan Жыл бұрын
Could you please upload an example of this in python or c++ as a guide?
@blastbuilder2430
@blastbuilder2430 6 ай бұрын
What I found is that when using only one iteration the velocity error is too big that results in instability. I need at least 2 iterations to get stable results. Also too many substeps leads to vibrations, not exactly sure why but I guess it’s because the velocity gets bigger when the delta time is really small. When solving collision or distance constraint, the position change is irrelevant to delta t, so if you have a small delta the velocity is much bigger.
@Pyromuffin
@Pyromuffin 2 жыл бұрын
Hi Matthias, I've tried adding the alpha/(dt *dt) change into the lambda calculation for my position based fluids solver, but it doesn't have the effect of creating timestep independent stiffness, instead it really reduces the constraint forces drastically based on timestep. the XPBD paper is pretty dense, and I haven't been able to find any implementations of XPBD for fluids.
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
Hi Kelly. There must be a bug somewhere. XPBD should make things less time step size dependent. However, I haven't implemented XPBD fluids so far since most liquids like water are incompressible so you want a compliance of zero with can be done with PBD. Even for gases.
@Ykulvaarlck
@Ykulvaarlck 7 ай бұрын
does XPBD not have a factor of lambda*alpha to the numerator of the calculation of lambda?
@stati5tik
@stati5tik 5 ай бұрын
couldnt you use this to simulate fluids by enforcing a constraint that guarantees an equilibrium of density? So fluid particles must satisfy a constraint where no density is much higher than the neighboring densities? _
@naztar4323
@naztar4323 Жыл бұрын
I am a soft brained Person yet some how i can understand 10/10
@atomictraveller
@atomictraveller Жыл бұрын
i thought i'd never find meaningful documentation for projective dynamics :O you're probably aware; for those who aren't, the spring constant k = -w * w (w = angular frequency, 2 * pi * hertz/samplerate) i feel so privileged to find this secret video, but i'm still not going to their lodge, ever.
@TenMinutePhysics
@TenMinutePhysics Жыл бұрын
Can you elaborate?
@atomictraveller
@atomictraveller Жыл бұрын
@@TenMinutePhysics for someone who documents like qi jiguang or julius o. smith III, for sure, but honestly not sure which point :)
@atomictraveller
@atomictraveller Жыл бұрын
just for fun, assuming it's dsp, i've made much use of iterative sin/cos oscillator forms in audio eg. s0 -= w* s1; s1 += w * s0; which elicits sine and cosine (one half step behind) for two mults and an occasional renormalisation (maybe each million cycles) when initialised in quadrature (eg. 1.f, 0.f). i've not worked with gpu much so not sure if this is useful for ?gerstner waves or anything. julius o. smith III at ccrma is about the best audio dsp reference to date.
@GufJfj-n3b
@GufJfj-n3b 3 ай бұрын
Orpha Common
@EastingAndNorthing
@EastingAndNorthing 3 жыл бұрын
You are like Jesus to me Matthias ┌[ ◔ ͜ ʖ ◔ ]┐
@TenMinutePhysics
@TenMinutePhysics 3 жыл бұрын
Thx :-) Well, I can't turn water into wine but I have more than 12 subscribers :-)
@mrc-kit83
@mrc-kit83 Жыл бұрын
🤣@@TenMinutePhysics
@BoothVito-z3y
@BoothVito-z3y 3 ай бұрын
Koelpin Unions
@EmersonDershem-e6b
@EmersonDershem-e6b 3 ай бұрын
Ophelia Way
@WallisLincoln-c1y
@WallisLincoln-c1y 3 ай бұрын
Maggio Stream
@JeremySampson-p7w
@JeremySampson-p7w 3 ай бұрын
Schaden Flat
10 - Simple and unbreakable simulation of soft bodies
13:53
Ten Minute Physics
Рет қаралды 19 М.
22  - How to write a rigid body simulator
16:35
Ten Minute Physics
Рет қаралды 6 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 61 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 37 МЛН
SCA2020: Detailed Rigid Body Simulation with Extended Position Based Dynamics
15:59
Matthias Müller-Fischer
Рет қаралды 19 М.
A Position-Based Material Point Method
14:10
SEED – Electronic Arts
Рет қаралды 3,5 М.
17 - How to write an Eulerian fluid simulator with 200 lines of code.
12:05
Ten Minute Physics
Рет қаралды 311 М.
CIS563, 2015, Position Based Dynamics
1:19:49
Ladislav Kavan
Рет қаралды 13 М.
07 - Intuitive 3d Vector Math for Simulations
18:33
Ten Minute Physics
Рет қаралды 8 М.
Realtime 2D Gravity Simulation
12:31
Brendan Galea
Рет қаралды 420 М.
Making the Stanford Bunny explode using XPBD | Devlog Episode 2
20:10
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 2 МЛН
Finally, Deformation Simulation... in Real Time! 🚗
6:56
Two Minute Papers
Рет қаралды 494 М.