Difference between revisions of "Physics Optimization"
Naughty Mole (talk | contribs) |
Naughty Mole (talk | contribs) |
||
Line 32: | Line 32: | ||
6. Hold down shift and de-select the root prim (the simple shape) | 6. Hold down shift and de-select the root prim (the simple shape) | ||
7. Under the edit menu, in the features tab, select physics shape type, and from the drop down menu select, physics type none. This will | 7. Under the edit menu, in the features tab, select physics shape type, and from the drop down menu select, physics type none. This will set all the child prims to none. | ||
8. Select the root prim (the simple shape) and make it transparent. | 8. Select the root prim (the simple shape) and make it transparent. | ||
Line 44: | Line 44: | ||
Here we linked to a cube and set all child prims to physics shape type None (in Edit > Features > Physics Shape Type): | Here we linked a tree to a cube and set all child prims to physics shape type None (in Edit > Features > Physics Shape Type): | ||
<gallery> | <gallery> | ||
Line 53: | Line 53: | ||
'''Collision:''' | '''Collision:''' | ||
When your physics optimizing you really have to think of where you want the collision to be, because all the individual shapes set to physics none will act as thought they are phantom. So for this example we are using a tree. The actual original tree will be set to physics none and act as | When your physics optimizing you really have to think of where you want the collision to be, because all the individual shapes set to physics none will act as thought they are phantom. So for this example we are using a tree. The actual original tree will be set to physics none and act as though it is phantom.. you can walk through it… but the root prim, which in this case is a cylinder, will be the only solid part of the whole linked set. By putting the root prim/simple shape around the tree trunk, this makes it so that avatars cannot walk through the tree. Set the cylinder to transparent and then no-one can even see it. To everyone it looks like a highly detailed tree, when in actual fact it is a lot more performance efficient… it's only really a cylinder! | ||
In this example we used a cylinder, but we could have also used a stretched cube to achieve the same effect, and it would have cost slightly less. | In this example we used a cylinder, but we could have also used a stretched cube to achieve the same effect, and it would have cost slightly less. |
Revision as of 09:09, 30 April 2012
Physics Optimization:
(See handy script at bottom of page)
NOTE: Setting prims to Phantom does not stop them from being calculated by the physics engine!
The less the physics engine has to calculate, the smoother your region will perform. Creating clean low poly physics shapes for your complicated meshes is helpful, but you can also remove prim, mesh, and sculpted objects from the physics calculations completely.
Physics Optimization also helps with Pathfinding. Pathfinding objects will only have to calculate to go around simple objects instead of complex builds, and this makes everything work a lot smoother and faster without sacrificing the look of anything.
The way to Physics Optimize is to link your complicated builds to a simple shape like a cube or cylinder. The simple shape should be the root prim and then set all child prims to physics shape type None (in Edit > Features > Physics Shape Type)
Manual Instructions:
1. Build your object as you normally would
2. Create a simple shape, such as a cube or cylinder
3. Right click on your object, hold down shift and select the simple shape last
4. Press control and L to link it all (the simple shape should now be the root prim highlighted in yellow)
5. Tick edit linked parts
6. Hold down shift and de-select the root prim (the simple shape)
7. Under the edit menu, in the features tab, select physics shape type, and from the drop down menu select, physics type none. This will set all the child prims to none.
8. Select the root prim (the simple shape) and make it transparent.
Using the script below:
Or to make it even simpler just follow the above instructions 1 to 4 and then use the handy script attached below. Just drop it in the root prim (The new simple shape you just linked your build to)
Tip: Cubes are the cheapest shapes to use. Up to 14 cubes equates to the same value as one cut hallowed cube. Cylinders are also cheap, though not as cheap as cubes.
Here we linked a tree to a cube and set all child prims to physics shape type None (in Edit > Features > Physics Shape Type):
Collision:
When your physics optimizing you really have to think of where you want the collision to be, because all the individual shapes set to physics none will act as thought they are phantom. So for this example we are using a tree. The actual original tree will be set to physics none and act as though it is phantom.. you can walk through it… but the root prim, which in this case is a cylinder, will be the only solid part of the whole linked set. By putting the root prim/simple shape around the tree trunk, this makes it so that avatars cannot walk through the tree. Set the cylinder to transparent and then no-one can even see it. To everyone it looks like a highly detailed tree, when in actual fact it is a lot more performance efficient… it's only really a cylinder!
In this example we used a cylinder, but we could have also used a stretched cube to achieve the same effect, and it would have cost slightly less.
For more complicated builds you can set certain parts to physics shape prim and others to physics shape none. The parts set to physics shape prim will act soild, and the parts set to physics shape type none, will act as phantom… but the overall aim is to make the solid parts as simple a shape as possible.
More Examples:
Here is another example scenario. This is a sculpted prim fence. The physics shape is not as clean as it could be, and the edges don't cover all edges of the fence itself. To fix it, I created a cube physics shape, linked the fence to the cube with the cube as the root prim, and set the fence to Physics Shape Type: None. As you can see, the resulting physics shape is lower in polygons and better covers the fence area.
This is a tree comprised of many sculpted pieces. Keep in mind that the physics engine needs to calculate every part of the physics shape in the second picture. Here I created a cylinder for the physics shape to fit on the bottom of the tree trunk. By linking the cylinder to the tree, and setting the tree to physics shape none, I have a much cleaner static object.
Use the following script to set all child prims to None. Be sure to check what physics are needed for your linkset prior to using, and/or add a simple cube as the root prim. <lsl> default {
state_entry() { llShout(0, "Setting all child prims to PRIM_PHYSICS_SHAPE_NONE"); llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE]); llRemoveInventory(llGetScriptName()); }
} </lsl>