Posts: 14
Threads: 2
Joined: May 2018
Reputation:
0
Hello,
as the problem is still valid, and we have no answer from your side for almost 3 months, I'm making new thread to remind and not
to abuse previous thread with different purpose.
--
we put together simple scene to demonstrate our situation (will send it to the support@virtualmethodstudio.com).
In the example, there is a Cube - to simulate the player.
We are simulating movement on simulaton rig and using our own interpolation - simple Lerping/Slerping over time (attached in the example) to apply smooth movement to the render rig because of networking.
Description of the scene:
a. Moving the simulaton rig in fixed update.
b. Own interpolation of the a. and copying the transforms to the render rig.
c. Cloth object position is copied from the simulation rig "bone" in fixed update.
d. Cloth simulation in fixed update with your interpolation.
Observation 1. We have to use skinned mesh with "fixed particles" being substitued with "skin radius" set to 0, to avoid jump-following of the "fixed paricles" - not happy with that, because we cannot use "fixed particles"
Observation 2. Your interpolation seems to be dependant on "Fixed Timestep"
- when 0.02, the interpolated cloth is working fine,
- on lower value, the interpolated cloth is few steps ahead of our interpolation
- on higher value, the interpolated cloth is s few steps behind of our interpolation
Could you please take a look on the example and recommend setting for this setup?
If you could share your interpolation script with us, we will be more able to identify the delay issue.
Thanks
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
24-09-2018, 11:13 AM
(This post was last modified: 24-09-2018, 11:38 AM by josemendez.)
(24-09-2018, 09:30 AM)Sewy24 Wrote: Hello,
as the problem is still valid, and we have no answer from your side for almost 3 months, I'm making new thread to remind and not
to abuse previous thread with different purpose.
--
we put together simple scene to demonstrate our situation (will send it to the support@virtualmethodstudio.com).
In the example, there is a Cube - to simulate the player.
We are simulating movement on simulaton rig and using our own interpolation - simple Lerping/Slerping over time (attached in the example) to apply smooth movement to the render rig because of networking.
Description of the scene:
a. Moving the simulaton rig in fixed update.
b. Own interpolation of the a. and copying the transforms to the render rig.
c. Cloth object position is copied from the simulation rig "bone" in fixed update.
d. Cloth simulation in fixed update with your interpolation.
Observation 1. We have to use skinned mesh with "fixed particles" being substitued with "skin radius" set to 0, to avoid jump-following of the "fixed paricles" - not happy with that, because we cannot use "fixed particles"
Observation 2. Your interpolation seems to be dependant on "Fixed Timestep"
- when 0.02, the interpolated cloth is working fine,
- on lower value, the interpolated cloth is few steps ahead of our interpolation
- on higher value, the interpolated cloth is s few steps behind of our interpolation
Could you please take a look on the example and recommend setting for this setup?
If you could share your interpolation script with us, we will be more able to identify the delay issue.
Thanks
Hi Jan,
Fixed particles are not interpolated, which I believe it is what led you to use skin constraints instead. There's a workaround for getting fixed particles to be affected by interpolation though: in ObiActor.cs, move all the code inside OnSolverStepBegin() to OnSolverFrameEnd() (which has an empty implementation currently).
Regarding the fixed timestep issues you mention: unlike fixing a particle, constraints do not act "instantaneously". Constraints act iteratively, bringing particle positions closer to their target position with each iteration. Higher time steps will make constraints converge more slowly (i.e., have a harder time getting particles to their target position), lower timesteps will improve convergence.
By changing the fixed timestep and using constraints, you're effectively making constraints more/less effective. It's not interpolation what is affected by the timestep, but the simulation (and skin constraints are part of it). That's why cloth is always ahead/behind the cube, unless you hit the timestep sweetspot.
Using fixed particles does not result in this issue, so I'd recommend using the workaround I described.
Posts: 14
Threads: 2
Joined: May 2018
Reputation:
0
Hello Jose,
thanks for the reply.
"Fixed particles are not interpolated, which I believe it is what led you to use skin constraints instead." this is exactly the thing.
Unfortunately moving the code with summary
Code: /**
* Transforms the position of fixed particles from local space to simulation space and feeds them
* to the solver. This is performed just before performing simulation each frame.
*/
from OnSolverStepBegin() to OnSolverFrameEnd() has no interpolation effect on the fixed particles. (Every other particle is butter smooth in both cases). - I've try to move it to other functions as well in case of typo, but not change at all.
Posts: 6,348
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
26-09-2018, 03:02 PM
(This post was last modified: 26-09-2018, 03:03 PM by josemendez.)
(25-09-2018, 11:08 AM)Sewy24 Wrote: Hello Jose,
thanks for the reply.
"Fixed particles are not interpolated, which I believe it is what led you to use skin constraints instead." this is exactly the thing.
Unfortunately moving the code with summary
Code: /**
* Transforms the position of fixed particles from local space to simulation space and feeds them
* to the solver. This is performed just before performing simulation each frame.
*/
from OnSolverStepBegin() to OnSolverFrameEnd() has no interpolation effect on the fixed particles. (Every other particle is butter smooth in both cases). - I've try to move it to other functions as well in case of typo, but not change at all.
My bad, there's another important difference that affects the fixed particle behaviour when paired with skinned meshes. In ObiSolver.cs, SimulateStep() method, you'll see a call to Oni.UpdateSkeletalAnimation();. Move this call to the solvers Update() method, right after the loop calling actor.OnSolverFrameBegin();. Would look like this:
Code: void Update(){
if (!Application.isPlaying)
return;
if (OnFrameBegin != null)
OnFrameBegin(this,null);
foreach(ObiActor actor in actors)
actor.OnSolverFrameBegin();
// Update Oni skeletal mesh skinning after updating animators:
Oni.UpdateSkeletalAnimation(oniSolver);
if (IsUpdating && simulationOrder != SimulationOrder.LateUpdate){
AccumulateSimulationTime(Time.deltaTime);
}
}
This will ensure that the actual skinned mesh is updated every frame, not only during physics steps.
Also note that for this to work, the transform that the cloth is attached to (Cube_simul) must be translated in Update(), not in LateUpdate() (there would be a 1-frame delay) or FixedUpdate() (fixed particles would not be interpolated) as you're currently doing.
Posts: 14
Threads: 2
Joined: May 2018
Reputation:
0
Hi Jose,
still no effect on fixed particles, not sure if understood correctly. If you are able to reproduce it, could you please send me the scene?
Would appreciate it a lot.
Thank you,
Jan
|