MantisBT - opensim
View Issue Details
0007575opensim[REGION] Script Functionspublic2015-05-16 14:072015-05-23 05:20
Intel Core i7Ubuntu14.04
master (dev code) 
master (dev code) 
0.8.2 dev
Grid (1 Region per Sim)
Mono / Linux32
Singularity 1.8.6 OS X
0007575: llCastRay V3 performance improved by mesh caching
llCastRay V3 use much time and resources meshing prims, sculpts and mesh assets. This load can be reduced by caching and re-using meshes, using the same mesh cache physics is using.
Mono 3.12.1
No tags attached.
related to 0007546closed nebadon llCastRay only partly implemented 
related to 0007568closed nebadon llCastRay V3 needs throttling 
related to 0007587closed nebadon llCastRay V3 suffers mesh cache race condition 
patch 0001-Use-cached-meshes-in-llCastRay-V3-dysfunctional.patch (14,787) 2015-05-16 14:07
patch 0001-Use-own-mesh-cache-in-llCastRay-V3.patch (12,770) 2015-05-18 22:56
patch 0001-Use-own-mesh-cache-in-llCastRay-V3-after-throttling.patch (14,324) 2015-05-19 11:47
Issue History
2015-05-16 14:07MagnuzNew Issue
2015-05-16 14:07MagnuzFile Added: 0001-Use-cached-meshes-in-llCastRay-V3-dysfunctional.patch
2015-05-16 14:08MagnuzNote Added: 0028385
2015-05-16 14:08MagnuzStatusnew => patch included
2015-05-16 14:09MagnuzRelationship addedrelated to 0007546
2015-05-16 14:09MagnuzRelationship addedrelated to 0007568
2015-05-18 22:56MagnuzFile Added: 0001-Use-own-mesh-cache-in-llCastRay-V3.patch
2015-05-18 22:58MagnuzNote Added: 0028399
2015-05-19 10:53MagnuzFile Added: 0001-Use-own-mesh-cache-in-llCastRay-V3-after-throttling.patch
2015-05-19 10:58MagnuzNote Added: 0028401
2015-05-19 11:47MagnuzFile Deleted: 0001-Use-own-mesh-cache-in-llCastRay-V3-after-throttling.patch
2015-05-19 11:47MagnuzFile Added: 0001-Use-own-mesh-cache-in-llCastRay-V3-after-throttling.patch
2015-05-21 22:49nebadonNote Added: 0028422
2015-05-21 22:49nebadonStatuspatch included => resolved
2015-05-21 22:49nebadonResolutionopen => fixed
2015-05-21 22:49nebadonAssigned To => nebadon
2015-05-22 14:34MagnuzNote Added: 0028435
2015-05-22 14:34MagnuzStatusresolved => closed
2015-05-22 14:34MagnuzFixed in Version => master (dev code)
2015-05-23 05:20MagnuzRelationship addedrelated to 0007587

2015-05-16 14:08   
DON'T APPLY THIS DYSFUNCTIONAL PATCH 0001-Use-cached-meshes-in-llCastRay-V3-dysfunctional.patch

Patch attempting to use cached meshes in llCastRay V3. Thanks to dahlia making the physics mesh cache available for this.

The first time a new shape, sculpt or mesh is encountered, the overhead of processing and caching it is 40-50% higher than without caching, on both a high-end server and an ordinary laptop in my performance tests. However, on renewed encounters, the caching saves about 55-60% call time on a high-end server and 60-70% on an ordinary laptop.

This first, dysfunctional version do prims right, but appears to get corrupt data when trying to mesh sculpts and meshes from assets. The error is probably at line 14176:
shape.SculptData = World.AssetService.GetData(shape.SculptTexture.ToString());
I'm lost at how to load and use the assets in a correct way though, so any suggestions are welcome. The other possibility is a bug in the mesher used, but I can't find anything obvious in the code so I find that less likely.
2015-05-18 22:58   
The new patch 0001-Use-own-mesh-cache-in-llCastRay-V3.patch is fully functional. It sets up an own mesh cache optimized for llCastRay V3 and uses libopenmetaverse mesher instead of Meshmerizer. It works fully with sculpts and meshes again, eliminates the 40-50% overhead on first encounter with a shape, sculpt or mesh, increases the time save when using cached geometries to about 65% on a high-end server and 75% on an ordinary laptop in my performance tests.

Since the physics mesh cache isn't populated by BulletSim and llCastRay V3 stores and uses geometries without scaling and rotation, it's really not much use to use the un-optimized physics mesh cache in particular for llCastRay V3.

This patch also includes a minor fix where calculation errors sometimes made hits fall outside triangle bounding boxes and be discarded, especially when triangle planes are parallel with the local XY, XZ or YZ plane. To deal with this, error tolerances were increased by a factor of 10. (Old tolerance 0.000001, actual calculation error 0.000003-0.000004, new tolerance 0.00001.)
2015-05-19 10:58   
The patch 0001-Use-own-mesh-cache-in-llCastRay-V3.patch won't apply after the patch 0001-Throttle-llCastRay-V3.patch from Mantis 7568.

The new patch 0001-Use-own-mesh-cache-in-llCastRay-V3-after-throttling.patch will apply after the patch 0001-Throttle-llCastRay-V3.patch from Mantis 7568. It also makes the caching optional by configuration, since the caching increases memory usage, which may be undesirable in some situations.
2015-05-21 22:49   
patch applied : [^]
2015-05-22 14:34   
Verified code and function, so closing.