Paradachshund

Hello, I've been starting to integrate the UE4 runtime into my project, and I have been experiencing some noticeable lag in the editor window when I have objects in my level using the Spine blueprint components.

I get the lag regardless of what else is in the level. I can create an empty level, place a blank Actor blueprint that only has a SpineSkeletonAnimation and a SpineSkeletalRenderer component (with atlas, data, and texture loaded to be clear), and it will begin to lag as soon as the object is placed in the viewport.

On the opposite end, I can load a complex, polished level full of native UE4 objects and have no lag, only for the lag to immediately show up as soon as a single blueprint containing the Spine components is added to the level.

I'm not really sure how to debug this further than what I have described. I'm hoping that someone here may have some insight, or that this may be a known issue that will be resolved in the future. It's really stifling my ability to use the plugin and I need to figure out a solution.

Thanks a lot.
Paradachshund
  • Posts: 5

badlogic

What version of UE4 are you using? What's your machine spec (probably good as you can easily load a complex map)? What version of the Spine UE4 runtime are you using?
User avatar
badlogic

Mario
  • Posts: 1848

Paradachshund

Hey, sorry for the extremely late follow up!

I am using Unreal 4.18.3 and the Spine plugin is version 1.0

As for my computer, I'm running 64bit Windows 10 with 12gb RAM. Intel Core i7-5700HQ (Quad Core). Nvidia GeForce GTX 960M.

Let me know if you're curious about any other hardware on there. As you said, it's good enough to run a complicated level smoothly, and immediately slows to a crawl the moment I place a Spine object.

Thanks for the reply!
Paradachshund
  • Posts: 5

badlogic

I've tried to reproduce this with my 2 Windows machines when you reported it, but didn't see the effect. Could you try this.

1. Open SpineSkeletonRendererComponent.cpp
2. Modify this line so that the last argument is false spine-runtimes/SpineSkeletonRendererComponent.cpp at 3.6
3. Observe if the lag is gone
User avatar
badlogic

Mario
  • Posts: 1848

Paradachshund

Gave that a shot, but the lag is still there, true or false. I also tried turning off Realtime in the editor view, but that also didn't have any effect.

Thanks
Paradachshund
  • Posts: 5

badlogic

Hrm, I'm out of ideas how to reproduce this on my end. Do you see the lag with the example skeletons we ship, e.g. SpineBoy? Does the lag occur when you run the sample UE4 project that ships with the runtime?
User avatar
badlogic

Mario
  • Posts: 1848

Paradachshund

OK, so the lag still happens in all of those cases. I loaded the test project and it does happen. I even made a new blank map in the test project and dragged the Coin blueprint into the empty scene, which produces the lag immediately.

I exported spine boy and imported the files into my main project. I created a new Actor Blueprint, added Spine Animation and Spine Skeleton Render, keeping the default materials and linking to the spine boy atlas and skel data. Once this object is dragged into a non-laggy level, the level immediately begins to lag.

These are my export settings for spine boy:
Capture.PNG

Capture2.PNG

One question came up while doing all this. I noticed a note in the runtime documentation mentioning that the runtime doesn't currently support textures with Premultipled Alpha. I'm pretty sure all of my textures had this checked to on when exporting. I tried the above spine boy test both with and without premultipled alpha on, and noticed no difference. Is that limitation still true? It seems to work (and also lag) both ways.

Are there any performance tools I could run to try to identify what is causing the lag? I'm not familiar with what's available in Unreal. I did try running "stat SceneRendering", but didn't notice any obvious increases to any of the stats shown. The lag spikes do show up in that profiler in the overall time calculation, but none of the individual stats spike up at the same time that I could see.

Thanks for your time.

---

Update: The issue seems to be resolved! What I know below...

I was able to get the profiler running, which gave me some more specific information. The lag was coming from the collision portion of the SpineSkeletonRenderer. It uses the biggest share of performance by a mile within that class (99.2%, compared to 0.2% for the next highest thing).

My project doesn't use this spine collision currently, so I was able to turn it off in the plugin and the issue went away. I actually ended up changing the "true" to a "false" on that same createmeshsection fuction, but I did it in PrivateSpineSkeletonRendererComponent.cpp rather than SpineSkeletonRendererComponent.cpp

I partly got to this point from this old thread: [UE4] Performance problem, example project, current branch

That guy's issue sounds exactly like what I saw. It seems like that function is quite the performance hog for some systems.
You do not have the required permissions to view the files attached to this post.
Paradachshund
  • Posts: 5

badlogic

Glad it got resolved! Where does PrivateSpineSkeletonRendererComponent.cpp come from? Above i talked about disabling collision in SkeletonRendererComponent.cpp. I add your post to the issue for further info, thanks for reporting!
User avatar
badlogic

Mario
  • Posts: 1848

Paradachshund

Actually, that isn't quite right what I said. It actually was SpineSkeletonRendererComponent.cpp, it's just in the Private folder. Sorry for the confusion! This is the path where the file was: SpinePlugin\Source\SpinePlugin\Private

I'm not sure why the solution worked this time and not the first.
Paradachshund
  • Posts: 5

badlogic

Probably the rebuild after the single line change didn't work. Thanks for reporting and giving me additional data points to investigate this issue!
User avatar
badlogic

Mario
  • Posts: 1848

scardario

badlogic wrote:Hrm, I'm out of ideas how to reproduce this on my end. Do you see the lag with the example skeletons we ship, e.g. SpineBoy? Does the lag occur when you run the sample UE4 project that ships with the runtime?
Hi!

I'm getting the same problem, I changed the line in SpineSkeletonRendererComponent.cpp from true to false, compiled from the editor and I'm still having a performance hit

I'm running UE4.18.3 on Windows10 64b, 8 GB, Nvidia GTX 1060 3GB.

How do I make sure I compiled the files correctly? this compiling thing on UE4/VS is new to me, so it's a bit daunting, I'm not sure which batch builder configuration should I use.

The Sample project is also affected by the performance issue (all GettingStarted maps), tried the true-false thing on CreateMeshSection function and compiled from the editor but the results are still the same.
scardario
  • Posts: 79

badlogic

You can ensure the code is completely recompiled by closing any running UE4 instance, then in VS, right click the solution in the solution explorer, then click "Clean build". You can then trigger another build as usual.
User avatar
badlogic

Mario
  • Posts: 1848

scardario

It worked! The lag is gone!

Thank you, now it works smoothly.
scardario
  • Posts: 79

Cavi

I'm here to approve this issue. After disabling every logic/tick (and the project is almost empty) I did so far, the only thing taking up performance was the SpineSkeletonRendererComponent itself. But I'm not talking about one character (that worked fine), but 6 and more. I'm not needing hundreds, but 10 is inevitable :D

After changing the parameter to false it worked fine.

Using UE 4.18.3 and spine runtime is from around the 16/17th may.
Cavi
  • Posts: 8

badlogic

The parameter is set to "false" by default now.
User avatar
badlogic

Mario
  • Posts: 1848


Return to Runtimes