keenanwoodall / Deform

A fully-featured deformer system for Unity that lets you stack effects to animate models in real-time
MIT License
3.3k stars 226 forks source link

Ocean breaking wave using Twirl defromer [Help wanted] #22

Open oct-test opened 5 years ago

oct-test commented 5 years ago

I am trying to create a breaking wave using the Twirl deformer.

Below is the current output using the Twirl deformer:

Deform plugin

Required output:

Required output

Below are the differences between the current and the required output:

  1. Smooth blending with the ocean surface
  2. No depression below the crest

I am looking for suggestions or thoughts which can help in achieving the required output. Thank you.

keenanwoodall commented 5 years ago

I'm not sure exactly how to do it. One approach I've seen is to rotate vertices around a bezier spline. During development I had splines working with Deform, but had to remove it since the spline solution I was using didn't work well in worldspace. I can't guarantee when/if it's going to happen, but I would like to integrate a spline solution again which could help. If you want to look at the old implementation, here's the commit where I removed the spline solution and path deformer.

oct-test commented 5 years ago

Thank you for your reply @keenanwoodall. I tried implementing the approach where the mesh vertices are rotated around a bezier spline. With this approach, I was having smooth blending with the ocean surface but the depression below the crest was still present. See the picture below:

Screenshot 2019-10-21 at 9 50 08 AM

I think that rotating vertices around a shape/point will always create a depression below the crest. Probably I need to add a second pass on the mesh vertices which can convert the depression to a smooth surface. Do you have any thoughts/suggestions about the logic for the second pass?

keenanwoodall commented 5 years ago

I'm not sure the best way. You could try masking the effect, but from what I've observed when going to the beach - the water surrounding a swelling wave does tend to get shallower, so I'd think the depression is a desired effect.

oct-test commented 5 years ago

Thank you for your suggestions. I talked with my art team and they are not convinced that the depression below the crest is natural. Regarding the masking effect, I thought about it and it could work if I have to render a static frame of a breaking wave but I have to show complete animation of breaking waves.

keenanwoodall commented 5 years ago

Assuming the use of a deformer that rotates vertices around a curve, you could store the unrotated point to compare it to the rotated one. Then just clamp the height of the rotated vertice above the height of the original to prevent depression. That might be a good place to start but I couldn't say without testing. I hope you figure it out, animating a wave is a great challenge. Feel free to keep me posted on any progress!