Difference between revisions of "Mesh and LOD"

From Second Life Wiki
Jump to navigation Jump to search
m (translation)
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Scope: This is to compliment existing information, and links off to avoid too much redundancy.
{{multi-lang}}
 
==Mesh will make Second Life beautiful!==
 
 
Mesh is of a collection of Vertices, Edges, and Faces that define a 3D shape within computer software.
 
 
*The basic element of mesh is a Vertex. Vertices define points in space, their direction, texture information, and much more. 
*Connecting two vertices creates an Edge. 
*Connecting three or four edges together creates a face.
**There are two kinds of faces.
***Triangle faces.
***Quad faces.
 
[[File:vertices black640.png]]
Three vertices
 
[[File:edges 640.png]]
Two Edges connecting three vertices
 
[[File:triangle6401.png]]
Triangle face connecting 3 edges
 
[[File:quad640.png]]
Quad face connecting 4 edges.
 
 
 
 
Together they combine to make This!
 
[[File:Mesh Image640.png]]
 
==File Format==
Second Life uses COLLADA's 1.4.1 file format for the uploading of mesh items.
COLLADA is a powerful open standard collaborative format. The files are in a humanly readable XML format with an extension of .dae.
 
More than you'll Ever need to know about COLLADA.
[http://en.wikipedia.org/wiki/COLLADA]
[https://collada.org/mediawiki/index.php/COLLADA_-_Digital_Asset_and_FX_Exchange_Schema]
 
Second Life COLLADA format spec.
[http://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format]
 
==Software==
 
The list of applications that can create mesh and export to COLLADA is long and exciting!
 
Here is the short list:
 
*Maya [http://usa.autodesk.com/maya/]
*3dsMax [http://usa.autodesk.com/3ds-max/]
**Including many other Autodesk tools.
*Blender [http://www.blender.org/]
**Blender history(interesting read) [http://en.wikipedia.org/wiki/Blender_%28software%29]
**additional Second Life Mesh Blender specific tutorials here: [http://blog.machinimatrix.org/] and [http://cgcookie.com]
*Sketchup [http://www.sketchup.com/]
*Wings 3D [http://www.wings3d.com/]
**no UV mapping tool.
*Daz Studio [http://www.daz3d.com/]
 
Many other software packages can create mesh, though, some may require minor settings adjustments or even external programs to generate .dae files.
 
Here is the extensive list. [http://wiki.secondlife.com/wiki/Mesh/Tools]
 
*File Examples in COLLADA .dae file format. [http://wiki.secondlife.com/wiki/Mesh/Sample_Content]
 
 
==Further detail and spec.==
 
==Level Of Detail==
==Level Of Detail==


Level Of Detail or LOD is the art of lowering an objects detail as the viewer gets further away.  With Mesh uploads we now have complete control over each level.
''Level of Detail'' (LOD) is the mechanism by which Second Life lowers an object's visual detail by increments as the camera gets further away.  When uploading a mesh model, we have complete control over the amount of detail at each level.


*The uploader supports 4 LOD levels.  
*The uploader supports four levels of detail.  
*The uploader will generate LOD levels for youWhich are sufficient, but one can achieve smoother transitions between levels by creating you own LOD models.   
*The uploader automatically generates lower LODs suitable for preview or rough importYou can achieve smoother transitions between levels by creating your own lower LOD models.   
*The uploader allows the same file to be used in multiple LOD level slots. This is handy for smaller objects, but use it carefully and wisely.
*LOD culling (the viewing distance at which the detail levels change) is affected by an object's scale.  A large object shows a higher LOD than a smaller object at the same distance.  Remember this when creating your LOD models and when uploading.
*LOD culling is affected by an objects scale. A larger object with show a higher LOD level than a smaller one at the same distance.  Remember this when creating your LOD models and when uploading.
*The uploader allows the same file to be used in multiple LOD level slots. This is useful for ensuring detail on smaller objects but use it wisely; using a highly detailed model in all slots can adversely affect the model's land impact and rendering performance.
*Each LOD model must retain all the materials of the highest detailed model. If your model has 8 materials, so must all your LOD models. Ignoring this will result in unpredictable texture location changes.  
*Make sure the bounding boxes of all the LOD models are identical in size. This prevents the object from changing its scale as it transitions through the LOD levels. Most modeling applications offer ways to view the bounding box of multiple objects at the same time.
TIP:ignoring this requirement wont stop the uploader.  If you have a model that is displaying textures oddly, look closely at the materials in your LOD files.
*Each LOD model must retain all the materials of the highest detailed model. If your model has 8 materials, so must all your LOD models. Ignoring this will result in unpredictable texture location changes. Ignoring the materials requirement won't stop the uploader.  If you have a model that is displaying textures improperly, look closely at the materials in your LOD files.
*It is also important that the bounding boxes of all the LOD models are identical in size. This keeps the object from changing its scale as it transitions through the LOD levels. Most modeling applications offer  up ways to view the bounding box of multiple objects at the same time.
* A general guideline for creating LOD models is to reduce the triangle count by 50%-75% at each level. For example: If the most detailed model is 400 triangles, the next level should be no higher than 200 triangles. The next level should be no higher than 100, and the lowest should be near or below 50 triangles.


A good general rule to go by when creating LOD models would be to half the poly count of the level above it. For example: If the hero model is 500 poly, the next level should be close to 250 poly, the next 125, and the lowest near 75 poly.  This can't be a hard rule, as object size, and use cases have to be taken into account.
Uploading a mesh model step by step on the Second Life Knowledge Base: [http://community.secondlife.com/t5/English-Knowledge-Base/Uploading-a-mesh-model/ta-p/974185 Uploading a mesh model]


Uploading a mesh model step by step
===Brief Uploader LOD section walk through===
[http://community.secondlife.com/t5/English-Knowledge-Base/Uploading-a-mesh-model/ta-p/974185]


===Brief Uploader LOD section walk through, two ways===
==== Uploader Generated LODs ====


*Uploader Generated LODs*
# Choose '''Build > Upload > Model...''' from the top menu bar.
# In the High file slot click '''Browse''', then select the .dae file on your computer and click '''Open'''.
# Click on the Medium level slot to highlight that level.  Highlighting any level displays that level's model in the '''Preview''' pane.  Use the up and down arrows on each level to raise or lower the triangle count until satisfied with the transition between the LODs.
# Click '''Calculate weights & fee''' and see if you like the Land Impact count, but don't upload yet! We still need to adjust the model's physics properties.


*1 Choose Build > Upload > Model...
For full details on Triangle Limit and Error Threshold, see [[Mesh/Upload_Model_UI_reference|Upload Model UI reference]].
*2 In the High file slot open select the .dae file on your computer and click Open.
*3 Clicking on the Medium level slot to highlight that level.  Highlighting any level displays that levels model in the window to the right.  Use the up and down arrows in each level to raise or lower the triangle count until satisfied with the transition between the LODs
Done!  Hit calculate and see if you like the LI count. But don't upload yet! I have more tricks to show you.
For full details on Triangle Limit and Error Threshold, see Upload Model UI reference. [https://wiki.secondlife.com/wiki/Mesh/Upload_Model_UI_reference]


*User created LOD files*
==== User created LOD files ====


*1 Choose Build > Upload > Model...  
# Choose '''Build > Upload > Model...''' from the top menu bar.
*2 In the High LOD slot load the highest detailed model.
# In the High LOD slot load the highest detailed model as described above.
*3 In the Medium slot load the second highest LOD model.
# In the Medium slot load the second highest LOD model.
*4 In the Low file slot load the second to lowest LOD model
# In the Low file slot load the second to lowest LOD model
*5 In the Lowest slot load the lowest LOD model.
# In the Lowest slot load the lowest LOD model.
 
# Click '''Calculate weights & fee''' and see if you like the Land Impact count, but don't upload yet! We still need to adjust the model's physics properties.
 
Hit calculate and see if you like the LI count, but don't upload yet! A physics shape still needs to be assigned.


==Physics==
==Physics==
Second Life supports custom physics shapes, which can be uploaded with a mesh object or uploaded independently.  This allows for the creation of a visually complex object that has a low physics weight.  For Havok's official (and extremely technical) best practices in creating physics shapes, see [http://community.secondlife.com/t5/English-Knowledge-Base/Best-practices-for-creating-efficient-collision-volumes/ta-p/984115 Best practices for creating efficient collision volumes] in the Second Life Knowledge Base.


Second Life supports custom physics shapesBoth uploaded with a mesh object or uploaded independentlyThis allows for a visually complex object with an low physics impact/cost.
===Havok Physics tips and oversimplifications===
[https://wiki.secondlife.com/wiki/Physics_engine Havok] LOVES cubes, and here is why: Havok is optimized to process cubes nearly instantaneouslyConversely, when Havok encounters an object more complex than a cube(even a hollow or cut cube) it then has to count ''every single triangle'' on that object and ponder what to do with each oneSo keep those physics shapes as simple as possible!


===General Havok Physics thoughts and over simplifications===
Here are some guidelines for creating physics shapes for various types of projects:
Havok[https://wiki.secondlife.com/wiki/Physics_engine] LOVES cubes.  More than we love chocolate!  It doesn't like triangles nearly as much.  Here is why.  When Havok sees a cube it is optimized to process that cube nearly instantaneouslyConversely, when Havok encounters an object more complex than a cube(even a hollow or cut cube) it then has to count Every Single triangle on that object and ponder what to do with each one.  So keep those physics shapes as simple as possible!
* For large, concave shapes (like a house), use a custom physics mesh with a minimal triangle count. The larger the triangles used in the physics mesh, the lower the physics cost.
* For very simple objects that don't need precision collision shapes (like the trunk of a tree), try using a trivial physics shape like a boxFor more information on this method, see [[Physics Optimization]].
* For intermediate objects that are too small to efficiently use a custom physics mesh but need a fairly accurate collision model, use the physics tab of the mesh uploader as described below.


===Physics shapes and how they relate to mesh uploads and LOD===
===Physics shapes and how they relate to mesh uploads and LOD===
 
[http://community.secondlife.com/t5/English-Knowledge-Base/Uploading-a-mesh-model/ta-p/974185#Section_.5 Here are step-by-step instructions on using the physics tab of the mesh uploader.]
*Creating your own physics shapes in a modeling application is easy.
**Keep the poly count extremely low.
**Make sure the physics shape model fills the bounding box of your model and LODs, or it will not line up with your visual geometry.
**Export using a .dae COLLADA file.
 
The physics tab of the uploader step by step.
[http://community.secondlife.com/t5/English-Knowledge-Base/Uploading-a-mesh-model/ta-p/974185#Section_.5]


This tab allows nearly infinite flexibility.  Here is a quick description of the uploader physics tab. This is redundant but is needed to illustrate the importance and usefulness of the Analyze button.
This tab allows nearly infinite flexibility.  Here is a quick description of the uploader physics tab. This is redundant but is needed to illustrate the importance and usefulness of the Analyze button.


Step 1: Level of Detail
====Step 1: Level of Detail====
*You can assign any of your LOD levels as the physics shape.
* You can assign any of your LOD levels as the physics shape.
*Or insert a new file for the physics shape.
* Or insert a new file for the physics shape.
*Or generate the physics shape right there in the uploader.
* Or generate the physics shape right there in the uploader.


Step 2: Analyze IMPORTANT
====Step 2: Analyze====
*A mesh physics shape uploaded without using the Analyze button will result in the faces being double sided inworld.  For instance: a single plane will upload as a double sided wall.  A cube will upload as a hollow box. This is useful for creating simple shapes, but also risky as it can create areas that will trap avatars and other physical objects.
* A mesh physics shape uploaded without using the Analyze button will result in the faces being double sided inworld.  For instance: a single plane will upload as a double sided wall.  A cube will upload as a hollow box. This is useful for creating simple shapes, but also risky as it can create areas that will trap avatars and other physical objects.
*Pressing the Analyze button changes all those double sided faces into single sided faces with respect to the normal direction. It also creates a physics shape that acts as a volume.  Much like a prim, an Avatar or physical object interpolated with an Analyzed physics shape is neatly pushed out of the volume by Havok.
* Pressing the Analyze button generates a set of ''convex shapes'' (shapes with no holes or depressions) that approximates the original mesh shape; these convex hulls create a physics shape that acts as a volume.  Avatar or physical objects stuck inside an Analyzed physics shape are neatly pushed out of the volume by Havok.


Step 3: Simplify  
====Step 3: Simplify====
*From here you can simplify.
* From here you can simplify.
*close holes in more complex shapes. This is useful when using an LOD level for the physics shape.
* Close holes in more complex shapes. This is useful when using an LOD level for the physics shape.
   
   


The goal should always be a the simplest physics shape possible.  Using the uploader tools here to keep the geometry and physics count as low as possible.
The goal should always be a the simplest physics shape possible.  Use the uploader tools here to keep the geometry and physics count as low as possible.


==UV mapping==
==UV mapping==
 
Anyone who has used the Build Tools inside of Second Life already understands UV mapping, but perhaps under different terminology.  UV mapping is simply setting texture repeats(U and V) and offsets. If you look closely at the Build Tools Texture tab you'll see that U and V are used for the texture offset values already.  Lean on that familiarity and this concept will come more easily.  
Anyone who has used the Build Tools inside of Second Life already understands UV mapping, but perhaps under different terminology.  UV mapping is simply setting texture repeats(U and V) and offsets. If you look closely at the Build Tools Texture tab you'll see that U and V are used for the texture offset values already.  Lean on that familiarity and this concept will come more easily.  
(world map image illustrating unwrapped earth)
 


===General UV mapping techniques===
===General UV mapping techniques===


====Standard UV mapping====
====Standard UV mapping====
The most common UV map technique divides the mesh surface into neatly flattened sections. Most 3D modeling software packages have this functionality built in. The result is familiar to us and looks like this:
The most common UV map technique divides the mesh surface into neatly flattened sections. Most 3D modeling software packages have this functionality built in.
(image of SL face UV map)


UV mapping this way has advantages and disadvantages.
UV mapping this way has advantages and disadvantages:
*The shapes created usingthis UV mapping technique makes it easier to visualize how the texture will apply inworld, which makes modifying and drawing on the texture easier.
*The shapes created usingthis UV mapping technique makes it easier to visualize how the texture will apply inworld, which makes modifying and drawing on the texture easier.
*Most 3D modeling software packages can be used to generate beautiful textures using this mapping technique(in conjunction with Projection mapping, scene lighting, etc.).
*Most 3D modeling software packages can be used to generate beautiful textures using this mapping technique(in conjunction with Projection mapping, scene lighting, etc.).
*The disadvantages come in to play with larger or very complex objects. One simple runs out of pixels(or texture space) if trying to flatten a complex object onto one UV map. Large objects often need a seamless repeatable texture.  
*The disadvantages become apparent with larger or very complex objects. One simply runs out of pixels(or texture space) if trying to flatten a complex object onto one UV map. Instead, large objects often need a seamless repeatable texture.  
 
(image of theater UV with zanny blurry wallpaper.)


====Projection UV mapping====
====Projection UV mapping====
Projection UV mapping is much like applying textures to a prim object inworld, the goal of UV mapping this way is to scale, rotate, and offset a diffuse texture so the object wears it perfectly.
Projection UV mapping is much like applying textures to a prim object inworld, the goal of projection UV mapping is to scale, rotate, and offset a diffuse texture so the object wears it perfectly.
*The advantage of mapping this way for Second Life is versatility. A house UV mapped this way can wear any number of standard wall, roof, or trim textures.  
*The advantage of projection UV mapping is versatility. A house UV mapped this way can wear any number of standard wall, roof, or trim textures.  
*The texture can be repeat and offset.  
*The texture can be repeated and offset.  
*The texture can be animated.  
*The texture can be animated.  


*disadvantages:  
Disadvantages:  
**potential for texture size overuse inworld.  
*Potential for texture size overuse inworld.  
**Models uploaded with projection UV maps can not take advantage of modeling softwares texture baking capability.  
*Models uploaded with projection UV maps can not take advantage of modeling software's texture baking capability.
(image of wall wearing obvious square textures)


====Baking textures====
====Baking textures====
An advanced feature of most modeling software packages uses both the Standard UV map and the Projection maps to render an image is sometimes referred to as Baking a texture. The goal is to use all the texture information stored in the Projection maps to create an image that fits the Standard UV map. This render can influenced by any lighting or other objects in the scene.  
An advanced feature of most modeling software packages uses both the Standard UV map and the projection maps to render an image.  This is sometimes referred to as "baking" a texture. The goal is to use all the texture information stored in the Projection maps to create an image that fits the Standard UV map. This render can be influenced by any lighting or other objects in the scene.
 
 


==Texture Faces==  
==Texture Faces==  
Line 184: Line 97:
*Each LOD model must all have the same number of Texture faces.  
*Each LOD model must all have the same number of Texture faces.  
*All the separate faces need to use the same UV map.  
*All the separate faces need to use the same UV map.  
*Each modeling software handles this slightly differently. Assigning different areas to different materials archives separate Texture faces on an uploaded Mesh in some modelers, and assigning areas to separate textures achieves this in others. Application specific information [http://wiki.secondlife.com/wiki/Mesh/Uploading_a_multi-face_mesh]
*Each modeling software handles this slightly differently. Assigning different areas to different materials archives separate Texture faces on an uploaded Mesh in some modelers, and assigning areas to separate textures achieves this in others. [http://wiki.secondlife.com/wiki/Mesh/Uploading_a_multi-face_mesh Here are some examples of application specific information.]


==Normals==
==Normals==
Normal is an adjective that describes something that is perpendicular to a plane. [http://en.wikipedia.org/wiki/Normal_%28geometry%29]
A [http://en.wikipedia.org/wiki/Normal_%28geometry%29 ''normal''] is something that is perpendicular to a plane.
For the scope of this article, normal describes the direction a face is pointing. Most 3d renderers, the Second Life Viewer included, smartly render only one side of a face. This saves cycles but assumes model is Manifold (enclosed in a way that won't encourage views inline with the normal, or are double sided where needed)  
For the scope of this article, normal describes the direction a face is pointing. Most 3D renderers, the Second Life Viewer included, smartly render only one side of a face. This saves cycles but assumes model is ''manifold'' (enclosed in a way that won't encourage views inline with the normal, or are double sided where needed)  


[[File:normal and flipped normal sphere.png]]
[[File:normal and flipped normal sphere.png|256px]]
Two spheres. Left: Normals pointing out, Right: Normals pointing in.
Two spheres. Left: Normals pointing out, Right: Normals pointing in.


===Smooth Normals===
===Smooth Normals===
In the case of a round or curved multiple face surface, a Normal average can be used; which allows an inexpensive surface smoothing. Commonly known as Smooth Normals or Smooth shading, it is an invaluable tool when creating low poly Second Life content.  
In the case of a round or curved multiple face surface, a normal average can be used. A normal average allows inexpensive surface smoothing. Commonly known as "smooth normals" or "smooth shading", it is an invaluable tool when creating low polygon Second Life content. Smooth normals allow fewer faces to appear as a visually smooth surface, requiring far fewer faces. For example, a five-sided cylinder with smooth normals can appear completely round in Second Life. In some cases, a even a three-sided cylinder can appear perfectly round.  
Smooth Normals allow fewer faces to achieve a visually smooth surface. Far far fewer faces.  
For example, a five sided cylinder with smooth normals can appear completely round in Second Life. In some cases, a three sided cylinder will appear perfectly round.  


[[File:smooth cylinder next to not smooth.png]]
{|
Two 5 sided cylinders.  Top: Solid Normals. Bottom: Smooth normals.   
|-
|[[File:smooth cylinder next to not smooth.png|256px]]
|Two five-sided cylinders.  Top: Solid normals. Bottom: Smooth normals.   
Note where both cylinders intersect the walls, they show the profile of the actual geometry.
Note where both cylinders intersect the walls, they show the profile of the actual geometry.
|-
|[[File:candlestick.png|256px]]
|Applying smooth normals to some areas and not to others can be useful for adding detail or highlighting edges.
|}


Applying Smooth Normals to some areas and not to others is another useful for adding detail or highlighting edges.
==Low polygon modeling==
 
[[File:candlestick.png]]
 
==Low poly modeling==
 
We are not making the next Avatar movie, we are streaming triangles and data near the speed of light. Make sure each and every poly and bit counts.
There are many low poly modeling techniques and software specific tutorials and tools available around the web. [http://en.wikipedia.org/wiki/Low_poly]


The goal should always be to save every triangle everywhere you can on the model you plan to upload.  
It is important to remember that Hollywood-quality digital models are extremely costly to use in Second Life. Real-time rendering means Second Life must stream triangles and data near the speed of light. Make sure each and every polygon and bit counts!
*Ensure that any flat surface uses the least amount of faces as possible.  
There are many [http://en.wikipedia.org/wiki/Low_poly low polygon] modeling techniques and software-specific tutorials and tools available around the web.  
*Use Smooth Normals to fake smooth curved surfaces.  
*Use a low poly rendering tricks to bake detailed textures.  


===Low Poly Texture baking tricks===
The goal is to save every triangle you can on the model you plan to upload:
The idea is to create a very highly detailed model and use it to render gorgeous textures on to a very simple low poly Second Life friendly version.
*Ensure that any flat surface uses the smallest number of triangles possible.
Making the name low poly modeling slightly deceptive. As you will most likely model and render a very high poly scene. But, the result is a very efficient model with very detailed textures, well poised for incoming Normal and Specular maps.  
*Use smooth normals to "fake" smooth curved surfaces.  
*Use low polygon rendering tricks to bake detailed textures, which can provide the illusion of more geometric detail.  


Most modeling software packages have features built in to facilitate this technique. Look up your favorites', it will be time very well spent.
===Low polygon texture baking tricks===
It is possible to create a very highly detailed model and use it to render gorgeous textures on the faces of a very simple low polygon (Second Life friendly) version.
In this case, the name "low polygon modeling" sounds slightly deceptive because you will model and render a very high polygon scene for the purposes of creating the textured illusion. However, the final product is a very efficient, low-polygon model with very detailed textures mapped onto it.  


==Best practices hit list==
Most modeling software packages have features built in to facilitate this technique.
*Low poly count.
*Smart UV mapping for efficient texture use and size.
*Smart LOD settings and files.
*Smart appropriately Analyzed simple physic shapes.

Latest revision as of 01:53, 20 December 2012

Level Of Detail

Level of Detail (LOD) is the mechanism by which Second Life lowers an object's visual detail by increments as the camera gets further away. When uploading a mesh model, we have complete control over the amount of detail at each level.

  • The uploader supports four levels of detail.
  • The uploader automatically generates lower LODs suitable for preview or rough import. You can achieve smoother transitions between levels by creating your own lower LOD models.
  • LOD culling (the viewing distance at which the detail levels change) is affected by an object's scale. A large object shows a higher LOD than a smaller object at the same distance. Remember this when creating your LOD models and when uploading.
  • The uploader allows the same file to be used in multiple LOD level slots. This is useful for ensuring detail on smaller objects but use it wisely; using a highly detailed model in all slots can adversely affect the model's land impact and rendering performance.
  • Make sure the bounding boxes of all the LOD models are identical in size. This prevents the object from changing its scale as it transitions through the LOD levels. Most modeling applications offer ways to view the bounding box of multiple objects at the same time.
  • Each LOD model must retain all the materials of the highest detailed model. If your model has 8 materials, so must all your LOD models. Ignoring this will result in unpredictable texture location changes. Ignoring the materials requirement won't stop the uploader. If you have a model that is displaying textures improperly, look closely at the materials in your LOD files.
  • A general guideline for creating LOD models is to reduce the triangle count by 50%-75% at each level. For example: If the most detailed model is 400 triangles, the next level should be no higher than 200 triangles. The next level should be no higher than 100, and the lowest should be near or below 50 triangles.

Uploading a mesh model step by step on the Second Life Knowledge Base: Uploading a mesh model

Brief Uploader LOD section walk through

Uploader Generated LODs

  1. Choose Build > Upload > Model... from the top menu bar.
  2. In the High file slot click Browse, then select the .dae file on your computer and click Open.
  3. Click on the Medium level slot to highlight that level. Highlighting any level displays that level's model in the Preview pane. Use the up and down arrows on each level to raise or lower the triangle count until satisfied with the transition between the LODs.
  4. Click Calculate weights & fee and see if you like the Land Impact count, but don't upload yet! We still need to adjust the model's physics properties.

For full details on Triangle Limit and Error Threshold, see Upload Model UI reference.

User created LOD files

  1. Choose Build > Upload > Model... from the top menu bar.
  2. In the High LOD slot load the highest detailed model as described above.
  3. In the Medium slot load the second highest LOD model.
  4. In the Low file slot load the second to lowest LOD model
  5. In the Lowest slot load the lowest LOD model.
  6. Click Calculate weights & fee and see if you like the Land Impact count, but don't upload yet! We still need to adjust the model's physics properties.

Physics

Second Life supports custom physics shapes, which can be uploaded with a mesh object or uploaded independently. This allows for the creation of a visually complex object that has a low physics weight. For Havok's official (and extremely technical) best practices in creating physics shapes, see Best practices for creating efficient collision volumes in the Second Life Knowledge Base.

Havok Physics tips and oversimplifications

Havok LOVES cubes, and here is why: Havok is optimized to process cubes nearly instantaneously. Conversely, when Havok encounters an object more complex than a cube(even a hollow or cut cube) it then has to count every single triangle on that object and ponder what to do with each one. So keep those physics shapes as simple as possible!

Here are some guidelines for creating physics shapes for various types of projects:

  • For large, concave shapes (like a house), use a custom physics mesh with a minimal triangle count. The larger the triangles used in the physics mesh, the lower the physics cost.
  • For very simple objects that don't need precision collision shapes (like the trunk of a tree), try using a trivial physics shape like a box. For more information on this method, see Physics Optimization.
  • For intermediate objects that are too small to efficiently use a custom physics mesh but need a fairly accurate collision model, use the physics tab of the mesh uploader as described below.

Physics shapes and how they relate to mesh uploads and LOD

Here are step-by-step instructions on using the physics tab of the mesh uploader.

This tab allows nearly infinite flexibility. Here is a quick description of the uploader physics tab. This is redundant but is needed to illustrate the importance and usefulness of the Analyze button.

Step 1: Level of Detail

  • You can assign any of your LOD levels as the physics shape.
  • Or insert a new file for the physics shape.
  • Or generate the physics shape right there in the uploader.

Step 2: Analyze

  • A mesh physics shape uploaded without using the Analyze button will result in the faces being double sided inworld. For instance: a single plane will upload as a double sided wall. A cube will upload as a hollow box. This is useful for creating simple shapes, but also risky as it can create areas that will trap avatars and other physical objects.
  • Pressing the Analyze button generates a set of convex shapes (shapes with no holes or depressions) that approximates the original mesh shape; these convex hulls create a physics shape that acts as a volume. Avatar or physical objects stuck inside an Analyzed physics shape are neatly pushed out of the volume by Havok.

Step 3: Simplify

  • From here you can simplify.
  • Close holes in more complex shapes. This is useful when using an LOD level for the physics shape.


The goal should always be a the simplest physics shape possible. Use the uploader tools here to keep the geometry and physics count as low as possible.

UV mapping

Anyone who has used the Build Tools inside of Second Life already understands UV mapping, but perhaps under different terminology. UV mapping is simply setting texture repeats(U and V) and offsets. If you look closely at the Build Tools Texture tab you'll see that U and V are used for the texture offset values already. Lean on that familiarity and this concept will come more easily.

General UV mapping techniques

Standard UV mapping

The most common UV map technique divides the mesh surface into neatly flattened sections. Most 3D modeling software packages have this functionality built in.

UV mapping this way has advantages and disadvantages:

  • The shapes created usingthis UV mapping technique makes it easier to visualize how the texture will apply inworld, which makes modifying and drawing on the texture easier.
  • Most 3D modeling software packages can be used to generate beautiful textures using this mapping technique(in conjunction with Projection mapping, scene lighting, etc.).
  • The disadvantages become apparent with larger or very complex objects. One simply runs out of pixels(or texture space) if trying to flatten a complex object onto one UV map. Instead, large objects often need a seamless repeatable texture.

Projection UV mapping

Projection UV mapping is much like applying textures to a prim object inworld, the goal of projection UV mapping is to scale, rotate, and offset a diffuse texture so the object wears it perfectly.

  • The advantage of projection UV mapping is versatility. A house UV mapped this way can wear any number of standard wall, roof, or trim textures.
  • The texture can be repeated and offset.
  • The texture can be animated.

Disadvantages:

  • Potential for texture size overuse inworld.
  • Models uploaded with projection UV maps can not take advantage of modeling software's texture baking capability.

Baking textures

An advanced feature of most modeling software packages uses both the Standard UV map and the projection maps to render an image. This is sometimes referred to as "baking" a texture. The goal is to use all the texture information stored in the Projection maps to create an image that fits the Standard UV map. This render can be influenced by any lighting or other objects in the scene.

Texture Faces

  • Second Life's COLLADA mesh uploader supports up to 8 separate texture faces.
  • Each LOD model must all have the same number of Texture faces.
  • All the separate faces need to use the same UV map.
  • Each modeling software handles this slightly differently. Assigning different areas to different materials archives separate Texture faces on an uploaded Mesh in some modelers, and assigning areas to separate textures achieves this in others. Here are some examples of application specific information.

Normals

A normal is something that is perpendicular to a plane. For the scope of this article, normal describes the direction a face is pointing. Most 3D renderers, the Second Life Viewer included, smartly render only one side of a face. This saves cycles but assumes model is manifold (enclosed in a way that won't encourage views inline with the normal, or are double sided where needed)

Normal and flipped normal sphere.png Two spheres. Left: Normals pointing out, Right: Normals pointing in.

Smooth Normals

In the case of a round or curved multiple face surface, a normal average can be used. A normal average allows inexpensive surface smoothing. Commonly known as "smooth normals" or "smooth shading", it is an invaluable tool when creating low polygon Second Life content. Smooth normals allow fewer faces to appear as a visually smooth surface, requiring far fewer faces. For example, a five-sided cylinder with smooth normals can appear completely round in Second Life. In some cases, a even a three-sided cylinder can appear perfectly round.

Smooth cylinder next to not smooth.png Two five-sided cylinders. Top: Solid normals. Bottom: Smooth normals.

Note where both cylinders intersect the walls, they show the profile of the actual geometry.

Candlestick.png Applying smooth normals to some areas and not to others can be useful for adding detail or highlighting edges.

Low polygon modeling

It is important to remember that Hollywood-quality digital models are extremely costly to use in Second Life. Real-time rendering means Second Life must stream triangles and data near the speed of light. Make sure each and every polygon and bit counts! There are many low polygon modeling techniques and software-specific tutorials and tools available around the web.

The goal is to save every triangle you can on the model you plan to upload:

  • Ensure that any flat surface uses the smallest number of triangles possible.
  • Use smooth normals to "fake" smooth curved surfaces.
  • Use low polygon rendering tricks to bake detailed textures, which can provide the illusion of more geometric detail.

Low polygon texture baking tricks

It is possible to create a very highly detailed model and use it to render gorgeous textures on the faces of a very simple low polygon (Second Life friendly) version. In this case, the name "low polygon modeling" sounds slightly deceptive because you will model and render a very high polygon scene for the purposes of creating the textured illusion. However, the final product is a very efficient, low-polygon model with very detailed textures mapped onto it.

Most modeling software packages have features built in to facilitate this technique.