Mesh/Mesh physics

From Second Life Wiki
< Mesh
Revision as of 14:30, 10 December 2010 by Bea Linden (talk | contribs)
Jump to navigation Jump to search


Mesh Physics Design Document

Purpose: To specify 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
  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
  • All assets will contain a single 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

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-19733m6dH7d0v0W6m': No such file or directory @ error/constitute.c/ReadImage/600. convert-im6.q16: no images defined `PNG:/tmp/transform_19b7b6b136b0.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 at least one of the following is true:

  1. It contains a mesh asset
  2. It contains a prim with a physics shape type other than "Prim"
Formula
  • PRC

PhysicsResourceCostEqn.png

  • Notes:
  1. 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.
  2. This formula is subject to change during beta--particularly the coefficients.
  3. The resulting number may not be an integer
  4. A prim with physics shape type "none" does not contribute to the pure PRC!
  • Simulator Resource Cost (SRC)

Overall cost to the simulator for a linkset or prim is reflected in the Simulator Resource Cost (SRC). SRC accounts for two additional factors: the constant overhead of handling individual prims and rounding. The SRC is computed as follows:

  1. Determine the tentative PRC as the sum of the PRCs of all prims in a linkset, rounded to the nearest whole number.
  2. Determine 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.
  3. The SRC is the greater of 1 and 2.

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 in the wiki).