msub2 / silk-brush-2021

An effort to port Tilt Brush to WebXR.
Apache License 2.0
47 stars 5 forks source link

Particle/Visualizer brushes erroring and tanking performance #9

Closed msub2 closed 3 years ago

msub2 commented 3 years ago

The following brushes basically make the program unusable once they're active:

Need to look into them and see if I can track down the issue

msub2 commented 3 years ago

Stacktrace from trying to use Embers brush:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00000] in <00000000000000000000000000000000>:0 
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Collections.Generic.List`1[T].set_Item (System.Int32 index, T value) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.GeometryBrush.SetVert (System.Int32 iVert, System.Int32 vp, UnityEngine.Vector3 v, UnityEngine.Vector3 n, UnityEngine.Color32 c, System.Single alpha) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.GeniusParticlesBrush.CreateParticleGeometry (System.Int32 knotIndex, System.Int32 particleIndex, UnityEngine.Vector3 pos, System.Single size) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.GeniusParticlesBrush.ControlPointsChanged (System.Int32 firstKnotIndex) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.GeometryBrush.ApplyChangesToVisuals () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.PointerScript.UpdatePointer () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.PointerManager.Update () [0x00000] in <00000000000000000000000000000000>:0 
msub2 commented 3 years ago

After clamping values

227b53e3-c9d1-4994-9360-2a97935994dc:4182 Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 196608, VertexCount: 65536
UnityEngine.Mesh:SetIndicesImpl(Int32, MeshTopology, IndexFormat, Array, Int32, Int32, Boolean, Int32)
UnityEngine.Mesh:SetTrianglesImpl(Int32, IndexFormat, Array, Int32, Int32, Int32, Boolean, Int32)
UnityEngine.Mesh:SetTriangles(List`1, Int32, Int32, Int32, Boolean, Int32)
UnityEngine.Mesh:SetTriangles(List`1, Int32, Boolean, Int32)
UnityEngine.Mesh:SetTriangles(List`1, Int32)
TiltBrush.GeometryPool:CopyToMesh(Mesh)
TiltBrush.GeometryBrush:ApplyChangesToVisuals()
TiltBrush.PointerScript:UpdatePointer()
TiltBrush.PointerManager:Update()

[./Runtime/Graphics/Mesh/Mesh.cpp line 1372] 
(Filename: ./Runtime/Graphics/Mesh/Mesh.cpp Line: 1372)
msub2 commented 3 years ago

Oh my god. Apparently making the change to SetValue in ListExtensions wasn't necessary, and was in fact the reason why I've been getting all these vert/index errors. Switched back to the original code and particle brushes seem to work fine now. Will test all of them after work

msub2 commented 3 years ago

All working