unity3d-jp / AnimeToolbox

398 stars 18 forks source link

When changing the resolution of Visual Compositor, fps will be very slow in Play mode. #31

Closed ShiinaRinne closed 9 months ago

ShiinaRinne commented 10 months ago

Describe the bug I want to change the size of the final output graphics (usually achieved by adjusting the Camera's Viewport Rect), and in AnimeToolBox, I assume this is done using the Resolution setting in the Visual Compositor.

However, when I try to change the Visual Compositor's resolution from 1920x1080 to 1920x864, the entire Unity Editor becomes very sluggish, and the rendering time per frame goes up to several hundred milliseconds. It returns to normal when I revert to 1080. ~This issue only occurs in Play mode.~ The issue occurs intermittently in Editor mode, with occasional slowdowns, but in Play mode, it almost consistently maintains this state.

I've looked at the Profiler, and it seems that the longest time is spent in a method called Semaphore.WaitForSignal, but I can't find where it's being called. I've also tried searching in forums and other places but couldn't find a viable solution. Although I suspect it may be because the Camera in RenderNode is different from the Visual Compositor, but I'm sorry that I can't seem to find a stable way to reproduce it

What could be causing this issue, and is there a way to fix it? I have included a screen recording of the bug and the exported Profiler file in the attachments. Hope to get your help~

To Reproduce Steps to reproduce the behavior:

  1. Change Visual Compositor's resolution
  2. See error
  3. Undo changes
  4. Errors will not occur

Expected behavior Just like in Editor mode, the rendering time per frame is only a few tens of milliseconds.

Desktop (please complete the following information):

Unity (please complete the following information):

Additional context https://drive.google.com/file/d/1YGZbeY2vlcX0OBqvYzRLtXMSZ0DsZ0MO/view?usp=drive_link

sindharta commented 10 months ago

Hi @ShiinaRinne Thank you for your report.

I have never seen this slowdown caused by a change in resolution before. I have looked at your movie files and profiler data. From the profiler, it seems NiloToon is performing badly when combined with VisualCompositor, so I am wondering what happens if you turn NiloToon off, or maybe there are some NiloToon settings that you can tweak ? Other than this, unfortunately, I would need to take a look at your project to itself to find out more about this issue.

Would it be possible for you to send your project to me at sindharta.tanuwijaya@unity3d.com ? I understand that your project may contain IP characters, and therefore if sending your project is not possible, could you please make a new simple project that can repro this issue and share it here ?

sindharta-tanuwijaya commented 9 months ago

I believe we have resolved this issue privately. Please feel free to reopen this issue /DM me if you have another question, or create another issue if you have one.

And thank you for using AnimeToolbox. We look forward to seeing your creations !

ColinLeung-NiloCat commented 6 months ago

if there is anything we can do/fix from the NiloToon's side, feel free to contact nilotoon@gmail.com, we can provide a fix in NiloToon's source code once we know what the problem is(how to reproduce).

sindharta-tanuwijaya commented 6 months ago

@ColinLeung-NiloCat Regarding this issue, our team found that opening the VisualCompositor window and clicking on the VisualCompositor gameobject could potentially improve the performance, although unfortunately we couldn't explain why.

For NiloToon, our team also found that it allocated quite some memory per frame, which may contribute to occasional memory hiccups. You can confirm this using the Profiler.