unity3d-jp / StreamingImageSequence

A package for playing sequential image sequences in Unity Timeline
Other
282 stars 39 forks source link

Max Memory Setting seems to be ignored #468

Closed djuniah closed 1 year ago

djuniah commented 1 year ago

I've been trying to use streamingimagesequence to play back a PNG sequence (at 4k res) which I had exported from Adobe Premiere. I have tried to put the files in streaming assets, outside of the project, and in the assets folder. Each time, the RAM usage keeps climbing as my timeline goes on until i eventually run out of memory. The system has 48GB of RAM total and has more than 50% free when starting a render (a timeline with the image sequence and a unity recorder). I tried setting the streaming image sequence memory preference as low as it would go, but it doesn't seem to affect the memory usage at all. This was in Unity 2022.2.0b8.

EDIT: I also wanted to note that placing the image sequence outside of the assets folder causes unity to crash each time.

sindharta commented 1 year ago

Thank you for the report. May I know:

  1. The version of StreamingImageSequence that you use
  2. Your platform (Windows 10, etc ) ?

Also, would it be possible for you to attach a sample project for reproducing ?

djuniah commented 1 year ago

Hello,

1) It was the latest (0.16.0-preview) 2) Windows 11

My sample contains some licensed recordings that I can't really post publicly. I'll describe the setup as best I can here: 1) HDRP Scene with a somewhat basic indoor 3D environment. Path tracing is enabled (although turning it off didn't seem to affect this issue). 2) Camera has a director attached with a timeline 3) Timeline has 3 tracks. An animator which moves the camera, a recorder which is set to basic mp4 out (i tried various other output options including image sequence and sending frames to ffmpeg, issue was present with all of them), and the streamingimagesequence track. 4) The source images are 3840x2160, the rendertexture was the same resolution. However lowering the rendertexture didn't seem to affect anything.

If there's some other non-public way for me to send it over to you, i'd be happy to.

EDIT: I just realized that I never stated that the issue happens in play mode (not a standalone build, just play in editor). This is a play-mode issue and doesn't happen while just scrubbing the timeline.

sindharta commented 1 year ago

If there's some other non-public way for me to send it over to you, i'd be happy to.

Would it be possible for you to send me a link to download your project ? My email address is sindharta.tanuwijaya@unity3d.com

djuniah commented 1 year ago

I just sent an email with the project and some more detail. Thanks for looking into this!!!!!

djuniah commented 1 year ago

If i let the sequence run too long, eventually i get this stack trace and it stops showing new images:

[SIS] Out of memory when loading images
UnityEngine.Debug:LogWarning (object)
Unity.StreamingImageSequence.ImageLoader:GetImageDataInto (string,int,Unity.StreamingImageSequence.ImageData&) (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Runtime/Scripts/Loader/ImageLoader.cs:60)
Unity.StreamingImageSequence.StreamingImageSequencePlayableAsset:QueueImageLoadTask (string,Unity.StreamingImageSequence.ImageData&,UnityEngine.Texture2D&) (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Runtime/Scripts/Features/SIS/StreamingImageSequencePlayableAsset.cs:348)
Unity.StreamingImageSequence.StreamingImageSequencePlayableAsset:QueueImageLoadTask (int,Unity.StreamingImageSequence.ImageData&,UnityEngine.Texture2D&) (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Runtime/Scripts/Features/SIS/StreamingImageSequencePlayableAsset.cs:329)
Unity.StreamingImageSequence.StreamingImageSequencePlayableAsset:ContinuePreloadingImages (int) (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Runtime/Scripts/Features/SIS/StreamingImageSequencePlayableAsset.cs:305)
Unity.StreamingImageSequence.Editor.SISPlayableMixerEditorTask:Execute () (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Editor/Scripts/EditorManagers/SISPlayableMixerEditorTask.cs:73)
Unity.StreamingImageSequence.Editor.EditorApplicationManager:EditorApplicationManager_Update () (at Library/PackageCache/com.unity.streaming-image-sequence@0.16.0-preview/Editor/Scripts/EditorManagers/EditorApplicationManager.cs:110)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

It seems like it might not be the pre-loading that is the issue, is there a way to tell it to release the memory used for already loaded images (if i'm only going to be using them once)?

sindharta commented 1 year ago

Closing this issue as per our discussion via emails. Let me know if there is anything else I can help.