Mesh/Mesh physics

From Second Life Wiki
Jump to navigation Jump to search


This article explains the physics behavior of imported mesh objects and, to a lesser extent, triangle-based prims under new accounting

Mesh Assets: Physics Shapes and Decompositions

A valid mesh asset will contain:

  1. A single convex hull with no more than 256 vertices
    • All assets will contain a single convex hull with no more than 256 verts that will be used:
      • If the physics shape type is set to "Convex Hull"
      • If there is no decomposition and the prim is in motion of any kind
  2. (Optional) An additional convex decomposition containing up to 256 vertices per hull and up to 256 hulls
  3. (Optional) A mesh designated specifically for use in the physics engine

Mesh Asset Header Identifiers

  • "physics_shape" - optional, reference to mesh to be used in place of visible mesh for collisions
  • "decomposition" - required, reference to one or more convex hulls of no more than 256 vertices each to be used in place of physical mesh

Decomposition Data Block Members

  • "Min"/"Max" - required, LLVector3, floating point domain to decode binary U16 data to
  • "HullList" - optional, binary U8, list of point counts of hulls stored in "Position". '0' is special cased to indicate 256 points.
  • "Position" - optional, binary U16, list of positions of points in hulls that make up the multi-hull decomposition of this mesh
  • "Hull" - required, binary U16, list of positions in a single convex hull of no more than 256 verts that wraps entire physical mesh
    • "Hull" is generated automatically at upload time by feeding the physics shape, mid lod, or high lod into LLConvexDecomposition:
      • Stage 1: Mode set to "Preview"
      • Stage 2: Simplify mode set to "Retain%", retain percentage set to zero.

Physics Representation for Rezzed Prims

Error creating thumbnail: convert-im6.q16: delegate failed `'rsvg-convert' -o '%o' '%i'' @ error/delegate.c/InvokeDelegate/1928. convert-im6.q16: unable to open file `/tmp/magick-3386Zo_7GdVAeIDv': No such file or directory @ error/constitute.c/ReadImage/600. convert-im6.q16: no images defined `PNG:/tmp/transform_d8ec6f70718e.png' @ error/convert.c/ConvertImageCommand/3258.

Exceptions:

  1. A non-physical prim which is moving (e.g., via llSetVelocity) is treated as dynamic until all motion has ceased for several frames

Notes:

  1. Meshes should initially rez with shape type "Convex Hull" as the physics resource cost (see below) for detailed physics meshes may be very high and depends on the prim's scale
  2. A mesh object uploaded without an explicit physics shape or decomposition cannot be changed to shape type prim and will always be represented as a single convex hull bounding the mesh.
  3. At any time prior to release to Agni, we may choose to require a physics mesh be provided
  4. No linkset or prim with a pure physics resource cost exceeding 32.0 may be set physical

Physics Resource Cost

There will be a new physics-based resource cost (PRC) computation. It will be used directly in determining whether objects can be made physical and will be a factor in determining total prim resource cost for a parcel or region.

Opt-In

A prim or linkset will have a physics resource cost (PRC) computed if and only if it contains:

  • A mesh asset

OR

  • A prim with a physics shape type other than "Prim".

Formula

PhysicsResourceCostEqn.png

Notes:

This formula is subject to change during beta--particularly the coefficients.

IMPORTANT: For triangle-based shapes, the cost grows inversely with the scale of the prim! More specifically, it varies linearly with triangle density. This is important as triangle density has a huge impact on physics performance. Also note that for large meshes, the density multiplier may be less than unity, resulting in a discounting effect.

The resulting number may not be an integer. A prim with physics shape type "none" does not contribute to the pure PRC!

Simulator resource cost (SRC)

Simulator resource cost (SRC) reflects the overall cost to the simulator for a linkset or prim. SRC accounts for two additional factors: the constant overhead of handling individual prims and rounding.

The SRC is the greater of these two values:

  • The tentative PRC as the sum of the PRCs of all prims in a linkset, rounded to the nearest whole number.
  • The minimum SRC as one half of the number of prims in the linkset, rounding to the nearest whole number. If this number is less than 1, it is rounded to 1.

If a linkset does not meet the criteria above for having a PRC, its SRC = PRC = num prims in linkset (just as it always has been).

Region resource cost (RRC)

Regions and parcel limits for prims/linksets will use the region resource cost which is the greater of the SRC and the bandwidth resource cost (also known as streaming resource cost, described elsewhere).