Jump to content

The physic of a rug


AmazingWorld75
 Share

You are about to reply to a thread that has been inactive for 2341 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

31 minutes ago, AmazingWorld75 said:

What is wrong with it ?

Three possibilties srping to mind immediately:

  1. You forgot to change the physics type to prim after uplaoding or
  2. You uploaded with unanalyzed physics
  3. You uploaded with analyzed physics and didn't compensate for the walking elevation error analyzed physics has

 

Edited by ChinRey
Link to comment
Share on other sites

4. Your rug is less than 0.5 meters in one dimension. It silently uses convex hull physics even if it's set to Prim physics.  IIRC, to make it work you'll have to add hidden geometry to make all dimensions larger than 0.5 meters, and it requires a triangle based physics mesh, and indeed will have to be set to type Prim.

  • Like 1
Link to comment
Share on other sites

I was editing my post with a more detailed explanation just as Arton chimed in. Maybe better I do the sequel as a new psot rather than an edit.

I suppose #1 on my list is not the issue but in case it is, a mesh you have uploaded will always have its physics set to convex hull. If you need a more detailed physics shape, you have to change it to prim physics manually after uploading.

The uploader gives you two different options how to handle the physics model, you can upload without analyzing the physics and end up with a shape exactly like the model you used as the basis, or you can analyze the physics which means the uploader will try to merge the triangles of the physics model into one or more hulls. Both methods have their pros and cons and both are problematic for what you are trying to do:

Unanalyzed physics only works for items with a minimum size of 0.5 m along each axis. If it's smaller than that, it will always be treated as a convex hull inworld even if the physics type has been changed to prim. One solution is, as Arton suggested, to add some extra hidden geometry. A single triangle hidden underneath the floor should be enough. You may want to place it a little bit further away than 0.5 m from the carpet itself because if you don't you may end up with rather high land impact.

Analyzed physics has no such problems, it works the same regardless of dimensions. But it's not really precise enough to be used for walkable surfaces. There is a built-in gap between an analyzed physics model and any avatar or physical objects that tries to come near it. One solution there would be to add some extra geometry slightly above the rug somewhere to trick the sim server to beleive the walking surface is slightly lower than it actually is. You have to be prepared dor some serious trial and error if you want precise walking elevation with analyzed phsyics though and generally it should only be used for walkable surfaces when there is no other option - or when the surface is so sloped you can't get precise elevation anyway.

With all that being said, if me and Arton understand you right, you want the walking elevation to follow the wrinkles of the rug. You know, if I saw that in real life, I would be really, really worried about the rug owner's hygiene. ;)

If we misunderstood you and all you actually want to do is get your feet back on the floor, there's a very simple solution: set the rug to phantom.

Edited by ChinRey
Link to comment
Share on other sites

23 minutes ago, ChinRey said:

With all that being said, if me and Arton understand you right, you want the walking elevation to follow the wrinkles of the rug. You know, if I saw that in real life, I would be really, really worried about the rug owner's hygiene. ;)

Hehe, true. ^_^

Link to comment
Share on other sites

So do i have to use prim option no matter what ? Yes, rug was less than 0,5 m. Then as you told, i added a hidden surface making it 0,53 m. i uploaded and set physics to prim. Omg, it ended up with 450 LI. Also i didn't get the logic @ "add some extra geometry slightly above the rug somewhere to trick the sim server to beleive the walking surface is slightly lower than it actually is." You put extra geometry above but it reads surface lower ?

Edited by AmazingWorld75
Link to comment
Share on other sites

6 hours ago, AmazingWorld75 said:

So do i have to use prim option no matter what ? Yes, rug was less than 0,5 m. Then as you told, i added a hidden surface making it 0,53 m. i uploaded and set physics to prim. Omg, it ended up with 450 LI. Also i didn't get the logic @ "add some extra geometry slightly above the rug somewhere to trick the sim server to beleive the walking surface is slightly lower than it actually is." You put extra geometry above but it reads surface lower ?

Yes, for accurate physics it requires the Prim option. Otherwise the entire mesh will be encompassed by a single convex hull.

Here are some pictures to illustrate how to offset the physics shape:
Physics01.jpg.4cfb4a1c1821bb86550236beb47716d8.jpg

Physics02.jpg.f48385ffdf77c1fbe09bbf2b16fb83be.jpg

 

4 hours ago, AmazingWorld75 said:

By the way, isn't 0,5 meters too much for it ? Even walls of a building are not that thick. 

Yes, it seems much. For walls of a building it's not that much of a problem though, because it only applies to triangle based physics shapes. If you analyze the mesh into a set of convex Hulls you can go thinner than 0.5, and doorways will be kept open. And the 5 cm gap isn't much of an issue on walls as well.

It's set up that way because small, and/or long thin triangles can be expensive to compute for the physics engine, which is why you see this insanely high land impact as well.

Edited by arton Rotaru
  • Like 2
Link to comment
Share on other sites

17 hours ago, AmazingWorld75 said:

By the way, isn't 0,5 meters too much for it ? Even walls of a building are not that thick. 

It is and it's a trap many inexpereinced builders fall into when they try to make walls with doorways. You don't usually walk on walls though and they generally require fairly simple physics so you can do it with only a few hulls worth of analyzed physics.

Floors with open stairwells are always problematic though. There are several tricks to work around the problem (including the two we mentioned) but no real good solution.

 

18 hours ago, AmazingWorld75 said:

So do i have to use prim option no matter what ? Yes, rug was less than 0,5 m. Then as you told, i added a hidden surface making it 0,53 m. i uploaded and set physics to prim. Omg, it ended up with 450 LI.

Yes, if you go that route, you probably want to increase it further than that.

The reason for this mess is that is that at some point in the calculation the estimated phsyics load is divided by the smallest of the three total dimension of the object. You may think that doesn't make sense and I agreed with you when I started writing this reply. But then I decided I'd better make sure. Unfortunately it made me unsure instead...

Here are 32 physical spheres with 0.57 m diameter that have just been dropped down from 3 m above the ground in an empty sandbox:

5a110f0e17d4d_Skjermbilde(633).thumb.png.9a56e59991ffff721c9b223f0d9103b3.png

The action caused the Physics Time to jump from aroun 0.05 to 0.2. Spheres are useful as a benchmark here because they use a special physics shape even more efficient than the triangle lsits and hulls we have access to for meshes.

Rinse and repeat with twisted toruses of the same size, each with a 455.1 physics weight:

5a11105f70a54_Skjermbilde(636).thumb.png.e98a63bd66f74f82ca329099246eba22.png

Physics time jumped to a whopping 23! In fact the first time I tried, it peaked at over 40, overloading the sim for a few seconds but ummm... I forgot to take a screenshot. The difference between the two results was probably due to how the toruses were distrubuted and how much they bounced into each other. The difference between spheres and twisted toruses is to big to be a coincidence though. The increased calculated physics weight does indeed refelct an actual increase in the load. But that's no surprise, we know that the twiste toruses ave more complex physics geometry than spheres. The question is, does size matter.

 

Here is the same twisted torus shape scaled up to 1.5 m, cutting the calculated physics weight in half. There are still 32 of them, but they were to big to fit into the picture:

5a1112856795a_Skjermbilde(637).thumb.png.c4d8b3ded60880cc8381c724ab5854b0.png

16.7. That is significantly lower than the smaller ones but not anywhere near half the physics time and it is within the margin of error... barely.

 

From this quick test it seems that the actual physics load for objects with triangle list physics does increase with reduced obejct size but not nearly as much as the calculated value indicates. We need more tests to be sure though.

 

Edit: Since both me and Arton are getting awfully teachnical here, I suppose I better give a little bit of background details.

The physics shape of an object is completely separate from the visual shape. They're not even handled by the same computer, our computers take care of the looks, the sim server is responsible for the physics.

All common physics engines today are based on the same principles and they use both volume based and surface based models. If it's a volume based model, the physics engine basically says you are not allowed inside this space - in principle it is similar to ban lines actually. With a surface based shape, the physics engine says "thou shallt not pass!"

Generally it is easier for the engine to handle volumes but there are exceptions.

There are seven different physics models, five volumes and two surfaces:

  • A sphere is the is the easiest one for the engine. All it has to do is check how far you are from a specific point - the center of the sphere. If yu are too close, it kicks you out. The only object in Second Life that uses sphere physics is - well the sphere prim.
  • A cube is also easy to handle. The engine has to calculate your distance separately along three different axises and that is of course three times as much data for it to handle in the end. But on the other hand, it doesn't need to do all the trigonometry a sphere requires so the difference in total workload is minute. Again, ther is only one object in SL that uses this shape and it is... you guessed it, the cube prim.
  • A capsule is a little bit trickier, but not much. A capsule is a sphere cut in half with a cylinder filling in the gap. It may look like a strange shape to include but it has turned ut to be quite useful. The avatar uses a capsule as its physics shape and so do most vehicles and other moving physical objects. It's detailed enough to follow the shape of an elongated object fairly well but still easy enough to calculate it shouldn't cause the physics engine too much sweat.
  • A triangle is one of the two surface models. A triangle has, of course, three corners and what the physics engine needs to do, is check if you are intruding on the space between those corners. It takes a bit of triangulation to decide so it's not as easy as the three simple volumes. The triangle can be used for meshes but it's not very common.
  • A cylinder is - as far as the physcs engine is concerned - a hybrid between the three simple shapes. It's a bit harder to handle and in Second Life it is only used for the clinder prim.
  • A convex hull - or just hull - is a fairly complex volume with no corners pointing inwards. I've seen it described as a "shrinkwrapped" shape and that's not a bad metaphor at all. If you click on the analyze button whe you upload a mesh, the uploader will try to convert the mesh into a set of convex hulls and it does it in rather strange ways unless you make your physics model in a way that leaves no doubt whatsoever which part belongs to which hull. One weird thing about hulls is that they always need a little bit of distance to avatars and other physical objects. That is why you will always hover slightly above a walking surface with analyzed physics. Linden Lab ahs tried to compensate for the flaw by shrinking the hull a fraction but you can't really do that precisely.
  • A triangle list is several triangles linked together. It's basically the same as a mesh and the physics model you feed into the uploader fits the description well. So if you don't analyze the physics of your meash, it is uploaded as a triangle list. The triangle list is the shape that causes the physics engine the most headache but can still be a good alternative to hulls since sometimes you would need a lot of hulls to get something that fits the visual model reasonably well.

There is actually an eight physics model too, the height map. In Second Life it is used as part of the ground physics and in theory it ought to be easier to handle than triangle lists. Apparently it isn't though.

That's VR physics 101 and it's nothing special for SL. The shapes are the same and they way they are used are pretty much the same for just about all virtual environment that has physics at all.

 

I probably should mention that physics type menu in the build window too. There are three options there:

  • Prim: a rather misleading name but it's what you select if you want to use the physics model you uploaded the mesh with.
  • Convex hull: Just like the convex hulls you get with analyzed physics except for one crucial detail: In the uploader you can assemble a physics shape from several convex hulls and get some complete shapes that way. The convex hull option in the build menu creates a single hull for the whole object by "shrink wrapping" the prim physics model.
  • None: No physics at all, the physics engine completely ignores the object. Obviously by far the option that puts the least strain on the engine and it should be used a lot more.
Edited by ChinRey
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

On 20.11.2017 at 1:41 PM, AmazingWorld75 said:

Arton, do you use plane as physics, although you have an extra cube geometry in that example ?

Yes, it's just a copy of the High LOD mesh in that example. So yes, it's just plane geometry. The extra cube geometry is required to be able to offset the rugs physics. Otherwise the physics shape would snap to the bounding box dimensions of the rug, and any offset will be lapsed.

Of course, in an actual product you would want to make that extra geometry less obtrusive than a box.

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2341 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...