Morph Target flicker default target on visibility toggle

Hi!

Using 4.4 binary, win 8.1.

I’ve made a small script to blend a skeletal mesh to wanted morph target. Then when that’s done, I set visibility of the skeletal mesh hidden and back to visible. Most of the time when skeletal mesh comes back to being visible, for a frame or two it shows the “default” morph target before showing the blended target. It forgets the target for frame or two.

I’ve attached a project to show this problem. Just hit play and watch the skeletal mesh toggle between visible and hidden - it should be visible on couple of frames, if not just stop and start play again.

I’m trying to use this method as optimization, first blend with more complex mesh and when the target is reached, replace the skeletal mesh with simple static mesh. Then if the object is blended again, replace the static back to skeletal mesh for the blending and when it’s done replace the skeletal mesh back to corresponding static mesh. Unfortunately this bug prevents using this method as it bring annoying artefacts on screen due the flicker of the “default” morph target.

Sorry for using rar inside the zip, but the 524kb limit just could not hold the project inside zip. So unpack zip and inside the rar to get the project (would it be better to raise the limit for 1MB or so?).

This is still and issue with 4.5

Hello Santtu,

What you are attempting to do is exactly what your project is achieving. By telling your object to consistently switch back and forth between the consistent static mesh and attempting toggle its visibility you will definitely get a flickering. This is not a bug, but just a logical error. I do understand that you are attempting to optimize, but with something this simple you are actually making it a bit more difficult than it needs to be.

If you are attempting to have a smooth transition between your static mesh and the morph target you need to establish a timeline with a SIN wave. I actually have a great reference to a question very similar to yours. In your case the only thing you would need to change would be your length of time of your Timeline to 4.0 seconds. Here are a few images of your own project to help you get started. This smoothly transitions between your morph and the static mesh.

Related Question:

Blueprint Timeline SetUp

Timeline SIN Wave SetUp

I hope this gets you on the right track!
Thank you,

Hi Andrew!

No this is not what I meant, the included project is - rather stupid - example how to make the bug appear. I need to clarify a bit.

I make one assumption of ue : if I set morph target to some ratio and after I toggle visibility of the skeletal mesh, it remembers the ratio set before when it comes back to being visible.

Now the scenario :

  1. Set the morph target via timeline to blend it smoothly
  2. When done, switch the skeletal mesh to corresponding static mesh for performance. Done by hiding the skeletal mesh, and showing the static mesh via set visibility.
  3. New target is received, switch back to the skeletal mesh and begin morphing to a new target. Done by hiding the static mesh and making the skeletal mesh appear with set visibility. Continue at 2.

Now the problem comes with the part 3. When making the skeletal mesh become visible again, for a brief moment (frame or two) it shows the ORIGINAL skeletal mesh before “remembering” where it left off. This does not happen always only some times, it’s like vertex buffers are in wrong state when toggling visibility.

It is really easy to reproduce:

  1. Make a skeletal mesh that is for example a cube and that has one morph target which is a sphere.
  2. At game start set that morph target of that skeletal mesh to full showing the sphere.
  3. Make a timer or similar that just toggles between visible and hidden.

Now between the toggles You can see the mesh “flicker” the cube shape for couple of frames before showing the sphere shape what it should show. And note it does not always happen, only some times.

I don’t know if its my hardware or my model but i can easily produce this is in less complex scenarios than our game. Im fairly condifent we have the logic right as sometimes it does not flicker and works perfectly.

I can record a video or make a new project that shows this.

This is causing our game to show the annoying “flicker” to a point we needed to remove this.

And just to add, I have tried setting the morph target again after toggling the visibility, marking all render states dirty etc. Nothing seems to help.

Hey again Santtu S,

So before I give my response Static Meshes will be able to have morph targets applied to them in the upcoming version of the engine 4.6.

With that in mind I went back into your project and you seemed to have some logic errors as mentioned before. What was going on was that your Timeline’s values were not returning back to its original state (value = 0.0).

In other words you were morphing the target, keeping the target morphed. Toggling its visibility off and returning back to the static mesh. To successfully achieve what you were attempting to do, follow the steps provided and use the images as reference.

Steps to follow:

  1. So delete all the things that don’t resemble the image above.

  2. Now create a new static mesh using the editor cube for your blueprint in the components section.

  3. Scale the static mesh uniformly to 0.4

  4. Uncheck the box that says Visible for the Skeletal Mesh within the components tab.

  5. Set the Static Mesh and the Skeletal Mesh within the Scene Root component.

  1. Be sure both objects are using the same material.

  2. Now use the image of the EventGraph as a guideline to set up your morph target.

  3. Go into your Timeline and create a SIN wave that goes from 0 to 1 and back to 0 again.

This now has the basic functionality you are looking for, but I would like to reiterate the original answer I posted is a much simpler and more optimized way of getting the same visual result. And with the update coming for 4.6 you will not have need to switch between static and skeletal meshes. Hope this helps!

Thanks again,

Hi Andrew!

Sorry to bother You again :slight_smile:

Let’s forget what I’m trying to do for awhile, I’ve attached a project that has minimal things in order to make this bug appear. The mesh included has morph target “Triangle” which is triangle and the basis shape is a cube.

Now there is an actor CubeToTriangleActor which :

  1. Begin play sets morph target “Triangle” to 1.0, show it only shows a triangle shape.
  2. On tick, it toggles the visibility of the SkeletalMeshComponent on every odd/even second.

Now if You press play and watch closely, when the mesh comes back to visible it randomly shows couple of frames as a cube. I presume it remembers that the morph target “Triangle” is set to 1.0. It should only show the triangle shape pop in and out of visibility. There is some bug (at least on my hw) that it flickers the ORIGINAL shape of the skeletal mesh without ANY morph targets applied. THIS is the bug.

I’m pretty sure that the 4.6 static mesh morph targets will be enough for optimization, but the basis why we did this, is that the target meshes has significantly lower poly count than the morphing version of the mesh. We could apply this optimization with the new static meshes as well - this is why I’m so persistant :wink:

We actually appreciate the persistence so we can better increase the quality of our users experience. I will make a not of this to the developers, but since the Static Meshes will be able to morph in upcoming 4.6 your issue will dissolve.

Thank you! But im sure someone else will have problem with skeletal meshes and morph targets if they need to make them invisible or so. Thinking of character customization screen where you can choose the head model and tinker with face aspects via morph targets.

I was thinking of trying to fix it myself but the hardest part to grasp of the UE source is the rendering.

Anyhow, thanks for quality service as always.

Yeah, I can see where this function would come into play! And no problem, we are always here to help! We appreciate your thanks as well.

Andrew

Yes, this problem has come up in my project. I have animated skeletal mesh with morph that has to be hidden by user, but when it is unhidden morph is in default state for a frame and it is very noticeable. Has this bug been addressed or is there any workaround?
Biiskaps