Unity-Technologies / Unity-Technologies/com.unity.webrtc
[REQUEST]: Mipmap support for incoming video streams
@karasusan is already working on this.
Since May 15, 2024.
- Dominant language
- Assembly
- Stars
- 852
- Forks
- 238
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem?
I'm always frustrated when streaming screen capture video to my Unity WebRTC project the texture looks pixelated if viewed from far:
Describe the solution you'd like
It would be great if we could enable mipmaps on the texture returned by VideoStreamTrack.OnVideoReceived:
Describe alternatives you've considered
I have tried to make changes to the package but I only managed to get the first mip level populated (I am not very familiar with low level graphics commands, maybe someone more experimented have an idea where I am wrong)
VideoStreamTrack.CreateRenderTexture():
var tex = new RenderTexture(width, height, 0, format);
tex.useMipMap = true;
tex.autoGenerateMips = false;
tex.Create();
VideoStreamTrack.OnVideoFrameResizeInternal():
var format = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType);
Texture = new Texture2D(width, height, format, TextureCreationFlags.MipChain);
track.OnVideoFrameResize(Texture);
VideoDecoderMethods.UpdateRendererTexture():
_command.IssuePluginCustomTextureUpdateV2(callback, texture, rendererId);
Graphics.ExecuteCommandBuffer(_command);
_command.GenerateMips(texture);
_command.Clear();
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.