Jump to content

Problem with my physics model


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

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

Recommended Posts

I'm quite new to building things, so this might be obvious, but...

I've started building very simple building skeletons on Blender and importing them to SL. One of the first things I learnt was that I need to have physics in order to be able to walk inside the building. Since my structures are very simple, I initially used the SL-generated physics. However, I've build a slightly more complex model:

https://gyazo.com/deafbf44894de00978ff838b5f516299

Since the stairs have a lot of detail (they're a model downloaded from sketchfab), SL complains about "mesh too dense", so I tried creating this physics model:

https://gyazo.com/49e07907cd36d60f1008136326eeba21

Now, the preview seems to tell me everything's gonna be alright:

https://gyazo.com/c168cadc426f62e2427221f9d8b3fdaf

but once I upload it and rez it, the physics I see inworld is wrong:

https://gyazo.com/f0582bf7642791d2993669075790b35e

Just a solid cube! Also, there's no option in Edit > Features > Physics Shape Type to select "Prim". I get the same result whether I analyse the physics model or not when uploading.

What can I be doing wrong?

Link to comment
Share on other sites

2 hours ago, FastTortillaJuice said:

What can I be doing wrong?

You need to edit the mesh and change physics type from convex hull to prim after you've uploaded. This seems a bit awkward but it's actually an important safety measure against meshes that turn out to have way too complex physics.

There are a couple of other issues with your mesh and physics too and we can discuss them if you want to learn more about SL building but changing the physics type after uplaoding is th only really serious one.

Edited by ChinRey
  • Thanks 1
Link to comment
Share on other sites

5 minutes ago, ChinRey said:

You need to edit the mesh and change physics type from convex hull to prim after you've uploaded. This seems a bit awkward but it's actually an important safety measure against meshes that turn out to have way too complex physics.

Thank you for your answer. As I said, for some reason there's no option to change from convex hull to prim when I upload this model, and I have no idea why. I always had that option when uploading a model without a separate physics model.

 

Quote

There are a couple of other issues with your mesh and physics too and we can discuss them if you want to learn more about SL building but changing the physics type after uplaoding is th only really serious one.

I'd love to hear your comments about the issues you see, I'm eager to learn.

  • Like 1
Link to comment
Share on other sites

2 hours ago, FastTortillaJuice said:

Just a solid cube! Also, there's no option in Edit > Features > Physics Shape Type to select "Prim". I get the same result whether I analyse the physics model or not when uploading.

That sounds like you don't have matching physics models for each part of mesh. Is it a single mesh, or multiple parts uploading as a linkset? You must have an individual physics model for each individual mesh, named in the same order so the uploader can match them up.

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

29 minutes ago, ChinRey said:

You need to edit the mesh and change physics type from convex hull to prim after you've uploaded.

I believe this was tried already ............

2 hours ago, FastTortillaJuice said:

Also, there's no option in Edit > Features > Physics Shape Type to select "Prim". I get the same result whether I analyse the physics model or not when uploading.

As Rey has already mentioned there are some things not quite right in some of your screenshot but for the moment :

 

There are two questions you should be asking yourself when creating a Physics model for your building :

 

1:  Will I be using Box type or Planes type physics?

        You have chosen to use Box type therefore in the Physics options of the SL mesh uploader you need to hit that Analyze button.

 

2:  Am I complying with the 3 basic rules of creating a physics model ?

 

Rules are :

1: Each Object/model must have its own Physics model.

2: The Bounding Box dimensions (X Y Z) of the Physics model must be the same as the Bounding Box dimensions of the visual model.

3: Keep it as simple as possible.

 

Looks like you are not complying with rule 1 !

 

Lets forget the stairs for the moment and consider the rest of the model.

The 3 floors and supporting pillars are all one object in Blender right ?  If that is the case then rule 1 says that all the boxes you used to create your collision

surfaces also need to be a single mesh object.

Your image shows that they are not one object. So to start with, in Object mode select all the boxes you want to use for your Physics model and join them into a

single object using the keyboard shortcuts Ctrl J (Windows).

 

Still ignoring the stairs ………… now we have two objects the building and the buildings collision model.

Export each in turn as separate Collada files.

Building.dae

Building_PHYS.dae

 

In the SL mesh uploader load up the visual model, Building.dae, as usual into the High LoD slot.

Then open up the Physics tab and in Step 1 load up the Physics model, Building_PHYS.dae.

In Step 2 hit the Analyze button.

 

In the Preview window (with Preview, Physics box checked) you will see the collision surfaces now as a collection of coloured boxes (Hulls).

Calculate weights and fees and then Upload.

 

Rez the building and in the Edit floater > Features tab change the Physics Shape type from the default Convex Hull to Prim.

 

Now you should be able to walk around inside your Building. ?

 

While it is possible to upload multiple Objects (link-set) along with their corresponding Physics models in a single upload I would suggest for now that you

upload the stairs as separate uploads, and a simple wedge shape for the Physics model.

 

As a side note and something you should look into later: When creating Physics/Collision models for buildings it is usually better to not use the Box type Physics

but to use the Planes/triangle type Physics. I am sure Rey will explain the difference if you ask :)

 

 

 

 

 

 

 

 

 

Edited by Aquila Kytori
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

7 hours ago, FastTortillaJuice said:

As I said, for some reason there's no option to change from convex hull to prim when I upload this model, and I have no idea why.

Oh, I overlooked that. Sorry.

Rock and Aquila seem to think your build is split into several meshes. I assumed it wasn't since then you shouldn't have gotten the "mesh too dense" message in the first place. In any case, if you can't change the physics to prim, it means the mesh was uploaded without physics for some reason. It may have been a glitch during the uploading of course. That's very rare but it can happen.

In any case:

7 hours ago, FastTortillaJuice said:

I'd love to hear your comments about the issues you see, I'm eager to learn.

Since I'm not sure exactly how your build is put together and it's simple enough I can do it this way, I'll just describe how I probably would have made such a build and explain why.

I would make it as five parts, three meshes (one of them duplicated in-world) and one prim. This will give a land impact of 3 (2.5 to be exact but it's rounded up) with plenty of room for proper LoD models.

1. The fundament

This can be done as a prim. If you're obsessed about optimzation, as I am, add the smallest amount of taper to eliminate the mid-face/edge vertices and make the bottom of the prim 100% transparent.

The only reason I can see why you might want to sue a mesh here is if you're going to sell the build as "100% mesh". It doesn't really make any difference if you do but it's a waste of time and upload fee. If you do it as mesh, make a cube without the bottom face. For LoD, use model above, for physics a complete cube with the bottom face included and do not analyze.

This shape is so big and simple using simplified LoD models isn't going to make any difference neither to LI or actual load so we might as well keep it solid at all draw distances. As for the physics model, we don't use analyzed physics for walkable surfaces if we can avoid it and for a simple cube unanalyzed physics has the same physics weight as analyzed. We have to include the bottom face of the physics cube to avoid that pesky ray tracing bug that sometimes makes it impossible to rez on a mesh surface.

2. The pillars

Four cubes with the bottom faces removed, same model for all LoD levels. You might want to add the bottom faces for the physics model but it sholdn't be too important, it's not as if anybody is likely to try to rez anything on top of the pillars anyway. For this you use analyzed physics since nobody's going to walk on the pillars.

I see in your second screenshot you added invisible physics barriers along the edges of the whole build. If you want that, include it it the pillar mesh. If you do it the way shown in the picture, you'll end up with 12 cubes for the physics which will increase the LI quite a bit but if you do it as solid walls all around, you only need four cubes, low enough to keep the LI for the whole build down to 3.

(Oh, I see you already know but since others might read this too, when you use analyzed physics, make sure the hulls don't touch each other - always keep a little bit of space between them. If you don't the uploader will try to merge them and then split them up again, making a total mess of your physics model.)

3. The floors

Make both floors as a single mesh. This is to avoid the automatic switch to convex hull for very thin unanalyzed physics.

Again, you probably want to use the same model for all LoD levels. It's possible you want to remove the vertical faces for the low and lowest models but it shouldn't make any difference for a mesh as big and simple as this.

For physics, do not analyze for the same reason as mentioned above. You may or may not want to include the vertical parts in the physics model. It shuoldn't make any difference but the uploader/physics engine can be a little bit unpredictable here. As for the horizontal surfaces, just keep them exactly as they are in the visual model.

4 and 5. The stairs

Obviously you make and upload one staircase and then copy it in-world.

This is the trickiest part of the build but I happen to have a very similar one, only shorter, so I can show some pics:

bilde.png.5c626f340fdfc07d843591db857b975e.png

This is the model I use for high, mid and low LoD. It's only 46 tris so that'll do fine. One important thing here is to look at the tris for the sides:

bilde.png.a8a3bcbeaf9ec0e2ea3f8c5a55264cf3.png

That big tri is not connected to the small ones except at the end point. You have to be very precise with the positioning of the vertices both on the mesh and the UV map for this to work but it's not actually difficult to do and it saves two tris for each step in the staircase.

For the lowest LoD model I've simplified the sides a little bit:

bilde.png.e2974297f76281024bbaf0527af905b8.png

Those sides are single sided btw, only facing outwards.

Your staircase is much longer than mine. That means more tris so you may have to cut down on the LoD models a bit more, use the one like this at higher levels and also reduce the lower models even more. Fortunately it is also much bigger which means you can get away with simpler LoD models. The first thing to try is of course to reduce the sides down to a single tri each. I suppose you don't need an illustration of that.

The second thing is to merge the steps into a single slope but keep the risers:

bilde.png.46cb324e7cd9f6f96a989a2868c574e0.png

This is a really neat trick to simplify a staircase without reducing the looks too much.

If you still need to reduce further, collapse the risers into single tris:

bilde.png.312a84a9930102efb2dd234d984f0249.png

Step four would be to delete some of the risers completely but I really don't want to go that far and it shouldn't be necessary either.

Now, the physics.

It is actually possible to make a detailed physics model the uploader will accept and with more than low enough physics weight not to increase the LI. But there is another reason why ramp physics may be a better option for a staircase. The steps will never match the step length of your avatar so with detailed physics you will bump into the steps walking up and stumble over them walking down. But ramp physics has its drawbacks too so it's a tough call. What I do, is upload with detailed physics and simply switch to convex hull if I decide I want a ramp. It's not ideal since the elevation for the ramp will be a little bit too high but not so much it's a big deal.

If you want to upload with a ramp, you can do it with a thin ramp like the ones in your pictures or you can make the rest of the physics match the visual model:

bilde.png.6ab379d4bd296f63452733007954774b.png

I's a single hull in either case so it won't make any difference worth speaking of to the weights or the LI. In either case, make sure it's a complete hull (with the bottom face) and analyze it. (Yes, I know I said we don't use analyzed physics for walkable surfaces but for a staircase we'll never get precise elevation anyway.)

You want to make the ramp a little bit lower than the front edge of the steps but not too much. Something like this:

bilde.png.272677a06f4e77594cc0535e62e6c49a.png

 

Edited by ChinRey
Removing one of the typos
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Thank you so much for your kind help, everyone, and sorry it took a bit to answer.

Indeed my main problem was not having corresponding meshes, I didn't know they had to match! :)

I've also simplified the model, as your answers have recommended, separating the platform and the stairs, and have managed to upload the platform with a correct physics model that works as I wanted (with the barriers preventing my avatar to free fall accidentally and the holes for the stairs letting the avatar through), so I have a first success :D I haven't done anything with the stairs yet, or the textures, as this sounds a bit more complicated, and I hadn't thought about the LoD issues...

The solution you're proposing @ChinRey is a bit more scary, as it has a few more bits and pieces to assemble! I'm assuming these are "pro" tricks to reduce land impact and upload costs? Or are there other reasons as well to approach it this way? I'm fairly new both to building in SL and to blender, so maybe it's an obvious thing, but I've started under the assumption that it made sense to build for second life the way I'd build to render in blender, and maybe that's totally wrong and I shouldn't be trying to do that? In any case I think I'll try to build it this way next and compare.

Oh, and I just found about the beta grid. Good thing cause upload costs were starting to pile up lol

  • Like 2
Link to comment
Share on other sites

Ouch - yeah, don't go uploading test mesh if you're not on the beta grid (says me; did the very same thing when I started many years ago). Just checking: do you know about using local textures for free testing too, on the main grid that is? (Although it's useful on the beta grid too, because you can change a texture on your PC and see it change on the model in SL without having to bother uploading and applying it again).

If you're a premium member, make sure to use a premium beta sandbox. They are usually less busy and seem to run smoother to me. If you are not, and need to do scripts in a no-script, public sandbox, just rez a platform at 300m and you can run scripts up there. (Not sure exactly what the height break is).

Back to mesh: The other two who've replied above are well worth listening to; and look out older posts from them. They know what they are talking about.

Yes, it's all about controlling land impact (and giving SL's content servers peoples' PCs an easier time) versus visible detail at each LOD model. Basically, the further away from the object, the less actual detail it needs to have (because you can't see fancy edge bevelling with hardened normals from 20m away anyway). If you use Firestorm, there are some really useful tools in the edit window now (thanks largely to Beq Janus I believe). If you edit a mesh you've uploaded, it shows you the number of triangles in each LOD model, the switch point distance, and even lets you choose to view your different LOD models at the push of a button.

The switch points depend on the size of the mesh; they are individual for each piece and the larger the piece is, the further away you get to see the more detailed models before they switch over. For large structures like house parts, most of the time you'll be seeing 1st or 2nd LODs whereas for a smaller thing like the tables I've just made, you'll only see the 1st if you're in the room with it. For larger meshes, the number of triangles in 1st and 2nd LOD models have a big impact on the LI (because they stay visible for a long way, because they are big). For small objects you can get away with a lot more triangles in the 1st and second (so lots of nice detail close up, but only close up) but you'll get hammered for LI if you don't drop the number of tris down dramatically in the 3rd and 4th LOD models.

I tend to upload and test things on Firestorm's default LOD factor setting of 2, and make sure everything looks good at that. I'll move away from the object, going through the switch points, and try to optimize my models so that the switch is not really noticeable and the object still looks the shape it should at any (reasonable for the type of use expected) distance.

One thing: please, please don't let the SL uploader generate the lower LOD models for you; it does a terrible job. The only time I'll do that is during initial testing of the main model, before I've even made the other LOD models myself. You'll get better visuals and lower LI by doing it yourself.

Edit to add: By the way, I like that you've added what I call 'helper physics', so your avatar can't fall down places. I do that with stairways and the like (especially the spirals I just did), sometimes even to subtly guide the avatar into the right path around awkward corners or the like. Basically adding or extending physics beyond what is visible, to make it easier to use.

 

Edited by Rick Daylight
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Just some tips of what I do (hopefully useful as you progress):

1. Because you'll want to upload some parts of your build as analyzed, and some not (and maybe even another set analyzed as solid rather than surface, say, and in my case a set of 'duplicated' parts like window frames (see next point)), I do this:

Every 'set' has it's own collection folder in blender, and each set has a 'central cube' positioned in the same location for each and every set and LOD model (you must always have matching meshes in them all). Physics too to keep the count right there as well. Then I can upload the sets individually, each including its positioning cube, analyzing or not as required.

Then, Rez the resulting linksets in world, find the cube in each, edit linked, and if it's not the Root Prim unlink it and relink it so it is. Do that on each set. Now you can go to the object location in the Edit window, copy the location, and paste the location onto the other parts to align them perfectly and quickly. Then do what you want... unlink and discard the cubes, link the sets together...

2. As mentioned in the thread above, if you have identical meshes (like two sets of identical stairs, or ten window frames etc), upload just one and copy it in-world to put the building together. That way there is just one asset that needs downloading from the server, not ten or whatever. If there are a lot, I cheat a bit and upload them all in the beta grid in a complete, linked model exported from blender; all the frames etc present where they should be. Then I go around and name (edit linked) each frame, and then use a script to record the positions and rotations relative to my central cube (you didn't remove it yet, did you ;) ) copying the info onto a notecard.

Then, in the main grid, I upload the sets without the duplicates set, and upload just one of each type of duplicated part. Doors, window frames, roof edging, etc.. I drop scripts into each of those, texture them, add door scripts if need be, whatever, name them so the script knows what they are and put them into the contents of the main building. Then, in goes another script that reads the NC, rezzes duplicates of the parts, and positions them. It's great fun watching your building being assembled in front of your eyes :). The scripts even self-delete after positioning the parts.

That might sound like a lot of work, but in the house I just built there were (I think) 12 doors, 12 doorframes, 16 windows (some in two, some in three parts), 34 wall corner details, similar for roof caps and finials, etc. It would have taken ages to put it all together manually, carefully positioning them.

(Give me a shout in world and I'll pass you a copy of the scripts if you ever need them).

3. I tend to make my 2nd-highest LOD model first in Blender, then the 1st LOD model is made from a copy of that but with added edge bevelling/hardened normals and things like that which are only visible close up, but make a difference when you are. It's much easier to add them to a simpler model, than try to remove them if you make that more detailed model first. (an exception is that I'll usually put in any curved parts in the 2nd LOD model at the higher detail (number of segments) I want for the 1st, and then remove (delete edge loops or dissolve edges) them in the 2nd model after I've made my copy of it for the 1st. It's just easier that way, usually.)

4. Just to save you some pain... always unwrap and UV map your initial model, and test it works as you want, before copying it to increase/reduce details for the other LOD models. It really sucks if you forget to do a part and have to go back to the start (or try to unwrap and match up the UVs on the models). Can you tell I've done this once or twice? (You'll end up redoing parts anyway as you work, but it helps to minimize it where you can).

 

Edited by Rick Daylight
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

22 hours ago, FastTortillaJuice said:

I've started under the assumption that it made sense to build for second life the way I'd build to render in blender, and maybe that's totally wrong and I shouldn't be trying to do that?

Every 3D environment has its quirks and special requirements and Second Life is no exception. Nor is Blender for that matter. So if you want to build for an environment you're not famililar with, you have to be prepared to adjust your technique and approach, sometimes a lot, sometimes just a little bit.

 

23 hours ago, FastTortillaJuice said:

The solution you're proposing @ChinRey is a bit more scary, as it has a few more bits and pieces to assemble! I'm assuming these are "pro" tricks to reduce land impact and upload costs? Or are there other reasons as well to approach it this way?

Splitting shouldn't be scary at all. In fact, I think you'll find it easier to manage than uploading your meash in one big chunk. The trick is to learn from RL construction: don't eyeball the alignment of the parts but measure it!

A split mesh won't reduce the upload cost; it will probably incrase it but only by a few L$ - in this case we're talking less than ten cents of RL money. But when done intelligently, it has several other advantages:

  • Download weight and land impact
    • This is one of SL's strangest quirks. For some reason several smaller meshes tend to add up to a lower download weight than the same geometry merged into a single mesh even when all other conditions are the same.
    • Land impact is calculated from three "weights", estimating the amount of load the object puts on various parts of the system:
      • Server weight: How hard it is for the server to handle the object. This is always 0.5 for each mesh, sculpt and prim (plus sometiems a little bit extra for scripts).
      • Physics weight: How much load the object is assumed to put on the physics engine.
      • Download weight: A very rough and inexact estimate how much bandwidth it takes to transfer the object to the client.
    • It's the highest of these three weights counts as the land impact. Splitting will icnrease the server weight but, as I said, often reduce the download weight and as a rough rule-of-thumb you achieve the lowest possible LI when those two numbers are about the same.
  • Instancing
    • SL doesn't support true instancing but there's still a lot to save by reusing assets whenever possible
  • LOD handling
    • Different parts of a build often requires different LOD solutions.
  • Physics handling
    • Different parts of a build often requires different physics solutions.
  • Prims
    • In case you're not familiar with prims, they're a system to generate meshes from some very simple mathematical formulas. They're unique to SL and a prim tends to be far more efficient than the exact same shape done as a regular mesh. It requires less data to be transferred and cached, it can use some of the more efficient physics bodies not available for meshes in SL and it doesn'| have any LOD issues. So the general rule (although with several exceptions) is that if it can be made from a single prim (such as the fundament for your building) it's betetr to do it that way.
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 832 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...