JLChnToZ / VVMW

VizVid - Brand new original video player frontend for VRChat, aims for flexibility.
https://xtl.booth.pm/items/5056077
MIT License
70 stars 6 forks source link

[Feature Request] MipMapping support #41

Open orels1 opened 4 weeks ago

orels1 commented 4 weeks ago

Have been really enjoying using your player, but there is one thing that has been bothering me a little.

When watching 1080p videos with a lot of detail - the aliasing becomes fairly noticeable, especially on the portable screens.

Since you already have a mechanism to blit the screen to fix AVPro empty frame issues and for LTCGI - I was wondering if its possible to add support for generating MipMaps?

I did a quick test and it seems like its possible to simply expand the current blit setup to use mips so it would generate them on blit

            if (bufferedTexture == null)
            {
                int width = texture.width, height = texture.height;
                Debug.Log($"[VVMW] Created temporary render texture for {playerName}: {width}x{height}");
                bufferedTexture = VRCRenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.ARGB64, RenderTextureReadWrite.sRGB, 1);
                bufferedTexture.filterMode = FilterMode.Bilinear;
                bufferedTexture.wrapMode = TextureWrapMode.Clamp;
                bufferedTexture.useMipMap = true;
                bufferedTexture.anisoLevel = 16;
                core._OnTextureChanged();
            }
JLChnToZ commented 4 weeks ago

It is a good idea though, but if I just enable mipmaps at here will make it inconsistent to other video player backends.

orels1 commented 4 weeks ago

Could at least be an option on the video player handler/somewhere else? Just so people can enable it even if they don't know how to code 🤔

And yeah I haven't tested / looked into the Unity video player side. I assume it doesn't blit at all right now?

JLChnToZ commented 4 weeks ago

The blit logic only applies to AVPro screen, I'm using a dedicated shader just for this workaround. Also as this is a workaround, and blitting texture costs performance, this flow might be removed once underlying issue has been fixed in future. So I still wondering if logic for changing mipmap setting is appropriate in here.

orels1 commented 4 weeks ago

I see. Do you still blit for both backends if the user uses LTCGI texture export? Wonder if this could be done in a similar way in that case

JLChnToZ commented 4 weeks ago

LTCGI flow is just blit to/within a custom render texture, when assigned the target LTCGI screen and it starts playing video, the player simply sets the screen texture to its underly material, nothing fancy here.

orels1 commented 4 weeks ago

I guess I can just handle it on my side and do a second blit of the screen texture before it goes to screen in the world code. Can't really come up with a better solution that doesnt require major changes to the codebase