Creating my first rolling soft body tire (XPBD) | Devlog Episode 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 มิ.ย. 2024
  • I created a tire as the first model for my game and explain how I implemented normal mapping, mesh skinning and friction physics using the extended position based dynamics method.
    Links to the listed references
    XPBD: Position-Based Simulation of Compliant Constrained Dynamics
    matthias-research.github.io/p...
    Detailed Rigid Body Simulation with ExtendedPosition Based Dynamics
    matthias-research.github.io/p...
    Tutorial 13 : Normal Mapping
    www.opengl-tutorial.org/interm...
    12 - 100x speedup for soft body simulations
    • 12 - 100x speedup for ...
    Outro music
    • Minecraft Piano Medley...
    Thank you ‪@ErikCPianoman‬ for letting others use your arrangements.
    If you are reading this, I love your arrangements.
    I hope this use case (outro music) is okay.
    The nature image in the beginning of the video was made by Maria Orlova, I downloaded it from Pexels.
    0:00 Intro
    0:37 Creating the tire
    2:11 Normal mapping basics
    6:35 Normal mapping tips
    9:37 AO map
    10:09 New scene
    10:24 Tetrahedral mesh generation
    13:12 Mesh skinning
    17:32 Collision handling
    22:54 Static friction
    25:15 Kinetic friction
    26:52 Results
    28:12 The end

ความคิดเห็น • 82

  • @murrent
    @murrent 11 หลายเดือนก่อน +24

    This is golden, love how in-depth you explain

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน +1

      Thank you, glad you like it

  • @williamchurch8401
    @williamchurch8401 11 หลายเดือนก่อน +9

    Thank you for sharing your journey through XPBD. I am also Implementing it for my game as well. Your in-depth explanations and troubleshooting are amazing!

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Thank you! Very glad to hear that

  • @sargates
    @sargates 11 หลายเดือนก่อน +2

    This has been a great series so far, please keep making videos like this

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Thank you! Comments like yours keep me going

  • @_XoR_
    @_XoR_ 11 หลายเดือนก่อน

    Another top video, definitely one of the most underrated channels 💪🏻

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Wow thanks :))

  • @alexandrepv
    @alexandrepv 10 หลายเดือนก่อน

    Absolutely amasing :) Please keep this series alive at all costs! I'm also working on a physics simulation engine and these are immensely helpful. Very well-explained and well-structured :) Subscribed!

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      So kind, thank you :)

  • @oblivion_2852
    @oblivion_2852 11 หลายเดือนก่อน +2

    I love how you describe the math. I love that you're using dear imgui. I also love the meme at the end about how difficult simulation science can get. My second major in university was simulation science and this mostly goes over my head but I'm here for it!

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      :D Thanks for your kind words. Does that mean you're basically an expert?

  • @solcloud
    @solcloud 11 หลายเดือนก่อน

    Good progress, keep it up! 👍

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Thanks!

  • @vicenteeduardo5598
    @vicenteeduardo5598 11 หลายเดือนก่อน +1

    I really like how it is going, just thinking, how can a content so good like this be seen for so little people, definetly sharing this vid with every single person i know on earth

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      That's so kind, thank you. I am reminded through the comments that there are at least a few people who like my content, which makes me want to continue.
      Let me know how your parents like the video 😁

    • @vicenteeduardo5598
      @vicenteeduardo5598 11 หลายเดือนก่อน

      @@blackedoutk LOL, not just my parents, my imaginary frinds as well 🤣🤣

  • @delphicdescant
    @delphicdescant 11 หลายเดือนก่อน

    I'm glad you take the time to go on a "tangent" (haha) about normal mapping, even though it's not really necessary for your core demonstration here.
    I bet a lot of people watching have been used to normal mapping for years, but seeing one more perspective on how the math works is still a good refresher, and obviously helpful to whatever people may be watching who have no experience in computer graphics at all (may fortune favor their boldness).

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Haha, yeah, it isn't really necessary but I was a bit frustrated by the amount of information I found about tangent space interpolation and baking in that regard. Also, I find that one image on the learnopengl website depicting how to compute the tangent and bitangent vectors not really helpful, so I wanted to share my intuition for it.
      I am happy you don't think it was superfluous even though you might already be familiar with the matter.

  • @triplezgames3882
    @triplezgames3882 10 หลายเดือนก่อน

    Your channel is gonna blow up soon, hidden gem 💎

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน +1

      Thanks :) sounds exciting

  • @darknetworld
    @darknetworld 11 หลายเดือนก่อน +3

    Wow it look real rubber tire.

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Great :D

  • @user-vw7zl7ho7i
    @user-vw7zl7ho7i 10 หลายเดือนก่อน

    just a regular vfx guy passing by! really appreciate for the detailed explanation about dynamic theory. I want understand everything but too dumb to do so haha.

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      Oh vfx, cool! Sometimes I wish I could do that. Making video animations takes longer than writing the game x.x Were my explanations understandable?

    • @user-vw7zl7ho7i
      @user-vw7zl7ho7i 9 หลายเดือนก่อน

      @@blackedoutk I only blame myself for not being able to fully understand the concept! But your explanations are very clear and informative!

    • @blackedoutk
      @blackedoutk  9 หลายเดือนก่อน +1

      @@user-vw7zl7ho7i That's great to hear. If you have a question feel free to ask me.

  • @agentklaas
    @agentklaas 11 หลายเดือนก่อน +2

    I'm working on a very similar physics engine based on XPBD at the moment, so it's really motivating to see someone else go through some of the same struggles.
    For your soft body constraints, have you seen the paper titled "A Constraint-based Formulation of Stable Neo-Hookean Materials" by the same authors as the original XPBD papers?
    It's not that much more complicated than a spring mass model + volume constraint and it seems to have some benefits

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      Nice, I haven't read the paper but I wanted to do that for some time now. It's based one the continuum mechanics deformation physics right? Have you implemented it?

    • @agentklaas
      @agentklaas 11 หลายเดือนก่อน

      @@blackedoutk I think so, yes, as it makes use of the deformation gradient tensor. They do provide a straightforward way of discretizing it to tetraheders, though. (Unfortunately while skipping quite a few steps of the gradient calculation.)
      I have implemented it, yes, mostly following their code example. You'll find it if you look for the appendix to that paper

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      @@agentklaas Definitely sounds very interesting, but for my videos I would want to explain the maths when I implement this and it's very challenging. Maybe someday

    • @Xphy
      @Xphy 10 หลายเดือนก่อน

      ​@@agentklaasim doing the same, can u provide me with ur github or email to have a discussion

  • @rashshawn779
    @rashshawn779 11 หลายเดือนก่อน

    The tyre is too beautiful.

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      I am happy to hear that

  • @StevenHokins
    @StevenHokins 11 หลายเดือนก่อน

    Let's roll! ❤

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน +1

      yesss

  • @terrastudiosdev
    @terrastudiosdev 10 หลายเดือนก่อน

    i love this series

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      happy to hear that

    • @terrastudiosdev
      @terrastudiosdev 10 หลายเดือนก่อน

      @@blackedoutk yeah, i am currently working on a game engine myself and I know how hard it could be to code something THIS impressive

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      @@terrastudiosdev oh wow thanks :) it can definitely be frustrating at times, but even better once it works

    • @terrastudiosdev
      @terrastudiosdev 10 หลายเดือนก่อน

      @@blackedoutk yea, when you see that your code is working. Especially if you had 10GigaByte of error logs befor

    • @terrastudiosdev
      @terrastudiosdev 10 หลายเดือนก่อน

      @@blackedoutk do you have an github repo for your code? I think it would be nice to see this.

  • @cirno6358
    @cirno6358 7 หลายเดือนก่อน

    Great video, I love how in-depth and specific your explanations are! At 24:30, I'm a bit confused as to why you multiply the dot product of DeltaP and N by N; shouldn't you divide by N? I think you said N is normalised anyway so it shouldn't matter, but I think I'm misunderstanding something. Also, do you know of any good resources to study stress and strain tensors for potential use in these kinds of physics simulations?

    • @blackedoutk
      @blackedoutk  7 หลายเดือนก่อน

      Thank you, that's great to hear :) Many of these computations require that N is normalized. It originates from this TriangleNormal function you can see at 20:40 in the collision detection. I didn't show the corresponding code but the function does normalize the vector before returning it.
      And you're right, if N wasn't normalized then Dot(DeltaP, N)*N would have to be divided by the length of N squared, such that each of the two N would get normalized. Though I am not sure what what Dot(DeltaP, N)/N would mean, because dividing a scalar by a vector is not well defined as far as I'm aware. The mentioned dot product is the signed length of DeltaP along normal direction, meaning it is a scalar. It is multiplied by N because we don't just want the length but we want the actual vector.
      I haven't studied stress and strain tensors or the physics of deformable bodies as much as I probably should have so I can't specifically recommend any resources, but can point you to a few ones I stumbled upon so far.
      The references of the simulation lecture I attended contained this www.femdefo.org/ and a book "Nonlinear Continuum Mechanics for Finite Element Analysis" by Richard D. Wood and J. Bonet. Keep in mind though that I only read the beginning of these and actually I thought they (especially the book) were kind of hard.
      This video th-cam.com/video/YxXyN2ifK8A/w-d-xo.html contains nice visualizations of what a tensor is and applies it to stresses.
      Two other videos that might be interesting in that regard are this th-cam.com/video/ngaYNdNtbec/w-d-xo.html and this th-cam.com/video/4Vk7Ar3COJA/w-d-xo.html but I haven't had the time to watch it, so I can't say if it's good.
      Section 5.8 in this publication matthias-research.github.io/pages/publications/PBDTutorial2017-CourseNotes.pdf talks a bit about continuous materials and how they can be used in the xpbd framework.
      I hope this is somewhat helpful. Remember that the maths of the finite element method are pretty brutal. If you find some good resources I'd be happy if you'd let me know too

  • @94HellGate
    @94HellGate 11 หลายเดือนก่อน

    the proper way to avoid those ghost forces would probably be double buffering similar to how you would do in a compute shader way. but great progress!

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน +1

      Thanks! Yeah, I definitely think it has something to do with the constraint solve, but we'll see eventually

  • @mithshack
    @mithshack 10 หลายเดือนก่อน

    Is it possible for you to add some sort of damping force to the tire so that it doesn't keep wiggling

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      Yes that is possible. Section 5 of the XPBD paper is dedicated to constraint damping. It seems you just need to adjust the computation of the delta lambda variable, but I haven't made an effort to understand it so far because they use an implicit integration scheme which naturally dissipates energy.
      But you're right, the wiggling doesn't look very realistic for a tire which should be more rigid. In this case however, I had set all inverse stiffnesses to zero, so if the solver were perfect the tire wouldn't actually be soft at all. The softness comes from the fact that the constraints are not solved exactly. When I increase the number of time steps or the number of solver iterations the tire does almost not wiggle anymore. Would be interesting to see what damping does to the situation

  • @pingvin9166
    @pingvin9166 11 หลายเดือนก่อน

    It looks great, but is it possible to make soft bodies jump strongly, but in such a way that they behave like this wheel, at least outwardly.

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน +1

      Thanks. What do you mean exactly? I am not sure I fully understand

    • @pingvin9166
      @pingvin9166 11 หลายเดือนก่อน

      @@blackedoutk Іn game engines, physical objects have a bounce parameter, but when it comes to soft bodies, everything is limited to a slight upward jump after falling, is it possible to make it so that a soft body can bounce physically correctly, over relatively long distances?

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      ​@@pingvin9166 Ah, you mean where the object would bounce back to the height it was dropped at? That's a good question. I think that would certainly be possible but it might require much more sophisticated simulation methods.
      The mass spring system I use isn't really physically accurate in the sense that materials like rubber aren't made out of springs. Also the simulation method does use implicit time discretization and approximations which weaken the energy conservation. When I increase the number simulation steps the tire does actually bounce higher.

  • @Xphy
    @Xphy 10 หลายเดือนก่อน

    You have exam may i know what level do u study in or how old are you
    I want to take the same path as you

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      I study computer science and am still basically of average university student age. Because CS is such a huge field, at least I had a lot of options when choosing what lectures I want to attend. For these topics I would recommend computer graphics, computer animation or simulation lectures.
      Btw I sent you an email some time ago but you haven't responded :(

  • @kritik_mb2144
    @kritik_mb2144 11 หลายเดือนก่อน +1

    When you get really good, Can you contribute code for physics related things in Godot game engine? 😅

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน +1

      Haha maybe, but that would still be far in the future. I think there are a lot of people with way more experience than I have.

    • @kritik_mb2144
      @kritik_mb2144 11 หลายเดือนก่อน

      @@blackedoutk The physics library 'Jolt' they are talking about integrating into the game engine actually lacks soft body implementation which is the main reason why the integration is getting delayed until the library is "feature complete". That is why I thought you could help as you are doing some really cool softbody simulations over here.

    • @blackedoutk
      @blackedoutk  11 หลายเดือนก่อน

      @@kritik_mb2144 That sounds a bit urgent. I'd have to read up on how Jolt works which would take quite some time. For now I first want to gain more experience in simulation methods before I feel confident enough to approach such a task

    • @kritik_mb2144
      @kritik_mb2144 11 หลายเดือนก่อน

      @@blackedoutk Yeah, please don't feel any responsibility regarding the matter. I just wanted to know what you would think about contributing to Godot, just out of curiosity.
      Btw your videos are really interesting since I have been wanting to get into physics programming for a while. Keep up the good work👍

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      ​@@kritik_mb2144 Thanks! Physics programming is definitely really fun, but the maths is quite challenging

  • @desine_
    @desine_ 10 หลายเดือนก่อน

    Are you planing on making a discord server?
    It would be easier to communicate this way.

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน +1

      I didn't want to create one because I felt like it would be a dead server. But it's true it would be an easy way to communicate. I'll think about it. For now you can send me an email or try to find my profile on the TenMinutePhysics discord server

  • @desine_
    @desine_ 10 หลายเดือนก่อน

    I have watched all of your videos, what can i say: very interesting, I understood none of that. haha
    I get the idea how it should work, what forces should be present, but I'm bad at physics and don't know how to imploment any of that code that you've shown in Unity my self.
    Therefore, it would be greatly appreciated if you could make this in Unity, it would help us to learn this!

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      I am happy you find it interesting, but of course my goal is to make you understand the concepts too :D
      What would help you implement this in Unity, except me providing you with a solution? I would encourage you to just try it. For example is it maybe possible to adjust the vertex positions in the FixedUpdate function? I am not super experienced in Unity myself.

    • @desine_
      @desine_ 10 หลายเดือนก่อน

      @@blackedoutk Don't worry about "me trying things" part ))
      And I've tried boing softbodies in Unity, I got stuck on "how to adjust the right vertex position", cause I need to find relative position and I don't know how to do it. If the wheel is rolled 90 degrees clockwise it will still deform on its bottom (out left) in contact with ground.
      I'm trying to find solutions, and I'm interested in learning things asd. i'm just bad at physics and kinda noob it Unity.
      Yes, I would be grateful if you would give me the solution, but it's not the only point, I want to learn how it's done and be able to implement it by myself.
      "What would help you implement this in Unity" - I don't know, cause I have not figured out the solution yet :0 Also, please talk more about friction and how it is being affected

    • @desine_
      @desine_ 10 หลายเดือนก่อน

      And about the solution: I've used your tire friction explanation as a reference to make my own
      th-cam.com/channels/IoHjfiFu_F_bWhS4P53QDQ.html

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      @@desine_ But that's good if you already made it deform! I think the problem you're having is that the vertex positions are in the mesh's local space / object space. If you multiply the points with the object's transformation matrix you get the points in world space. Then run the simulation algorithm and put them back using the inverse transformation matrix.
      To do that it seems like you can transform.TransformPoint and transform.InverseTransformPoint. However the process I just descibed might be very slow, you'll have to see. Better would probably be to store the world space points in an array and render them directly, meaning the transform would just be the identity matrix.
      As long as you have fun experimenting and learning new things you are on a good path I think. I remember the first time I did something in Unity. I understood nothing at all.

    • @desine_
      @desine_ 10 หลายเดือนก่อน

      ​@@blackedoutk Yes, I need to convert the contact point to local contact point of the tire. And I know that it is posible, but I have not yet understood how to "multiply the points with the object's transformation matrix".
      Vectors are hard for me. I probably should whatch more "3blue1brown" :)
      p.s. I dont need to convert the vertex back to global, I just need to find vertex to move, move it and update the objects mesh

  • @tortue5080
    @tortue5080 10 หลายเดือนก่อน

    Hi, I would enjoy showing this video to my grandpa, but he only speaks French. Could I, if a way exists, add French subtitles to your video ?

    • @blackedoutk
      @blackedoutk  10 หลายเดือนก่อน

      That's so cool, sure! Is your grandpa familiar with this stuff?
      Community subtitles don't exist anymore I think, but I can send you the auto generated english subtitles with timestamps. Would that work for you? You can send me an email or a discord message so I can get your contact info. My discord name is the same as my GitHub name.

    • @tortue5080
      @tortue5080 10 หลายเดือนก่อน

      Thanks a lot ! My grandpa knows pretty well maths and physics , and i'm slightly introducing him to this stuff. This would be great for him, as I think i'm gonna do some physics project too, but i don't have enough explanation skills. Sending subtitles sounds great, thank you in advance ! I've added you on Discord

  • @quantumdeveloper2733
    @quantumdeveloper2733 11 หลายเดือนก่อน +1

    Please don't reply :P