Chman / Moments

A quick GIF replay recorder for Unity
zlib License
856 stars 118 forks source link

Resizing gif #9

Closed yosun closed 6 years ago

yosun commented 6 years ago

Hello! It seems that there are some threading complications where bilinear scaling seems to only work on the first frame (by resizing each texture2d right before it’s added to the gif structure)

Do you have suggestions on resizing the gif?

yosun commented 6 years ago

Recorder.cs - http://wiki.unity3d.com/index.php/TextureScale

            // Process the frame queue
            while (m_Frames.Count > 0)
            {
                RenderTexture source = m_Frames.Dequeue ();
                Texture2D target = temp;
                RenderTexture.active = source;
                target.ReadPixels(new Rect(0, 0, source.width, source.height), 0, 0);
                target.Apply();
                RenderTexture.active = null;
                //TextureScale.Bilinear (target, adjWidth,adjHeight);
                //yield return new WaitForSeconds (0.05f);
                GifFrame frame = ToGifFrame(target);
                frames.Add(frame);
                yield return null;
            }
yosun commented 6 years ago

mea culpa! target.Resize() at the end solved it