Sunday, April 28, 2013

Download, Server and Physics, Oh My!

So many people get flummoxed over the final LI of their mesh that I thought I would try to put into simple terms some things you can do to figure out how to get the best LI and that means understanding your mesh and the Second Life Upload window. This will be an amalgamation of information from various sources, so they can be accessed on one page and the information is accurate as I have understanding of it at the time of this writing in April of 2013. Once you create your mesh, whether with Mesh Studio or any other 3D program, it is time to upload it.


While working with your LODs and physics mesh is very important, once you upload, there are three things which determine the final cost and LI of your mesh:  the DOWNLOAD, PHYSICS, and SERVER calculations.  The highest of these three calculations becomes your LI.


•What is LI?

The terms land impact and land capacity replace prim count and prims parcel supports, but the numerical values remain the same for legacy objects made only of standard prims.  Therefore, a linked object composed of 42 normal prims with their physics type set to Prim has a land impact of 42.  (source)



•What is Download, Physics and Server?


For each object in the Second Life world, Second Life compares three important performance factors: download weightphysics weight, and server weight. It then chooses the highest of these weights and assigns it to the object as that object's land impact rating.
Here's a very quick overview of the different weights; for more information on each, follow the links below:
  • Download weight: Calculated by determining how much bandwidth is required to download and view the object. Larger and more visually complex objects have a higher download weight. You can reduce the download weight of complex objects by generating or uploading less complex meshes for differing levels of detail when you upload a model.
  • Physics weight: Calculated by determining the complexity of the object's physics model. You can reduce the complexity of a mesh's physics model by using the analysis and simplification tools in the Upload Model window, by uploading your own less-detailed physics model, or by choosing a different physics shape type, such as Convex Hull, on the Features tab of the Build Tools window. Vehicles must have a physics weight of 32 or lower, but may have higher download or server weights.
  • Server weight: Measures the impact an object has on Second Life's server resources. Objects that are composed of many prims and have physics enabled and/or contain scripts tend to have high server weights. (source)


•How can I offset these calculations to lower my LI?

If the high contributor is DOWNLOAD weight.  This has to do with your LODs.  

In MS, you control your LODs by using the Mesh Studio menu when generating your meshes as described in these articles:

http://meshstudiovirtual.blogspot.com/2013/02/a-beginners-workflow-guide-for-mesh.html?view=magazine

http://meshstudiovirtual.blogspot.com/2012/09/optical-optimization-options.html?view=magazine

The other way is to use physically modified copies of the prim linkset where you remove prims, or simplify forms by combining parts.  Remember that the LODs represent what you see as you cam away and you see less detail when you do that.  

Also remember, and take into consideration, that if anything you remove removes a part that was its own prim material face, at least one face on your linkset must survive that has that material on it.  (Example:  if your linkset is set up to have 4 prim material faces, then all the LOD mesh must contain the same 4 prim material faces on at least one face somewhere on the build.)

Look at your build carefully.  The larger the build will eventually be in SL, the more impact the types of prims you use will have on how quickly the LI jumps.  If the mesh uses cylindrical beams, for instance, you could change these to box beams in the lower LODs as boxes are the simplest form you can use.  Again, read the Optical Optimizations article for more insights. 

In Blender, similarly, it's a matter of simplifying the forms in your meshes:  cylinders to cylinders with fewer sides or down to square box shapes, etc.  You can take your high LOD mesh and copy it and use the "dissolve" function in the menu that appears when you press X in edit mode.  You can remove loops.  Dissolve is great since it preserves the UVs.  You want to watch your UVs as you work.

When you cam away from your mesh in SL, you want to retain the overall silhouette of your object, and lose detail as you back away.

If PHYSICS is the high contributor, you need to examine your physics mesh.  If you did not provide one, it likely used the number of triangles in your lowest LOD to make its calculation.  If that is the case, lowering that number will help resolve that issue.  If you provided the mesh, then you need to study how you made your physics mesh.  

Remember that the physics mesh is simply telling SL, "here is what I want to walk on, there is what I don't want to walk through, this is an opening through which I want to pass."  This implies that you can use planes to create the surfaces.  It has been shown that using boxes will be fine to use and not much of a contributor.  If you are dealing with very large builds, perhaps it would be wise to consider using planes with possible.  This article deals with Physics and shows how to create single planes from a box for use in Mesh Studio.

Remember to simplify your forms for phsyics.  If you have a wall with windows and a doorway, you don't need to walk through the windows, normally, you do through the doorway.  Simplify the wall as if it doesn't have windows.  If the door is round, simply to a square.  If the wall is thick enough that you think your customers will walk into them, then do a physics shape for each side without edges inbetween them.  For curved surfaces, such as a round balcony, use flat planes in the least amount that will help keep the balcony from being walked through.  Narrow faces create narrow triangles and these are not good for physics shapes and can throw errors.

This information will serve the same if you are making your meshes and physics shapes in Blender.

If SERVER is the high contributor, in Mesh Studio, this normally means you may have used the Object2Mesh script as opposed to the Object2JoinedMesh script since the server calculstion has to do with the complexity of the mesh which can be greatly affected by the number of unjoined meshes.

In Blender, joining the meshes will help you.


If I can find more info on this topic, I will update this article, but hopefully this bit will assist you in leaning out your meshes while keeping them pretty and efficient.

Happy Meshing!
~ele




A beginner's workflow guide for Mesh Studio

(updated with additional information on 04/16/13)

There are many workflows for using Mesh Studio.  People have been asking me for examples of how they should work and how to learn Mesh Studio best, so I'll try to lay out something in this article for those who are just beginning to use Mesh Studio.

When you purchase your Mesh Studio and the box arrives, rez it.

Important:  Make sure that you have done the IP Test and have payment information on record with LL.  Instructions are found here and I highly recommend that you do both Agni (the SL grid we are all on) and Aditi (the beta grid where you don't pay with your money to upload tests).  There is a separate test to take for each grid, though the test questions themselves are the same.

Touch the box and it gives you a folder with the contents.  The folder name will start with "Mesh Studio".

Rez the registration prim, "MS Account Activator".  This registers you with the server from which the Collada .dae files are generated.  These .dae files are what allow you to upload your meshes to SL or take them to another 3D application that supports Collada.

Rez the updater prim, "MS Update Checker".  This ensures that you are using the most up-to-date Mesh Studio.  Rez it out regularly to make sure if any more updates have been released.

In this workflow, we will deal only with prim linksets.  Mesh Studio allows you to use any prim with any prim cut or torture, supported by LSL scripting, to build an object.  The mesh will be as good as your linkset is made and how well your prims are aligned.

We will build a simple, but detailed table to demonstrate how to:
  • Create material faces.
  • Pre-texture your prims.  This is what creates the faces.  We will use textures from your Library folder to keep it simple.
  • Make prim faces transparent, via the Edit window, to block generation of mesh on those faces.
  • Use the Object2JoinedMesh.  This script is the more commonly used script of the two available in your Mesh Studio folder.
  • Create the High, Medium, Low LOD (level of detail) meshes and generate Collada .dae files for each.
  • Create a Physics mesh and generate the Collada .dae file for it.
  • Upload the mesh to SL.
  • Examine the mesh and apply textures.
If you are new to building with prims, please go over this article:

Create the table as follows:
  1. Create a box.  Make it 1m on X, 1.5m on Y and 0.05 on Z.

  2. Raise this prim to the height you want your table.

  3. Hollow it with the default Square hollow shape to 0.95 (the max hollow).

  4. Shift-copy this prim up and use Ctrl-Z to put it back to same position as the first box.

  5. Hollow this box changing the hollow shape to Circle.  Make the hole 0.75.  Scale X to 0.85 and set Y to 1.3.

  6. Shift-copy this prim again and Ctrl-Z to align it with the first two prims.

  7. Scale this third box to 0.97 on X, 1.4 on Y and 0.03 on Z.  We will be using these prims as our table top.  By texturing this last prim with an alpha texture, it will give a nice border and inset to the table.

  8. Use the "Waterfall-medium overly" (Waterfall folder) texture in your Library folder to texture the third prim as glass.  Use any needed repeats, rotations and/or offsets to make this top look as desired.  I used 0.3 Horiz/0.2 Vert with a horizontal offset of 0.3.  Mesh Studido will remember these repeats, rotations and offsets when you apply textures after meshing.

  9. Select the inner box with the circular hollow.

  10. Shift-copy the prim downward.  Un-hollow the prim and change the scale to 0.0150 on Z.  This makes it a bit thinner than the table top.  It will be a knick-knack or coffee-book shelf under the table top.  Lower this shelf to a low level.  We will now make the four legs.

  11. Starting at the negative Y end, when looking in edit, create a box and make it 0.09 on X and Y.  Taper it -0.2 on X and Y.  I added shear to slant the table legs in a bit on both X and Y.  Scale the leg so it will fit under the table top.
  12. Note how the axes show the positive ends with the arrow
    heads when you go into edit on an object.

  13. Place the leg so it is inside the boundary of the knick-knack shelf in one corner.  Adjust its height as you see fit.

  14. Shift copy the leg and check the shear to make sure it's slanting in the desired direction.

  15. Select both legs and shift copy the pair and move them to the opposite side of the table.  Or if you sheared them, like I did, rotate the pair 180 degrees before moving them into place.

  16. Link all the pieces together, with the outer border table top prim as the root (there's a reason for this), and name the linkset to Table Test in the Name line of the General tab in the edit window.  Remember that when you select and name a linkset, you are naming the root prim.

  17. Use the Brazilian Rosewood texture from the Wood folder in the Textures folder in your Library to texture the wood parts of your table.  (Or any suitable texture in your inventory.)  Remember to use "Edit Linked" to isolate your work on any one prim, or more, in the linkset.  Make sure to set any repeats, rotations and/or offsets needed to make it look as desired.  I used 1:1 repeats, but rotated the texture by 90 degrees.  Then selected all the legs and changed the vertical repeats to 0.5.

  18. Since we can keep Mesh Studio from generating mesh on any prim face that we make 100% transparent in the transparency field of Textures tab in the edit window, we will do this to a few faces that will not be visible in the final mesh.  Using Edit Linked, pull one set of legs on the long side of the table outward by selecting one leg and shift selecting the other.  Make the top face of each leg 100% transparent.

  19. Use Ctrl-Z to return the legs to their original position.

  20. Repeat this to the other pair of table legs and your linkset is ready.


Exploded view of the table pieces on the left, the final linkset in the middle and the final table fully textured one on the right.




We are now ready to generate out our .dae files, so go into edit on the table.

From your Inventory's Mesh Studio folder, take the Object2JoinedMesh script and place it in the contents of your linkset's root.  It is important to use the "joined mesh" script because it is what allows you to maintain the material areas you  have created by adding textures and/or tints.

The script creates hovertext which displays that we have a table made of 8 prims, with 50 prim faces; 4 of them invisible, and grouped into 2 Mesh Faces (which can also be called Material faces or Materials - the SL edit window will access them with "Select Face").

Want to learn more about the way we create "faces/materials" with Mesh Studio?
http://meshstudiovirtual.blogspot.com/search/label/Materials

Want to learn other ways to texture your prims in Mesh Studio?
http://meshstudiovirtual.blogspot.com/search/label/Texturing

  • You have now made a linkset that will be used to generate your mesh.  
  • You have named the linkset, by naming the root prim, to make it easier to identify your files.
  • You have textured it with two textures which will result in two material faces which can be textured independently from each other after the mesh is generated.
  • You have made some faces transparent so they will not generate mesh.
  • You have placed the Object2JoinedMesh script into the root prim.

Now we will make the LOD (level of detail) meshes using the MS menus.  The Mesh Uploader window has four LOD levels.  This allows us to control how the mesh breaks down at each LOD switch as you cam away from the mesh and get further from the mesh.  In real life, the further away we are from an object, the less detail we see and we mimic this in computer games.  We will also create a simple box for Physics, so you can't walk through the table.  We have named the root.  We will further append the name for each LOD mesh as follows:

  1. Go into edit on the linkset and add the word High to the name in the Object Name field.

  2. Touch the linkset to get the MS menu.  It is set to Default.  We will use this setting for our High LOD mesh.  Press the Mesh button.  


  3. A file is generated and you are notified of this in your local chat and given a ZIP link.  Download this link.









  4. Go into edit on the linkset and add the word Medium to the name in the Object Name field.


  5. Touch the linkset to get the MS menu.  Change the Resolution setting to LowPoly and then OK on the next menu.  This will change the number of faces generated to a lower count.  We will use this setting for our Medium LOD mesh.  Press the Mesh button. 
  6. Download the generated ZIP.  You can see why we are naming them to know which is which.







  7. Go into edit on the linkset and change the word Medium to the word Low in the Object Name field.


























  8. Touch the linkset to get the MS menu.  Change the Resolution setting to LowLOD and then OK on the next menu   This will change the number of faces generated to an even lower count.  We will use this setting for our Low LOD mesh.  Press the Mesh button.








  9. Download the generated ZIP.

Want to learn more about optimizing your meshes?
http://meshstudiovirtual.blogspot.com/search/label/Optimizing

We will now create the Physics mesh.  SL requires us to tell it where the collision surfaces are on a mesh.  These are the surfaces we walk on, do not go through or define the area we can walk through.  A simple box will work for this table.  While complex builds may require more, the goal is to keep the physics shape as simple as possible and to be logical about it.

Want to learn more about Physics? 
http://meshstudiovirtual.blogspot.com/search/label/Physics
https://sites.google.com/site/tamaproducts/slmeshphysics


  1. An easy way to create the shape is to either make a box that fits over the table, or make a copy of the linkset (keep the original linkset intact in case you need to change it later).  In the case of this table, use Edit Linked to select the root prim and unlink it.  We chose this prim as it is the prim that has the same dimensions as the outer surface of the linkset on X and Y.  The texture will be ignored by making it physics.  Physics models have no texture or face assignments. 

  2. Now select the rest of the still-linked prims and delete them.

  3. Un-hollow the hole on the root prim and edit the prim to pull down the bottom end to the ground.  Now your prim is the same mass as your table (if your legs don't extend past your tabletop).

  4. Rename this prim to Table Test Physics.  Since it is the root prim, it also still contains the Object2JoinedMesh script.

  5. Touch the prim.  The setting should still be at LowLOD, but if it is not, touch the Resolution button and change it to LowLOD and then OK, on the next menu, and then Mesh to generate the .dae file.

  6. Download your Physics ZIP.
Original table on far left.  Root prim is unlinked in center.  Root prim is un-hollowed and  the height scaled for the bottom to reach the floor; thus matching the mass of the table.  This box now can be used for physics.


We now have four ZIPs.  Unzip each one.  By having named our linkset's root prim, prior to creating our .dae files, we are able to clearly distinguish between the LOD meshes and the Physics files.  My recommendation is to create a directory with a project name for your meshes and place all relevant files within the directory.

(Tip:  Remember to always change the root prim's name to what you want the file name to generate as; once you have several files to upload, it pays off to easily see which is which.  I can't stress this enough.)

Let's upload our table.

NOTE:  The SL Mesh Upload window will upload up to four LOD mesh files (high, medium, low, lowest) and one Physics mesh all in the same upload.  This is the recommended way to upload.  

For meshes with physics, I will still stand by my recommendation that you use the LL viewer over any other one.  I know Firestorm, and possibly other TPVs have or are getting the full Havoc license, but it's your money to upload, so why take the chance.  There are many ways to set the phsyics in the SL Mesh Uploader, but since we are providing our phsyics mesh, we can ignore the other settings other than just loading the physics mesh file in the appropriate tab (see below).

On your Inventory window in SL, you should see a plus sign and when you press that, select Upload>Model.

The "Choose a File" browser window opens from which you will choose your Table Test dae.

The Upload window opens.  The model name invariably says "o2jm1Mesh".  Change this to a better, descriptive name for you model.  Table Test, like your files, would be fine.


SL will do the lower LODs, but they may not be how you want them to break down and the results can vary for how the LI is calculated.  We have more control when we make them ourselves.  You can, however, see how SL breaks down the LODs by changing the preview to show you the high, medium, low and lowest LODs.  Use the same navigation controls as you use to rotate, scale and move the view in SL in the Preview window.

Press the Generate button on the Medium level and load in the Table Test medium file.

Press the Generate button on the Low level and load in the Table Test low file.

We have one more LOD, Lowest.  For this one, you need to experiment.  You could enter 0 (zero) in the Triangle Limit field.  This normally results in one triangle.  This is what is seen at the furthest LOD.  You may want more of the mesh to be seen.  The more of it you want seen, the higher the number of triangles, which may result in higher LI.  How much depends on the complexity of the mesh which is why you want to experiment and why I recommend the test grid, Aditi.  For this example, I changed the numbers (while watching the lowest lod level in the Preview) until just two shelves were left; that number was "9".  When I changed it to "8", it went to only one shelf, which might be acceptable to you or you may want more mesh showing at the lowest LOD.

Once the LOD levels are done, change to the Physics tab.  Under "Level of Detail", change "choose one" to "load from file".  Navigate to your Table Test physics file and load it.  The yellow piece in preview under physics, is the physics mesh.  If you upload your own physics mesh, you do not need to analyze.

Please note that recently, we have found that, especially for doorways, we have had to press the analyze button for the mesh to upload correctly.

Now just press "Calculate weights and fee".  Mine came in at 0.5.  The three calculations are important.  My download was 0.2, physics was 0.4, and server was 0.5.  The highest of the three becomes your LI (land impact).  0.5 will round up to 1 in the edit window.  However, because the table was 0.5 in reality, when I linked two copies of the tables together, the LI became 1 for the linked tables.  When I linked four of the tables, it was 2 LI.

Once the mesh was uploaded, I rezzed it and made a copy.  I used "Select face" in edit and applied the same textures I had on my prims and the mesh textured like my prim linkset and it stayed faithful to the repeats and rotations I had used.




There is, of course, a lot more to what you can do, but this should give you a thorough start.  Press the "Labels" button on the right hand side of the blog for categories for my articles for more information on what I covered in this one.

Happy Meshing!
~ele