Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Performance issues
#1
I'm using Obi Rope to simulate cords and wires in a VR truck service simulator. Since it was extremely unpractical and unstable to let Obi manage the rope length constraints, i decided to make all rigidbodies kinematicForParticles and use spring joints between the plugs (and dummy rigidbodies pinning the ropes together at all junctions) to keep them connected, just using ObiRope to simulate the aesthetics of the cords with pin constraints. The results are not 100% accurate, but it looks good enough for my purposes. Despite this, and despite rendering over 30 million triangles in the scene, ObiRope still stands for over 60% of the CPU load. This is despite the fact that i only use 2 solvers (one in each sub-scene), each with all constraints except pin, stitch, distance and collision disabled, and iteration counts set to 3 and below. There are maybe around 50 obi colliders in the scene. I also have a resolution of below 0.2 on all my ropes - in total, there are roughly 700 particles simulating. If i hang ropes on the wall (by attaching a fixed joint to one of the plug ends), obi will eventually even crash unity very suddenly and without warning. I have changed it so that the solvers run in LateUpdate, and reduced the advection radius to 0.05, but the performance is still utter crap. Am i doing something wrong, or does it simply not get better than this?

EDIT: Before Unity crashes, i get a huge wave of errors starting with:

Assertion failed: Assertion failed on expression: 'CompareApproximately(det, 1.0F, .005f)'
UnityEngine.Quaternion:FromToRotation(Vector3, Vector3)
Obi.CurveFrame:Transport(Vector3, Vector3, Single) (at Assets/Obi/Scripts/Actors/ObiRope.cs:61)
Obi.ObiRope:UpdateRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:962)
Obi.ObiRope:UpdateProceduralRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:892)
Obi.ObiRope:UpdateVisualRepresentation() (at Assets/Obi/Scripts/Actors/ObiRope.cs:590)
Obi.ObiRope:OnSolverFrameEnd() (at Assets/Obi/Scripts/Actors/ObiRope.cs:365)
Obi.ObiSolver:EndFrame(Single) (at Assets/Obi/Scripts/Solver/ObiSolver.cs:536)
Obi.ObiSolver:LateUpdate() (at Assets/Obi/Scripts/Solver/ObiSolver.cs:665)


Eventually i get this:

rigidbody.velocity assign attempt for 'Breakout Box' is not valid. Input velocity is { NaN, NaN, NaN }.
UnityEngine.RigidbodyConfundidoet_velocity(Vector3)
Obi.ObiRigidbody:UpdateVelocities() (at Assets/Obi/Scripts/Collisions/ObiRigidbody.cs:68)
Obi.ObiColliderBase:UpdateRigidbody(Object, EventArgs) (at Assets/Obi/Scripts/Collisions/ObiColliderBase.cs:262)
Obi.ObiArbiter:WaitForAllSolvers() (at Assets/Obi/Scripts/Solver/ObiArbiter.cs:82)
Obi.ObiSolver:SimulateStep(Single) (at Assets/Obi/Scripts/Solver/ObiSolver.cs:499)
Obi.ObiSolver:LateUpdate() (at Assets/Obi/Scripts/Solver/ObiSolver.cs:659)

Assertion failed: Assertion failed on expression: 'fRoot >= Vector3f::epsilon'
UnityEngine.Quaternion:FromToRotation(Vector3, Vector3)
Obi.CurveFrame:Transport(Vector3, Vector3, Single) (at Assets/Obi/Scripts/Actors/ObiRope.cs:61)
Obi.ObiRope:UpdateRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:962)
Obi.ObiRope:UpdateProceduralRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:892)
Obi.ObiRope:UpdateVisualRepresentation() (at Assets/Obi/Scripts/Actors/ObiRope.cs:590)
Obi.ObiRope:OnSolverFrameEnd() (at Assets/Obi/Scripts/Actors/ObiRope.cs:365)
Obi.ObiSolver:EndFrame(Single) (at Assets/Obi/Scripts/Solver/ObiSolver.cs:536)
Obi.ObiSolver:LateUpdate() (at Assets/Obi/Scripts/Solver/ObiSolver.cs:665)

And also this:

Assertion failed: Invalid worldAABB. Object is too large or too far away from the origin.

The way i interpret it, a rounding error propagates in the quaternion calculations causing forces to be scaled high enough to instantly propel objects out of the scene. It's just a qualified guess, though, and i'm not sure why forces would be applied anyway since the objects are all kinematic as far as Obi is concerned. In this particular case, the crash only occurs when the cord is hanging against the wall, but i've had it before as well in various situations (Always the AABB error).

EDIT2: Some more of the errors:

Assertion failed: Converting invalid MinMaxAABB
UnityEngine.Mesh:SetTriangles(List`1, Int32, Boolean)
Obi.ObiRope:CommitMeshData() (at Assets/Obi/Scripts/Actors/ObiRope.cs:911)
Obi.ObiRope:UpdateRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:1037)
Obi.ObiRope:UpdateProceduralRopeMesh() (at Assets/Obi/Scripts/Actors/ObiRope.cs:892)
Obi.ObiRope:UpdateVisualRepresentation() (at Assets/Obi/Scripts/Actors/ObiRope.cs:590)
Obi.ObiRope:OnSolverFrameEnd() (at Assets/Obi/Scripts/Actors/ObiRope.cs:365)
Obi.ObiSolver:EndFrame(Single) (at Assets/Obi/Scripts/Solver/ObiSolver.cs:536)
Obi.ObiSolver:LateUpdate() (at Assets/Obi/Scripts/Solver/ObiSolver.cs:665)

Mesh '': abnormal mesh bounds - most likely it has some invalid vertices (+/-inifinity or NANs) due to errors exporting.
Mesh bounds min=(-1.#J, -1.#J, -1.#J), max=(-1.#J, -1.#J, -1.#J). Please make sure the mesh is exported without any errors.

Assertion failed: Invalid worldAABB. Object is too large or too far away from the origin.

It seems to be triggered primarily by collisions between ObiColliders with an attached ObiRigidbody.
Reply


Messages In This Thread
Performance issues - by khalvr - 24-01-2018, 04:00 PM
RE: Performance issues - by josemendez - 24-01-2018, 04:09 PM
RE: Performance issues - by josemendez - 24-01-2018, 04:24 PM
RE: Performance issues - by khalvr - 24-01-2018, 06:21 PM
RE: Performance issues - by josemendez - 25-01-2018, 10:10 AM
RE: Performance issues - by khalvr - 25-01-2018, 12:42 PM
RE: Performance issues - by josemendez - 25-01-2018, 01:24 PM
RE: Performance issues - by khalvr - 25-01-2018, 02:16 PM
RE: Performance issues - by josemendez - 25-01-2018, 02:35 PM
RE: Performance issues - by khalvr - 25-01-2018, 03:11 PM
RE: Performance issues - by josemendez - 25-01-2018, 03:32 PM
RE: Performance issues - by khalvr - 25-01-2018, 05:39 PM
RE: Performance issues - by khalvr - 26-01-2018, 01:09 PM