Any tutorial for stitcher? - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html) +--- Thread: Any tutorial for stitcher? (/thread-3136.html) |
Any tutorial for stitcher? - Snail921 - 16-10-2021 Hi. I have been struggling to figure out how to use stitch constraints properly to connect multiple softbodies. Is there any video or tutorial of stitch constraints? [EDIT] Here are some more info regarding the problem I am struggling with. The obi stitcher has been set as you see in the image below. Each stitch has been set by AutoStitcher.cs which helps me to find indices of particle pairs and set all stitches in the Editor. (For better visualization of each stitch, I set each cube apart along X axis but they were located right next to each other when I set their stitches and hit play.) They looks ok to me but when I hit play, I get the result like the image below (Shown in wireframe mode). As you can see, the stitched particles are not lined up smoothly and they seem they are fighting (colliding) each other. Their softbody surface blueprint's Shape Smoothing and Anisotropy Neighborhood have been set to 0 so that I get all particles right on the mesh vertices. What else I should look into to make connect them seamlessly? By the way, this is the code I use to set stitches. It figure out all pairs and export them to a xml file in the play mode, then use the xml file to set stitches in the Editor. I know the workflow is a bit too cumbersome but I could not figure out how to get particle positions without running it. Is there any better way? Code: using System.Collections; RE: Any tutorial for stitcher? - josemendez - 18-10-2021 (16-10-2021, 11:23 AM)Snail921 Wrote: the stitched particles are not lined up smoothly and they seem they are fighting (colliding) each other. That's because they probably are! Unless you explicitly disable collisions between these particles, they will collide with each other. Coupled with the stitch constraints, this will lead to constraint fighting: particles are simultaneously trying to be exactly on top of each other (stitch), and away from each other (collision). This is the same issue described in the manual that happens between colliders and particles when using dynamic attachments (pin constraints): http://obi.virtualmethodstudio.com/manual/6.2/pinconstraints.html Just set the collision filters so that these particles in particular don't collide with each other. For info on collision filtering, see "collision filtering" in the collisions page: http://obi.virtualmethodstudio.com/manual/6.2/collisions.html At runtime, filters are just another per-particle property (like positions, velocities, etc), you can set them the usual way: http://obi.virtualmethodstudio.com/manual/6.2/scriptingparticles.html Obi contains a helper function (ObiUtils.MakeFilter) to build filters for you, so that you don't have to deal with bitwise operations too much. Filters are made of a mask and a category. The mask is the first parameter of the function. Just keep in mind the mask is a bit mask (just like Unity's layer masks), so you build it by simply or'ing together bits. For instance, to build a filter set in category 0, that only collides with categories 1, 3, and 6: Code: int mask = (1 << 1) | (1 << 3) | (1 << 6); RE: Any tutorial for stitcher? - Snail921 - 21-10-2021 Thank you for your help. I finally make it work perfectly all in runtime without exporting/importing xml files or manual property painting. My concern, at this moment, is that I may have problem when obi simulation keeps going and moves particles away while the AutoStitcher.cs is trying to find out particle pairs within the range of designated distance. Let me know your thought. Should I set stitches before starting (building) a game? Code: public void StitchActorsRuntime() RE: Any tutorial for stitcher? - josemendez - 21-10-2021 (21-10-2021, 06:45 AM)Snail921 Wrote: Thank you for your help. You're welcome! As far as your stitcher script goes, it seems to be single-threaded, synchronous code. If it runs as soon as the updater/solver are created, it should give them no chance to update the simulation and move particles around. You could also deactivate the updater component until you ass the stitches, this way the simulation won't be updated. Where is this code being run, in relation to the solver? RE: Any tutorial for stitcher? - Snail921 - 21-10-2021 (21-10-2021, 08:33 AM)josemendez Wrote: You're welcome!I see, I think I got it though I think I still need to deepen my understanding about obi. The solver is in the scene already and the code runs right after the scene starts. So code should work ok always if I understand your explanation correctly. By the way, I read the your post regarding Full Body Volumetric Particles. Quote:- Geodesic voxel clustering: automatic optimal cluster radius, clusters don't "jump" trough gaps in the model. For instance, clusters from the right leg of a character won't include particles from the left leg, even if they're spatially very close.The geodesic voxel clustering has been exactly what I have been waiting for and the current obi's lack of that functionality is the one of reasons why I am trying to automate stitching process. I can't wait for the update! Your asset is always so exciting! RE: Any tutorial for stitcher? - josemendez - 22-10-2021 (21-10-2021, 05:16 PM)Snail921 Wrote: I see, I think I got it though I think I still need to deepen my understanding about obi. Thanks! Judging from the screenshots, I see you're using lego-like pieces as your softbodies. If you could send over a few of those (to support(at)virtualmethodstudio.com), I can test the new blueprint generator with them to ensure it does a good job - and if it doesn't, fix it. Testing real-world use cases is always helpful to improve things! cheers, RE: Any tutorial for stitcher? - Snail921 - 23-10-2021 (22-10-2021, 07:44 AM)josemendez Wrote: Thanks!Yep, glad helping you. I have just sent some. If you don't get it, let me know, please. RE: Any tutorial for stitcher? - josemendez - 25-10-2021 (23-10-2021, 08:36 AM)Snail921 Wrote: Yep, glad helping you. I have just sent some. Received, just downloaded them. Will get back to you with test results. |