Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to improve the performance of Variable Mix Shapes
#7
This matter has been resolved.
I have made changes to the code on the Curvy Splines side and also to be able to control it from my code.

Add the following properties to the CGDataRequestShapeRasterization.

Code:
public static bool IsChangeShape = true;

Add the following at the beginning of Equals() and GetHashCode() in the same class, respectively

Code:
if (!IsChangeShape)
    return base.Equals(obj);
Code:
if (!IsChangeShape)
    return base.GetHashCode();

The above is the code on the Curvy Splines side.
In my code, I do the following processing before Refresh() of Generator and set IsChangeShape to true only when TCB or positions is changed.

Code:
bool isAnyChangePosition = false;
for (int cpIdx = 0; cpIdx < shapeCpCount; cpIdx++)
{
    Vector3 aPos = s_splineShapeACpPositionBufferList[cpIdx];
    Vector3 bPos = s_splineShapeBCpPositionBufferList[cpIdx];

    if (!isAnyChangePosition)
        isAnyChangePosition = aPos != bPos;
}

CGDataRequestShapeRasterization.IsChangeShape =
    s_splineShapeA.Tension != s_splineShapeB.Tension
    || s_splineShapeA.Continuity != s_splineShapeB.Continuity
    || s_splineShapeA.Bias != s_splineShapeB.Bias
    || isAnyChangePosition;

I understand from your response that the different shape need to be updated even though the TCB parameters and CPs locations have not been changed.
Maybe this hack will generate a mesh with a shape that is not strictly correct.

However, in my case this was sufficient.
This technique may only work in my case, but I leave it here as reference information.

I could not have reached this point without your precise answer.
Thank you very much!
Reply


Messages In This Thread
RE: I want to improve the performance of Variable Mix Shapes - by yanke - 07-27-2023, 11:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Shapes points orientation itsGama 3 9 01-18-2023, 02:51 PM
Last Post: _Aka_
  Input Spline Shapes from Prefabs destroys graph tairoark 5 7 11-24-2022, 05:08 PM
Last Post: _Aka_
Thumbs Up variable width and branching from main track for racing AdAstra 4 17 08-09-2022, 12:08 PM
Last Post: _Aka_
  Upgrading Unity causes significant performance degradation yanke 3 7 05-23-2022, 03:40 PM
Last Post: _Aka_

Forum Jump: