No video

09 Getting ready to simulate the world with XPBD

  Рет қаралды 20,112

Ten Minute Physics

Ten Minute Physics

Күн бұрын

For the tutorial notes and the source html code and all other tutorials see matthias-research.github.io/p...
In this tutorial I introduce general extended position based dynamics or XPBD, a simple and unbreakable method to simulate almost everything. The tutorial is self contained. However, I highly recommend to watch tutorial 7 first to refresh your 3d math.

Пікірлер: 67
@user-ef3ej4pq4f
@user-ef3ej4pq4f 2 жыл бұрын
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 Жыл бұрын
This channel is a gold mine
@shantih19
@shantih19 2 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
@@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
@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
@bankrupt3am932
@bankrupt3am932 9 ай бұрын
This channel actually has the best most helpfull easy to under stand information i could find for the past few weeks. Thank you ❤
@kiaranr
@kiaranr 2 жыл бұрын
Thank you for these videos. They are a fantastic supplement to your papers.
@mariovelez578
@mariovelez578 22 күн бұрын
This video is incredible! Everything is making sense now, thank you for sharing!
@Stefanhimself
@Stefanhimself 2 жыл бұрын
Thanks matthis, great stuff. Really cleared things up for me.
@motbus3
@motbus3 Жыл бұрын
Hey dude. Your videos are great. This series is fantastic
@XAPKOHHEH
@XAPKOHHEH 7 ай бұрын
single most brilliant cg physics channel!
@toshi4186
@toshi4186 2 жыл бұрын
Thank you so much! Unvaluable learning material...
@TheGameLix
@TheGameLix Жыл бұрын
Fantastic work! Very helpful!
@ivanhoffmann7266
@ivanhoffmann7266 2 жыл бұрын
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 2 жыл бұрын
Right, I used shape matching there because it is stiffer. We have volume conserving sm now so we could fix it.
@zhitongcui6471
@zhitongcui6471 5 ай бұрын
Very excellent tutorial!
@Christobanistan
@Christobanistan 3 ай бұрын
I wish I could follow even a little of this. It looks very cool.
@yunjay99
@yunjay99 Жыл бұрын
I'm a great fan, hope to be on your team some day.
@themlnsshow
@themlnsshow 2 жыл бұрын
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 2 жыл бұрын
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!
@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 3 ай бұрын
OK I can't even figure out what integration means. 😿
@mariovelez578
@mariovelez578 22 күн бұрын
@@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 21 күн бұрын
@@mariovelez578 So integration is just plugging in a factor to an equation to get another value?
@mariovelez578
@mariovelez578 21 күн бұрын
@@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).
@lawrencesmith2861
@lawrencesmith2861 2 жыл бұрын
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 2 жыл бұрын
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.
@fredda6787
@fredda6787 Жыл бұрын
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?
@stewieyan
@stewieyan 2 жыл бұрын
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!
@ollied2025
@ollied2025 10 ай бұрын
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 2 жыл бұрын
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 2 жыл бұрын
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.
@choonsy
@choonsy Жыл бұрын
fascinating how this is so similar to how deep learning algorithms work by seeking the minimum error
@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?
@andriinikolaiev8255
@andriinikolaiev8255 2 жыл бұрын
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 2 жыл бұрын
You are right. I noticed it too and fixed it in the pdf, cannot fix it in the video.
@andriinikolaiev8255
@andriinikolaiev8255 2 жыл бұрын
@@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
@voxelltech
@voxelltech 2 жыл бұрын
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.
@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?
@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?
@GermanTutorials
@GermanTutorials 17 күн бұрын
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!
@BrezhnevStan
@BrezhnevStan 10 ай бұрын
Could you please upload an example of this in python or c++ as a guide?
@user-gy6cw7sx3q
@user-gy6cw7sx3q 2 ай бұрын
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
@blastbuilder2430
@blastbuilder2430 2 ай бұрын
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.
@naztar4323
@naztar4323 9 ай бұрын
I am a soft brained Person yet some how i can understand 10/10
@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 2 ай бұрын
does XPBD not have a factor of lambda*alpha to the numerator of the calculation of lambda?
@yizhang7027
@yizhang7027 2 жыл бұрын
2:20 Why does't impulse-based simulation have overshooting problem? How exactly does it control velocity update?
@yizhang7027
@yizhang7027 Жыл бұрын
The difference here is that forces take effect over time, while impulses take effect at an instant.
@ghostbusterz
@ghostbusterz 5 ай бұрын
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 2 ай бұрын
There's a minus in front of the rhs of C2
@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.
@stati5tik
@stati5tik 18 күн бұрын
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? _
@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.
@EastingAndNorthing
@EastingAndNorthing 2 жыл бұрын
You are like Jesus to me Matthias ┌[ ◔ ͜ ʖ ◔ ]┐
@TenMinutePhysics
@TenMinutePhysics 2 жыл бұрын
Thx :-) Well, I can't turn water into wine but I have more than 12 subscribers :-)
@marcelinorguez
@marcelinorguez 11 ай бұрын
🤣@@TenMinutePhysics
07 - Intuitive 3d Vector Math for Simulations
18:33
Ten Minute Physics
Рет қаралды 7 М.
SCA2020: Detailed Rigid Body Simulation with Extended Position Based Dynamics
15:59
Matthias Müller-Fischer
Рет қаралды 18 М.
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 9 МЛН
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 14 МЛН
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 46 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 40 МЛН
17 - How to write an Eulerian fluid simulator with 200 lines of code.
12:05
Ten Minute Physics
Рет қаралды 290 М.
Making the Stanford Bunny explode using XPBD | Devlog Episode 2
20:10
Creating my first rolling soft body tire (XPBD) | Devlog Episode 4
29:58
Why Does Diffusion Work Better than Auto-Regression?
20:18
Algorithmic Simplicity
Рет қаралды 263 М.
11 - Finding collisions among thousands of objects blazing fast
11:04
Ten Minute Physics
Рет қаралды 22 М.
I'm Coding an Entire Physics Engine from Scratch
9:19
Gonkee
Рет қаралды 1,6 МЛН
The Clever Way to Count Tanks - Numberphile
16:45
Numberphile
Рет қаралды 817 М.
06 - The simplest way to simulate a triple pendulum
9:54
Ten Minute Physics
Рет қаралды 14 М.
Realtime 2D Gravity Simulation
12:31
Brendan Galea
Рет қаралды 406 М.
CIS563, 2015, Position Based Dynamics
1:19:49
Ladislav Kavan
Рет қаралды 12 М.
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 9 МЛН