Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Trouble with local sim ObiSolver as child of interpolated Rigidbody
#1
Pregunta 
Hi,

As the title says, I'm attemping to use a 'locally-simulated' ObiSolver parented to a Rigidbody with it's interpolation set to 'Interpolate'.

Despite smooth Rigidbody motion, the various ObiCloth's (which are children of the ObiSolver), begin to jump / stutter sporadically as the Rigidbody picks up even a small amount of speed.

In my scene, the camera Lerps towards the RB. And the motion of the RB appears smooth both in Game and Scene view. But the motion of the various ObiCloth objects remains 'stuttery' in both views.

When interopolation of the RB is set to 'none', everything is smooth! Or at least when it stutters, it stutters in tandem with the parent RB. (However I still need interoplation for other reasons, so unfortuantely this is not a fix).

What I've tried:
Enabling interoploation on the ObiSolver itself actually appears to make the problem slightly *worse*.

I tried moving the ObiSolver directly onto the RB, rather than as a child. Unfortunately this made no difference.

Changing simulation order to 'LateUpdate' makes a big difference, although with still a tiny amount of stuttering. However, ideally I'd use FixedUpdate. -- As the documentation describes, LateUpdate is great for scenes which update object transform's outside of the physics loop. However, this is not the case for me, everything is driven via physics & FixedUpdate. Which is why I'm a little puzzled...

I'm using ObiCloth 3.5 with unity 2018.2.5f1.

My ObiSolver looks like so:
[Image: 600VuBG.png]

Any help on this would be greatly apprecaited.

Thanks in advance.

- Just to add, I've been super happy with ObiCloth 3.5, the enhancements to local solvers have benefited my project *greatly*, and makes Obi that little bit more flexible. Hats off and thanks!
Reply
#2
(26-08-2018, 08:49 PM)jabza Wrote: Hi,

As the title says, I'm attemping to use a 'locally-simulated' ObiSolver parented to a Rigidbody with it's interpolation set to 'Interpolate'.

Despite smooth Rigidbody motion, the various ObiCloth's (which are children of the ObiSolver), begin to jump / stutter sporadically as the Rigidbody picks up even a small amount of speed.

In my scene, the camera Lerps towards the RB. And the motion of the RB appears smooth both in Game and Scene view. But the motion of the various ObiCloth objects remains 'stuttery' in both views.

When interopolation of the RB is set to 'none', everything is smooth! Or at least when it stutters, it stutters in tandem with the parent RB. (However I still need interoplation for other reasons, so unfortuantely this is not a fix).

What I've tried:
Enabling interoploation on the ObiSolver itself actually appears to make the problem slightly *worse*.

I tried moving the ObiSolver directly onto the RB, rather than as a child. Unfortunately this made no difference.

Changing simulation order to 'LateUpdate' makes a big difference, although with still a tiny amount of stuttering. However, ideally I'd use FixedUpdate. -- As the documentation describes, LateUpdate is great for scenes which update object transform's outside of the physics loop. However, this is not the case for me, everything is driven via physics & FixedUpdate. Which is why I'm a little puzzled...

I'm using ObiCloth 3.5 with unity 2018.2.5f1.

My ObiSolver looks like so:
[Image: 600VuBG.png]

Any help on this would be greatly apprecaited.

Thanks in advance.

- Just to add, I've been super happy with ObiCloth 3.5, the enhancements to local solvers have benefited my project *greatly*, and makes Obi that little bit more flexible. Hats off and thanks!

Hi there,

It is just not possible to do what you want.

When you parent the simulation to any transform (it does not matter if it's the RB or any of its children, the way it works is the same), it means the simulation will be performed in whatever space is defined by that transform. Now, in your case the simulation space is itself the result of the simulation.

Now consider what interpolation is, and why it is used in the first place:

- Physics engines consume time in equally sized "chunks".
- Rendering however can happen anytime, so with no interpolation we would see physics in a stop-motion fashion.
- If you want simulated objects to move smoothly every frame, you need to take the simulation results from the latest two physics steps and interpolate them right before rendering.

As you can see, the issue is that interpolation is not performed during the simulation but after it has taken place, right before rendering. By then Obi has already performed simulation using the non-interpolated rigidbody transforms. This is a cyclic dependency: the simulation would need its own result as input.

The closest you can get is by using the LateUpdate solver simulation order. This allows Obi to simulate after Unity's rigodbodies have performed interpolation. This unfortunately is not physically correct, as it will always slightly over or under estimate the timestep.
Reply
#3
(28-08-2018, 06:26 PM)josemendez Wrote: Hi there,

It is just not possible to do what you want.

When you parent the simulation to any transform (it does not matter if it's the RB or any of its children, the way it works is the same), it means the simulation will be performed in whatever space is defined by that transform. Now, in your case the simulation space is itself the result of the simulation.

Now consider what interpolation is, and why it is used in the first place:

- Physics engines consume time in equally sized "chunks".
- Rendering however can happen anytime, so with no interpolation we would see physics in a stop-motion fashion.
- If you want simulated objects to move smoothly every frame, you need to take the simulation results from the latest two physics steps and interpolate them right before rendering.

As you can see, the issue is that interpolation is not performed during the simulation but after it has taken place, right before rendering. By then Obi has already performed simulation using the non-interpolated rigidbody transforms. This is a cyclic dependency: the simulation would need its own result as input.

The closest you can get is by using the LateUpdate solver simulation order. This allows Obi to simulate after Unity's rigodbodies have performed interpolation. This unfortunately is not physically correct, as it will always slightly over or under estimate the timestep.

Thanks for taking the time to write a very detailed response.

Looks like I will have to get creative. One other option I suppose is decreasing the physics timestep, but of course that can only be pushed so far.

UPDATE: Turns out I can do without interpolation! I was using interpolation due to shaky shadows, but it apparently that was due to a very small near plane on my camera... doh.
Reply