Jump to content

My building and its physics


Ally Whitefalcon
 Share

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

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

Recommended Posts

So I bet this has been asked countless times. Sorry in advance, I'm desperate for references to useful documentation, as detailed as possible. If someone wants to take pity on me and actually talk to me, I would be your friend forever. I will sound naive here because I'm still learning. Please be nice.

I have a mesh building (in blender) that I've been trying to bring into SL. I broke it into pieces - it's 2 stories, so I have the basement floor, the inside of the basement walls, the outside of the basement walls, and so on. So far I'm just trying to deal with the basement floor and the inside walls. Oh, I'm using Blender 2.75a, and uploading using Firestorm Windows 32bit with Havoc.

The floor was easy. It's just a flat surface, so it's a few triangles, all basically coplanar.  When I just change it from Convex Hull to Prim in SL, everything looks fine. Yay.

The inside basement walls are driving me nuts. They're not incredibly detailed, but there's some gratuitous detial so I made a simplified physics shape, using big rectangular blocks for each wall. I didn't know if it mattered, but I was pretty careful that none of them overlapped. From everything I have read, it should be fine. But when I upload into SL, it comes in fine, no errors (any more...) but when I switch from Convex Hull to Prim, the physics shape hardly changes at all. It still looks like a shrink-wrapped volume, and I can't get inside. I thought if I provided the simplified model in the upload, it shoudl use it instead of generating it, but looking at it with the Developer->Render Metadata->Physics Shapes, my physics shape looks almost identical to the Convex Hull shape.

I don't understand what I'm doing wrong. It's probably something stupid, but I'll spend weeks finding it on my own. Help please???

Link to comment
Share on other sites

hi :)

Check out this thread, message number 5 and the link to an earlier post. https://community.secondlife.com/t5/Mesh/Mesh-house-with-invisible-physical-walls/td-p/2961241

It sounds like you are doing every thing right but without knowing exactly what you are doing with your Physics mesh in the Uploader it is not easy to know what it is thats wrong.

Can you post a picture of your Visual mesh object in Blender of the piece you are trying to upload and a picture of the Physics mesh for that object. (and or upload a .blend file of that part of your building with its Physics mesh to here: http://www.pasteall.org/blend/   so some one can take a look. After uploading the file, numbers will be added to this URL so paste that new URL in your post.)

 Edited to add , because you have many Objects in your Blender file make sure when you Export to Collada .dae that you are only exporting the one object, On the left hand side of the export panel there is a Selection Only checkbox, make sure you have checked that.

Oh and also check that the bounding box size of the Physics mesh is the same as the bounding box size of the visual mesh. If they are different the physics mesh will be stretched or shrunk to fit the bounding box size of the visual mesh.

 

 

Link to comment
Share on other sites

Here is a screenshot of the physics shape in SL:



 

This is the model in Blender of the interior surfaces of my basement walls. These are just single faces, all with normals pointing inward. There is an outer wall I also plan to use. I did that because the inside walls really don't need any LOD for medium and low.



 

Here is the blender model for the physics shape for the inside of the basement walls. Each "slab" is a rectangular volume with all 6 faces, 2 triangles each.



Link to comment
Share on other sites

The physics mesh you show is the right kind for making a hull-based shape which you do by clicking "Analyze". As far as I can see, it should work with all the default parameters. It should then say that you have 15 hulls with 122 vertices. (This will give a prim-type weight of 5.48, so that the LI will be 5 or more). Is that what the uploader says - the numbers are just above the bottom buttons? If not, something is wrong. Are you sure all the slabs have all their normals pointing outwards?

You describe this as the shape for the inner walls, but it sounds as if your upload is combined with the other walls etc. Note that every (Blender) object in the uploaded scene has to have its own physics shape. If any does not, then it will get the default single convex hull for its own mesh. Thus the convex hull you are looking at may not belong to the inner walls*. Maybe it's the physics of the root of the linkset (yellow highlight). Try unlinking and relinking with the inner wall as the root (selected last before linking). Then set all the other parts to "None" ans the inner walls to "Prim". and see what you get. This isn't the long-term solution, but will show you what's going on.

While you have made the right sort of mesh for an "Analyzed" shape, in this case you would probably get a lower physics weight by using a triangle-based shape, especially as your outside walls can also have their own physics so that there is no need for thickness here. Then the inner walls physics can just be a single plane for each wall. Same thing for the outside, and keeping the normals as they are for the walls. Anything else, such as window frames, if they are separate objects, can have their default physics shape and be set to type "None" inworld.

There is one more thing you need to be careful about when uploading a multi-object model. The visual objects and their physics counterparts must be in the same order in the exported file. To ensure this in Blender, name them with a postfix, such as "obj1_hi"...., and "obj1_ph". Then for each file, make sure the "Sort by object name" option is selected in the exporter. That will ensure each visible mesh gets associated with the right physics mesh. Otherwise all sorts of horrible effects can be discovered.

*ETA: in fact it appears that the blue comvex hull doesn't reach to the bottom of the inner walls.

Link to comment
Share on other sites

As Drongle has already pointed out it looks like you have tried to upload several mesh objects together. Each mesh object has to have its own physics mesh and the uploader has to know which physics mesh is for which visual mesh.

To simplify the upload as much as possible I would suggest you try uploading only the interior walls mesh along with its Physics mesh. Also again as Drongle has said using the hull/box type physics, and Analyzing in Step 2 of the Physics tab the physics weight of the mesh, 5.5 will probably be higher than the download weight. So use the “triangle” method and do not Analyze it. Then the Physics weight will be below 1. See image below.



The reason it is called the “triangle “ method is because once rezzed and set to Physics Type prim inworld, if you enable Show Physics you will see all the triangles that make up the physics/collision mesh.

When you hit the Analyze button in Step 2 you are asking the uploader to look at your physics mesh and try to convert it into a collection of hulls/boxes, each physics “box” it creates will cost 0.36 Physics weight.

If you do not use the Analyze function the Uploader leaves your physic mesh alone. Which means your physics mesh will be exactly as you made it. So that’s another good reason to use the “triangle” method. :)

So as a kind of proof of concept do the following .

1: In Blender , Object mode, select only the interior wall mesh Object (1 mesh Object) and export as Collada .dae (Interier wall.dae) . In the left hand panel of the Collada mesh exporter menu check the Selection Only option.

2: Repeat above for physics mesh. (Interior wall Phys.dae)

3: Load up Interior wall.dae as usual in the High LOD slot.

4: Load up Interior wall Phys.dae in Step 1 of the Physics tab (choose from file option)

5: Calculate weights and fees button then Upload

6: Rez Interior wall mesh and edit it to change the Physics Shape Type to Prim.

Sorry to have repeated a lot of things you already know but if you do follow this step by step approach first, with a single mesh object and prove that you are doing everything right, and that it works then you can try uploading the more complicated option of multiple mesh objects.

Link to comment
Share on other sites

PS. I guess you will need a door somewhere? That's ok. Just cut it out of a wall in the right place. It won't increase the physics weight much, as pecially if you make it a gap the whole height of the wall. The secret for low physics weight with triangle-based shapes is to avoid small/narrow triangles.

Link to comment
Share on other sites

Thanks, Drongle and Aquila, for your repsonses. Since all I've had to go on is a few pages I've found, a lot of this has been guesswork for me. These answers help me begin to see glimmers of light.

 

So this blender model has several different meshes - the stone walls of the basement are one, the wood is in two other meshes. So I think my first mistake was to have 3 objects in my actual model, but only one in my physics mesh. As an aside, for my outer walls I had a complex high LOD file and a separate Medium LOD mesh. I did know that for that there had to be the same number of objects and that they had to be in the same order. In retrospect, I should have realizxed it applied to the physics mesh too. In my defense, the comment I saw about this was specifically referring to the textures, not the objects, and since there are no textures in my phsyics mesh it didn't occur to me to worry about it. Mea cupula.

It was not clear to me that I could make the physics shape to be just single faces. The document i read specifically referred to making boxes, saying the physics engine was most efficient with those. This is my frustration - you guys know so much about this, how did you learn? Trial and error? Looking at the source code? Or is there a secret cache of documents that is only accessible to OT9 modelers?

The comment about my "hull" not extending down as far as the walls is interesting, and probably marks another Opportunity For Englightenment. The physics model was made by taking the original model, and simplifying each wall to be two triangles. So the coordinates should (and, for the few I sampled, do) match. I noticed the difference too, but I had no explanation for it. I figured it was a problem I could put off until I understood why i was getting a "shrink-wrapped" building. Am I correct in thinking tha while it's an issue I need to fix, ti's not related to the problem I was originally describing?

Aquilas, the "triangle type physics mesh" you drew doesn't have triangulated faces. To me that seems counterintuitive.. The way I interpret your explanation of the name is that it will get trangulated in the upload process. Is there a problem with doing the triangulation myself in blender, before uploading?

Thanks so very much, this really helps!

 

Link to comment
Share on other sites

Having done what I think you suggested, I got this, which is close without the proverbial cigar:



There are these two triangles making a not-quite-planar surface through the middle.Interestingly, the two vertices that are shared between the two triangles are on what looks like two diagonally-opposed points of the bounding box of the model. I checked - there are no vertices at either point, in either the model or the physics shape model. 

Link to comment
Share on other sites

Lots of points here.

"The document i read specifically referred to making boxes, saying the physics engine was most efficient with those"

The answer here is that it all depends. For many shapes, especially for smaller objects, boxes (i.e. Mesh Analyzed to produce sets of convex hulls) are the most efficient for the engine, and are therefore given the lowest physics weights. There are exceptions, and the two most common are probably large buildings and walkable landscapes. One of the reasons for this is that the weight of convex hull shapes is independent of size, while triangle-based shapes have weights inversely related to the smallest dimension of their triangles - so they get less expensive the larger they are, and vice-versa. That is a bit counter-intuitive.

There are some problems with triangle-based shapes that the analysed shapes avoid. Because the collision detection is not continuous, objects moving fast enough can penetrate them (more easily in the direction opposite to the normals), That means you can get stuck between two parallel triangle-based walls. In contrast, if you find yourself inside a hull-based box, the physics engine will nudge you out again. There are also some strange properties of the triangle-based physics calculation that can lead to absurdly high physics weights, although these seldom arise in ordinary use.

Somewhere (link coming if I can find it) there is some Havok documentation that describes the relative cpu resource used in collision detection for the different primitive" shapes used by the engine. In fact the most efficient are undistorted boxes, spheres and cylinders (as well as capsules that we don't have in SL). However, the only way to use these in SL is to use the corresponding regular prim, made invisible, linked to the visual mesh. That use is rather cumbersome, but can give very low physics weights. Unfortunately, the uploader does not recognise these shapes even if they are there in the physics mesh you upload. So it can't take advantage of the saving that would be possible by using Havok primitives for your solid walls, for example. That is very unlikely to change. Neither can it upload physics primitives defined in Blender.

The second most efficient shapes are convex hulls. The Analyze thing takes advantage of that by breaking down your mesh into a series of convex hulls, each of which will work efficiently. Then there is the triangle primitive. That is the least efficient for a given mesh, especially if the triangles are small. However, if they are large and there are few of them, they can be more efficient than the convex hull, as is likely with your walls. For walls, this means omitting the narrow edges which would affect the weight disproportionally. Only experiment and experience can really teach you where the crossover is for these two shape types.

"my "hull" not extending down as far as the walls"

I was interpreting this as indicating that it was probably not the physics shape of the walls, but rather of one of the other meshes in the linkset, whose bounding box didn't reach to the bottom of the combined model - maybe the window frames. However, there is a peculiarity of the default convex hull (not shared by Analyzed, hull-based shapes)in that it doesn't fill the bounding box but is retracted from it by a fixed proportion of the xyz dimensions. This can be quite confusing for large meshes set to physics shape type "Convex Hull" (the default hull) as it means you can sink into the edges where the visible mesh is bigger than the collision shape. I reported this as a bug a long time ago, but nothing has changed. So I have to assume there was a reason for doing it that way. Anyway, the shrinkage doesn't affect either kind of shape you get with physics type "Prim". So those will be stretched to the bounding box of the high LOD mesh.

"Is there a problem with doing the triangulation myself in blender"

No. In fact it gives you more explicit control. However, quads look nicer and are generally easier to edit. You can get the default Blender triangulation in the exported file if you have the "Triangulate"* option checked in the exporter, although you won't have the opportunity to change the diagonal choices. For these walls, that is irrelevant because they are flat.

*Be careful with "Triangulate" if you ever have custom normals in a visual mesh though. It can wreck them completely.

ETA Heres the link about Havok collision detection.

 

Link to comment
Share on other sites

without the proverbial cigar:

Try unlinking it and moving the parts away from each other. It looks like that might belong to one of the other objects.

ETA for example, if there was a nearly flat plane object (floor?) included in the physics file, that got associated with the window frame object, then the stretching to the bounding box would have drawn it up to that shape. Same if it were (wrongly) associated with the wall mesh and the wall's physics was associated with the frame mesh pbject.

 

Link to comment
Share on other sites

That would kinda explain it then. My model was to main objects: the stone walls and the wood. I didn't think the wood needed to participate in the physics, but having just found out that I couldn't just delete that object from the physics model, I left a couple "placeholder" triangles (the wood on one window). Two triangles, which apparently got stretched way out. So there's no way to avoid having the physics shape have to have both ovjects, and be approximately the same extent in each object?

Btw, thank you so much for your advice. I don't mean to go on and on taking up your time.

 

Link to comment
Share on other sites

If you can change the linking so that the walls are the root prim (change order in upload, or unlink, then link after selecting the walls last), then you can set the physics shape type of the woodwork physics to "None". It will then be ingnored by the physics engine.  The root prim can't be "None". Any others can.

Link to comment
Share on other sites

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