Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to improve the performance of Variable Mix Shapes
#1
Hello.
I have always used your wonderful assets.

I am using Curvy Generator to generate the following mesh.

[Image: light.dotup.org59848.png]
[Image: light.dotup.org59847.png]

I am dynamically changing the parameters related to this mesh with a script I created, and I Refresh() the Generator to reflect the changes in the Curvy Splines.

Code:
public static void RefreshPathAndShape()
{
    // Step.1: Change the position of the CPs on the path
    ReadOnlyCollection<CurvySplineSegment> cpList = s_splinePath.ControlPointsList;
    int cpCount = cpList.Count;
    for (int i = 0; i < cpCount; i++)
    {
        cpList[i].SetLocalPosition(s_positionBuffer[i]);
    }

    // Step.2: Change the position of CPs on the shape (in A and B)
    ReadOnlyCollection<CurvySplineSegment> aCpList = s_splineShapeA.ControlPointsList;
    ReadOnlyCollection<CurvySplineSegment> bCpList =  s_splineShapeB.ControlPointsList;
    for (int i = 0; i < s_splineShapeACpPositionBufferList.Length; i++)
    {
        aCpList[i].SetLocalPosition(s_splineShapeACpPositionBufferList[i]);
        bCpList[i].SetLocalPosition(s_splineShapeBCpPositionBufferList[i]);
    }

    // Step.3: Change TCB (in A and B)
    s_splineShapeA.Tension = s_aTension;
    s_splineShapeA.Continuity = s_aContinuity;
    s_splineShapeA.Bias = s_aBias;
    s_splineShapeB.Tension = s_bTension;
    s_splineShapeB.Continuity = s_bContinuity;
    s_splineShapeB.Bias = s_bBias;

    // Step.4: Update Generator (Manual)
    s_generator.Refresh();
}

The reason for separating Shape A and Shape B is because Variable Mix Shapes are used.
[Image: light.dotup.org59849.png]

And now, we were doing performance testing and observed an event where the frame rate dropped when the CPs position was changed by processing Step.1.
We used Deep Profiling to check and found that the BuildShapeExtrusion class was the cause of the slowdown.

   
   

I was wondering about the second image, the load caused by ModifierVariableMixShapes.
Indeed, I am using Variable Mix Shapes.
But at this time, I did not change the parameters in Step.2 and Step.3 (they have not changed from the previous values) and the CP positions and TCB values for Shape A and Shape B were exactly the same.
If we comment out the process in Step.2 and Step.3, we still have this load as well.

I feel that if Shape A and Shape B in Variable Mix Shapes have the same parameters, there is no need to run ModifierVariableMixShapes.OnSlotDataRequest().
Hopefully, I can try to improve the frame rate by not executing this.

In transitioning from the first to the second image result, I am unclear as to how this came to be done and would like to investigate more deeply or improve it.
Do you have any suggestions?
Reply


Messages In This Thread
I want to improve the performance of Variable Mix Shapes - by yanke - 07-24-2023, 02:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Shapes points orientation itsGama 3 8 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: