Jump to content

Mesh house with invisible physical walls.


Gigaus
 Share

Recommended Posts

Hello all,

So I recently got ahold of Blender, and made a octagonal house with some open parts; Windows, doorways, a deck, the like. When I uploaded it however the physical boundries of it were weird. Walls I had to delete and then put back in I could walk through, doorways I had made had something blocking in them even though they were big gaping holes, and there basically was a big invisible block in the center of the house, which is from the startup cute for Blender I assume.

 

My question is this; How do I detect these invisible walls and objects, and remove them so they're not blocking the way? 

Link to comment
Share on other sites

There's a lot to learn about making physics/collision shapes for your houses. It makes a lot of difference whether your house is all one mesh object or a several. If it's several objects, then each will get its own physics shape. If you do nothing on the physics tab of the uploader, then it will make a default physics shape for each object which will be the convex hull* of the low-LOD mesh. Whether it corresponds to the visible mesh shape depends on whether the low-LOD mesh does, unlikely if you rely on the auto-generated LODs. This default convex hull is the collision shape you get when the "physics shape type" is set to "convex hull" inworld. If you haven't specified another shape, that is the only choice other than "None".

If you specify a mesh on the physics tab, one of the LOD meshes or a new dae file, then that will be used to make the default convex hull. It's still a convex hull with no holes. As long as you don't click "Analyze", this will also make a triangle-based physics shape which will be used instead when the physics shape type is set to "Prim" inworld. Note that the uploader will only tell you the physics weight of the convex hull and you may get nasty surprises when you switch to "Prim" with a triangle-based shape if it has small/narrow triangles (see below). This kind of collision shape basically consists of the triangles in the specified mesh.

If you do click "Analyze", the uploader will try to make a set of smaller convex hulls that approximate the shape of your mesh. There are lots of parameters that control this process, but it's never very good for buildings. You either get very expensive (in LI) shapes or you get the open spaces filled in. The best thing is to make a new model that already consists of only convex hull, and keep small gaps between them so that they never overlap. That way you have the most control over the "Analyzed" shape. Note that you still have to set the shape type to "Prim" to use this shape. Otherwise it will use the single filled-in default convex hull.

Here are three physics shapes I made for an octagonal greenhouse/shed some years ago. The cheapest (inn LI) is the top one, which is just 22 triangles, so that the physical walls have no thickness. This is use without "Analyze" to make a triangle-based shape. To get more accurate collisions, you can use a triangle-based shape with double layer walls, at twice the cost in physics weight. If you look carefully, you will see that there are no faces on any of the narrow edges of the walls or roof parts. This is because these would be narrow triangles which greatly increase the physics weight. The fewer and bigger the triangles the better. The lower model is for using "Analyze" to make a convex hull based shape. Now the narrow edge faces are all there, Each panel is a simple convex box and there are gaps between the everywhere. If I remember correctly, this is the most expensive of the three (physics weight should be 4.76, LI>=5).



It's important to know that the physics shape for each object will be stretched to fit the xyz bounding box of the high-LOD visible mesh. So if it doesn't fill it already, you will need to add to it so that it doesn't get distorted to mismatch with the visible shape. Also, if you have multiple mesh objects in the visible model, then you need one object for each in the physics model and they need to be in the same order in the collada file (use the sort-by-object-name exporter option to control the order).

It is also possible to make a physics shape from simple regular prims - link them to the mesh, make one of them the root of the linkset, make them invisible by setting their texture to "default transparent", set them to physics shape type "Convex Hull" and set the visible mesh to "None". I think that;s an unsatisfactory solution, because they can get unlinked. but it does work. You still need to be careful with prim parameters because the physics weights will get very high if you start using them. Keep to simple box prims of possible.

You can see my octagonal shed/greenhouse thing on top of the yellow house in Siona. Use Develop->Render Metadata->Physics shapes to see the physics.

If the block in your model was default cube, that probably means you forgot to use the "Selected only" option in the exporter, or selected it by mistake,

*i.e. the mesh filled in until it has no holes or concavities.

ETA - :matte-motes-shocked: What have they done to the image interface - Ugh!!!!

Link to comment
Share on other sites

Umm, first thanks for replying, but....90% of what you just said went over my head. I've tried reading it multiple times, and figure out what I did wrong....As far as I gather from what you said, any hole in my mesh, even if it's put there, will be 'filled' and treated like a solid object. Which..Isn't what's going on.....

 

Let me try explaining it another way; My mesh is broken. Walls/Faces are being treated as if they don't exist, other walls are being loaded, but have no collision, and there's places in this house that randomly have collision, and others that simply shouldn't. One big block is in the dead center of this house, and it's consistant with the block that Blender inexplicibly forces you to load every time you start a new project/mesh, which was deleted from the start. Other parts are consistant with edges/faces that were also deleted, but are still registering as 'present' when loaded into SL.

 

The door I can explain away as something is registering as being in front of it, but windows and the deck randomly have collision in some areas, and none at all in others. What I need to know is if there's a way to detect these invisible walls and collision zones or not, and fix them.

Link to comment
Share on other sites

Me->Preferences->Advanced->Show Developer Menu

Develop->Render Metadata->Physics shapes.

That will show you the physics shapes inworld, but you may not understand what you see, and you can't edit them. You have to get them right in the upload (unless you opt for the linked invisible prim method).

Where is your mesh? I could have a look if you like. It does sound to me as if you do have multiple objects. This means that the default physics for eac will be the convex hull of its low LOD, which can be very bad. If you did upload a physics shape, then maybe the objects are in the wrong order, which can create all sorts of anomalies.

In case it's relevant, Blender does have its own physics, which does get exported to collada, but none of that is used by the SL uploader. It only uses ordinary mesh geometry. Any Blender physics is completely irrelevant to SL. There are few cases where the visible mesh will make acceptable physics, especially for buildings. So you generally have to make a physics mesh. If each wall etc. is a separate object, then it might work, but that makes the LI higher.

 

Link to comment
Share on other sites

Hi

Ok lets start with answering your question about how to detect those invisible walls

You can see the Physics/collision shape of your building by Opening the Develop menu at the top of the SL viewer and then selecting the Render Metadata submenu. From that submenu enable Physics shapes. Now all physics collision surfaces will show up, normally in a blue colour. (See example of how they look in the Link at the end of this post).

If you did not specify a physics shape to use with your building in the Uploader the uploader will use the Low LOD mesh for the collision shape. This can often be just a few triangles! Worse ……. If you have not Edited your rezzed building inworld and changed the Physics Shape type to Prim the physics shape will be like a blob connecting those few triangles together!

To get accurate physics for your building you have two choices :

1: In the mesh Uploader, load up your building as usual then open the Physics tab and in Step 1: choose High. The “High” refers to the High LOD mesh you have just uploaded in the Level of Detail tab. This means that this same High LOD mesh , your building mesh, will be used for the physics aswell.

Now hit the Calculate weights and fees button and then when calculated Upload the mesh.

Rez your building and check out how it looks when Show physics is enabled.

Now Edit your building and in the Edit panel open up the Features tab. You will see a field marked Physics Shape Type. The default is Convex Hull. You always need to change this to Prim to enable the shape you asked to be used in Step1 of the Physics tab of the Uploader.

Now you will be able to walk inside your building , each wall in your visual mesh will also be used in your Physics shape.

The downside of this method 1 is the LI (land Impact) of your model is likely to be higher than it need be because the Physics weight part of the calculation may well be higher than the download weight causing the Physics cost to be used as the LI cost !

The Physics cost will be high because there are so many triangles (all the Quads you have in your building mesh will have been automatically converted to Triangles when exporting/uploading) Also the Uploader does not like small or thin triangles in the Physics mesh and will charge you more in Physics cost for them!

So to get the Physics cost lower we usually use the second method, create your own physics /collision mesh in Blender and upload that in Step 1 of the Physics tab in the mesh uploader.

"Planes" method :

2: In Blender, in Object mode make a copy of your building and move it to a separate layer (with the copy selected hit the M key and the layer popup will appear, select and empty layer) This copy will be the bases of your Physics mesh.

Go to the layer you have the copy on and in edit mode start simplifying this mesh as much as possible.

The goal is to use as little geometry as possible to represent your Physics, Any window openings can be removed from the walls, any details around the windows should be deleted. As should any door frames . As mentioned earlier the Uploader doesn’t like small thin triangles/quads in the mesh so for example the faces/quads that join the outer wall to the inner wall around the door opening should be deleted. Remove any other small or thin tris/quads you have in this mesh.

The physics mesh should be as simple as possible. The uploader doesn’ like small tris but it does like big ones, simplifying the mesh should be creating big tris/quads.

As Drongle said the Physics mesh’s bounding box should be the same size as the visual mesh"s bounding box. Keep in mind that the Physics mesh is always stretched or shrunk to fit the bounding box of the visual mesh by the uploader !

When you are finished, in Object mode Select the physics mesh and export it as a .dae file and make sure that you check the Selection Only check box in the left hand side panel of the export window so that ONLY this mesh is exported in this file .

In the mesh exporter, upload your Visual mesh as usual, then open the Physics tab and in Step 1 choose From File and upload your Physics mesh here.

Don’t touch anything else in the physic tab !

Calulate weights and fees and Upload

Rez your building and then Edit it, In the Features tab change the Physics Shape Type from the default convex hull to Prim. You can now walk around inside of your building.

Because you have used a lot less tris in your custom physcs mesh the Physics weight will be a lot lower.

Important I am presuming you mesh building is ONE mesh Object in Blender.

If it isn’t then I suggest you either join all the objects together, Shft select all the objects and then Ctrl+J to join them into one mesh object. Or you start with a very simple building, one mesh Object and get the physics working on that before trying to mess around with Uploading multiple objects at one time. Each visual mesh Object needs to have its own physcs mesh object. Its usually easier to upload one mesh Object at a time and link them together when rezzed inworld.

Take a look at this earlier thread that explains the same things but with added pictures :

https://community.secondlife.com/t5/Mesh/Problem-with-home-mesh/m-p/1788825#M18558

note: This linked thread shows another method for creating the physics using none overlapping box shapes in Blender. All the boxes should be one mesh Object so add the boxes in Edit mode. The box method may look easier but will usually result in a higher physics weight. Each box used to create the physics shape will cost 0.36 Physics weight so can quickly add up. The majority of people creating mesh buildings for SL will be using the "Planes" method i mentioned above.

Physics is not differcult once you have done it once. :)

Edited to add, Just in case you are not aware ..........Meshes are rarely perfect on the first upload and repeated uploading fees just for testing purposes can quickly add up! there is a beta grid, a smaller parallel grid used for testing where uploads won't cost you anything. 

 

Link to comment
Share on other sites

  • 5 months later...

Hello Aquila. First of all - thank you for such detailed explanation :) That made physics system in SL very clear for me. But can you help me a bit more explaining what's wrong with my model? I'm following your descriptions, but still no entrance in my building :( Here is what I do:

1) uploading Collada model of building. Model parsed fine, no errors:

 

2) I'm adding physics from separate model - just a box with same sizes with hole in place of door:

Calculating my model - everything still fine and judging by preview - the hole in physics is in right place.

 

3) Ok, I'm uploading whole model. And placing it. Still looks fine, but I can't enter it and showing physics shapes explains why - there is no hole. Why??

As an option I'm trying to edit placed object, changing its Physics Shape Type, but there is no option "Prim" there (because I explicitly set physics model, I think)

 As a test I'm uploading "box physics" as a model and calculating physics by itself, as you described, then changing physics type to "Prim" - and I can enter that box

Link to comment
Share on other sites

Normally the Prim option isn't available in-world, when you did not have specified a physics shape at all. Not from file, and not one of the LODs. So it looks like something went wrong with your upload. Also, the physics model should be yellow shaded, in the preview, as a triangle based mesh.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...