Help Interpolation frame delay - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Help Interpolation frame delay (/thread-696.html) |
Interpolation frame delay - Sewy24 - 24-09-2018 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 RE: Interpolation frame delay - josemendez - 24-09-2018 (24-09-2018, 09:30 AM)Sewy24 Wrote: Hello, 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. RE: Interpolation frame delay - Sewy24 - 25-09-2018 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: /** RE: Interpolation frame delay - josemendez - 26-09-2018 (25-09-2018, 11:08 AM)Sewy24 Wrote: Hello Jose, 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(){ 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. RE: Interpolation frame delay - Sewy24 - 04-10-2018 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 |