Difference between revisions of "Mesh/Decomposing a mesh for physics shape"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:
This walkthrough will go through how to make the physical shape that can be bumped into.  
This walkthrough will go through how to make the physical shape that can be bumped into.  


One key thing to understand first is that the model that you see and the model that you bump into can be defined by different meshes. We're ideally looking to make a physical shape that is only detailed enough to give the illusion that you are bumping into the shape that you see, because if the physical shape is extremely detailed, the simulator will slow down when the model collides with objects or avatars.
One key thing to understand is that the model that you see, and the model that you bump into, can be defined by different meshes. We want to make a physical shape that is just detailed enough to give the ''illusion'' that you are bumping into the shape that you see, because if the physical shape is extremely detailed, the simulator will slow down when the model collides with objects or avatars.


== Obtain a Second Life compatible mesh file ==
== Obtain a Second Life compatible mesh file ==
The first step is to get a mesh file onto your computer that you want to upload to SL.  SL's mesh import is able to read [https://collada.org/mediawiki/index.php/COLLADA_-_Digital_Asset_and_FX_Exchange_Schema COLLADA] ("''.dae''") files.  For the purposes of creating a physics shape, you can pretty much use any model that you can successfully import into SL, so we'll use the basic duck here.
The first step is to get a mesh file onto your computer that you want to upload to SL.  SL's mesh import is able to read [https://collada.org/mediawiki/index.php/COLLADA_-_Digital_Asset_and_FX_Exchange_Schema COLLADA] ("''.dae''") files.  For the purposes of creating a physics shape, you can pretty much use any model that you can successfully import into SL, so we'll use the basic duck here.
* Click on this link -- https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/ -- to download the "''duck.dae''" COLLADA file.
# Click on this link -- https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/ -- to download the "''duck.dae''" COLLADA file.
* Save the file anywhere on your hard drive where you can find it subsequently.
# Save the file anywhere on your hard drive where you can find it later.
 


== Upload the mesh file to Second Life ==
== Upload the mesh file to Second Life ==
[[File:MeshWalkthrough-Import_Model.png|right|300px|thumb|Import Model Menu]]
[[File:MeshWalkthrough-Import_Model.png|right|300px|thumb|Import Model Menu]]
Next, take the file that you downloaded to your computer and upload it to SL. (Note that during beta, uploading is free!)
Next, take the file that you downloaded to your computer and upload it to SL. (Note that during beta, uploading is free!)
* Open the main menu "''Build''" menu, choose "''Upload''", click "''Model...''".
# Open the main menu "''Build''" menu, choose "''Upload''", click "''Model...''".
*: (Alternately, open your Inventory View, click the "''+''" menu button, "''Upload''" > "''Model...''").
#: (Alternately, open your Inventory View, click the "''+''" menu button, "''Upload''" > "''Model...''").
*: This will cause a file dialog box will open.
#: A file dialog box opens.
* Find and select the "''duck.dae''" file from your computer.
# Find and select the "''duck.dae''" file from your computer.
*: The Import Model window will then appear.
#: The Import Model window will then appear.
* Click the "''Generate LOD''" button at the top of this window.
# Click the "''Generate LOD''" button at the top of this window.
*: The viewer will take a moment to process this.
#: The viewer will take a moment to process this.


* Find the drop down item called "''Physical Shape''", choose "''Triangle Limit''".
# Find the drop down item called "''Physical Shape''", choose "''Triangle Limit''".
*: A text field will appear to enter the triangle limit, and the preview will show a single triangle.
#: A text field will appear to enter the triangle limit, and the preview will show a single triangle.
* Type "''500''" into the text field and then hit enter.
# Type "''500''" into the text field and then hit enter.
*: Note: You can choose a different number, although using a very large number will cause the next steps to take longer to process.  500 is high enough to make a good approximation of the duck shape for most physics purposes.  
#: Note: You can choose a different number, although using a very large number will cause the next steps to take longer to process.  500 is high enough to make a good approximation of the duck shape for most physics purposes.  
* A duck will appear in the preview window, at lower resolution than your original duck.
# A duck will appear in the preview window, at lower resolution than your original duck.
*: This is just the physics representation; it doesn't mean that your duck will appear in-world in that low resolution.
#: This is just the physics representation; it doesn't mean that your duck will appear in-world in that low resolution.
[[File:MeshWalkthrough-Generate_LOD_and_set_Physical_Shape.png|300px|Physics Representation]]
[[File:MeshWalkthrough-Generate_LOD_and_set_Physical_Shape.png|300px|Physics Representation]]


[[File:MeshWalkthrough-Physics_Decomposition_window.png|right|200px|thumb|Physics Decomposition Menu]]
[[File:MeshWalkthrough-Physics_Decomposition_window.png|right|200px|thumb|Physics Decomposition Menu]]
* Click the >> button next to "''Physical Shape''" to open the "''Physics Decomposition''" tool window.
# Click the >> button next to "''Physical Shape''" to open the "''Physics Decomposition''" tool window.
* In the "''Physics Decomposition''" tool window, set the "''Decompose Quality''" dropdown to "''Normal''".
# In the "''Physics Decomposition''" tool window, set the "''Decompose Quality''" dropdown to "''Normal''".
* Set the "''Method''" dropdown to "''Surface''".
# Set the "''Method''" dropdown to "''Surface''".


* Click the "''Decompose''" button.
# Click the "''Decompose''" button.
*: The viewer will take a few seconds to process.
#: The viewer will take a few seconds to process.
[[File:MeshWalkthrough-Decompose.png|300px|Decomposition Results]]
[[File:MeshWalkthrough-Decompose.png|300px|Decomposition Results]]


* Slide the "''Explode''" slider to see the decomposed shape.
# Slide the "''Explode''" slider to see the decomposed shape.
*: Note: The explode slider does not change the decomposed shape, it only moves it away from the Mesh visually so you can see it clearly.
#: Note: The explode slider does not change the decomposed shape, it only moves it away from the Mesh visually so you can see it clearly.
[[File:MeshWalkthrough-Explode_view.png|300px|Decomposition Explode View]]
[[File:MeshWalkthrough-Explode_view.png|300px|Decomposition Explode View]]


* Slide the "''Detail Scale''" slider to "''0.075''".
# Slide the "''Detail Scale''" slider to "''0.075''".
* Set the "''Simplify Method''" dropdown to "''Detail''".
# Set the "''Simplify Method''" dropdown to "''Detail''".
* Click the "''Simplify''" button.
# Click the "''Simplify''" button.
*: The Decomposed pieces are simplified into a few objects.
#: The Decomposed pieces are simplified into a few objects.
[[File:MeshWalkthrough-Simplify.png|300px|Simplified Decomposition]]
[[File:MeshWalkthrough-Simplify.png|300px|Simplified Decomposition]]


* In the main "''Import Model''" menu, click the "''Upload''" button to upload the mesh with this simplified Physics Shape.
# In the main "''Import Model''" menu, click the "''Upload''" button to upload the mesh with this simplified Physics Shape.


== Add your mesh object to the world ==
== Add your mesh object to the world ==
[[File:MeshWalkthrough-Physics_Shapes_setting.png|right|200px|thumb|Physics Shape display]]
[[File:MeshWalkthrough-Physics_Shapes_setting.png|right|200px|thumb|Physics Shape display]]
You can now add your model to the world and view its physics decomposition.
You can now add your model to the world and view its physics decomposition.
* Find your "''LOD3spShape''" object in your "''Objects''" folder; if you're having trouble or have a large inventory, use your inventory's "''RECENT''" tab view.
# Find your "''LOD3spShape''" object in your "''Objects''" folder; if you're having trouble or have a large inventory, use your inventory's "''RECENT''" tab view.
* Drag the new object from your "''Objects''" folder to anywhere on the ground where you have permissions to build.
# Drag the new object from your "''Objects''" folder to anywhere on the ground where you have permissions to build.
*: A duck model will appear on the ground.
#: A duck model will appear on the ground.
*: This model is now physics-enabled, meaning that it can interact with other physics items in the world.
#: This model is now physics-enabled, meaning that it can interact with other physics items in the world.
* Enable the "''Develop''" menu by hitting CTRL+ALT+Q or "''Main Menu->Advanced->Show Develop Menu''".
# Enable the "''Develop''" menu by hitting CTRL+ALT+Q or "''Main Menu->Advanced->Show Develop Menu''".
*: A new menu titled "''Develop''" should appear in your main menu bar.
#: A new menu titled "''Develop''" should appear in your main menu bar.
* Enable "''Main Menu->Develop menu->Render Metadata->Physics Shapes''".
# Enable "''Main Menu->Develop menu->Render Metadata->Physics Shapes''".
[[File:MeshWalkthrough-Physics_Shape_efficiency_visualized.png|right|200px|thumb|Physics Efficiency]]
[[File:MeshWalkthrough-Physics_Shape_efficiency_visualized.png|right|200px|thumb|Physics Efficiency]]
* Objects will display with a color overlay which indicates how efficient their physics representation is.  Aim to have the physics overlay appear in BLUE:
#: Objects display with a color overlay which indicates how efficient their physics representation is.  Aim to have the physics overlay appear in BLUE:
*: A blue overlay indicates the object's physics are efficient and will produce very little load on the sim.  
#:* A blue overlay indicates the object's physics are efficient and will produce very little load on the sim.  
*: A red overlay indicates the object could potentially cause high physics lag on the region.
#:* A red overlay indicates the object could potentially cause high physics lag on the region.
* Edit the duck and open the Object tab of the Edit tools.
# Edit the duck and open the Object tab of the Edit tools.
* Next to Physics Shape Type, choose Prim.
# Next to Physics Shape Type, choose Prim.
*: The blue overlay will change to display the more accurate Physics Shape you created.
#: The blue overlay will change to display the more accurate Physics Shape you created.


That's the end of the mesh walk-through. Visit the [[Mesh]] main page for more information.
This is the end of the mesh walkthrough. Visit the '''[[Mesh | Mesh main page]]''' for more information.
[[Category:Mesh]]
[[Category:Mesh]]

Revision as of 09:32, 29 November 2010


MeshWalkthrough-Decomposing Physics-Splash.png

This walkthrough will go through how to make the physical shape that can be bumped into.

One key thing to understand is that the model that you see, and the model that you bump into, can be defined by different meshes. We want to make a physical shape that is just detailed enough to give the illusion that you are bumping into the shape that you see, because if the physical shape is extremely detailed, the simulator will slow down when the model collides with objects or avatars.

Obtain a Second Life compatible mesh file

The first step is to get a mesh file onto your computer that you want to upload to SL. SL's mesh import is able to read COLLADA (".dae") files. For the purposes of creating a physics shape, you can pretty much use any model that you can successfully import into SL, so we'll use the basic duck here.

  1. Click on this link -- https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/ -- to download the "duck.dae" COLLADA file.
  2. Save the file anywhere on your hard drive where you can find it later.

Upload the mesh file to Second Life

Import Model Menu

Next, take the file that you downloaded to your computer and upload it to SL. (Note that during beta, uploading is free!)

  1. Open the main menu "Build" menu, choose "Upload", click "Model...".
    (Alternately, open your Inventory View, click the "+" menu button, "Upload" > "Model...").
    A file dialog box opens.
  2. Find and select the "duck.dae" file from your computer.
    The Import Model window will then appear.
  3. Click the "Generate LOD" button at the top of this window.
    The viewer will take a moment to process this.
  1. Find the drop down item called "Physical Shape", choose "Triangle Limit".
    A text field will appear to enter the triangle limit, and the preview will show a single triangle.
  2. Type "500" into the text field and then hit enter.
    Note: You can choose a different number, although using a very large number will cause the next steps to take longer to process. 500 is high enough to make a good approximation of the duck shape for most physics purposes.
  3. A duck will appear in the preview window, at lower resolution than your original duck.
    This is just the physics representation; it doesn't mean that your duck will appear in-world in that low resolution.

Physics Representation

Physics Decomposition Menu
  1. Click the >> button next to "Physical Shape" to open the "Physics Decomposition" tool window.
  2. In the "Physics Decomposition" tool window, set the "Decompose Quality" dropdown to "Normal".
  3. Set the "Method" dropdown to "Surface".
  1. Click the "Decompose" button.
    The viewer will take a few seconds to process.

Decomposition Results

  1. Slide the "Explode" slider to see the decomposed shape.
    Note: The explode slider does not change the decomposed shape, it only moves it away from the Mesh visually so you can see it clearly.

Decomposition Explode View

  1. Slide the "Detail Scale" slider to "0.075".
  2. Set the "Simplify Method" dropdown to "Detail".
  3. Click the "Simplify" button.
    The Decomposed pieces are simplified into a few objects.

Simplified Decomposition

  1. In the main "Import Model" menu, click the "Upload" button to upload the mesh with this simplified Physics Shape.

Add your mesh object to the world

Physics Shape display

You can now add your model to the world and view its physics decomposition.

  1. Find your "LOD3spShape" object in your "Objects" folder; if you're having trouble or have a large inventory, use your inventory's "RECENT" tab view.
  2. Drag the new object from your "Objects" folder to anywhere on the ground where you have permissions to build.
    A duck model will appear on the ground.
    This model is now physics-enabled, meaning that it can interact with other physics items in the world.
  3. Enable the "Develop" menu by hitting CTRL+ALT+Q or "Main Menu->Advanced->Show Develop Menu".
    A new menu titled "Develop" should appear in your main menu bar.
  4. Enable "Main Menu->Develop menu->Render Metadata->Physics Shapes".
Physics Efficiency
  1. Objects display with a color overlay which indicates how efficient their physics representation is. Aim to have the physics overlay appear in BLUE:
    • A blue overlay indicates the object's physics are efficient and will produce very little load on the sim.
    • A red overlay indicates the object could potentially cause high physics lag on the region.
  2. Edit the duck and open the Object tab of the Edit tools.
  3. Next to Physics Shape Type, choose Prim.
    The blue overlay will change to display the more accurate Physics Shape you created.

This is the end of the mesh walkthrough. Visit the Mesh main page for more information.