Unity Mipmap Streaming in VRChat

Hello,

I was curious about Unity’s Mipmap Streaming and whether or not, or the extent to which, it is included in VRChat.

I do know that for avatars, you can create mipmapped textures and enable texture streaming for the avatar. But I wasn’t sure about the effectiveness of this and how to tune it to be more performant.

I obviously ask because we have a such a huge problem with many avatars using extensive amounts of VRAM. I often find with a certain group I meet with, that VRChat will max my 8 GB of VRAM and use 15-20+ GB of system RAM with 30-40 people present in a world.

So I wanted to know the level to which VRChat currently uses mipmapping, and what the best practices are to help reduce VRAM usage on Avatars.

I do know that the mipmaps are used, but not sure if the higher levels are streamed in, or not. Normally unity takes in a PNG and cranks out suitable texture with mips, but you can import premade textures. With premade mipmaps, can make them noticably different so you can see the different levels blended in.

With your performance problem I wonder if they’re asking for streaming mipmaps but aren’t getting use out of it. I guess the test would be to make the highest level noticably different from the rest and then see if any delay in seeing the highest level can be caused

1 Like

Hi @dark, thanks for posting your question!

If you haven’t already, you can post it as a feature request on feedback.vrchat.com.

To answer your question: VRChat currently doesn’t support streaming mipmaps. It’s something we might decide to add at some point, but some issues would need to be addressed first.

Most notably - some user avatars may lack mipmaps, have them disabled, or have a maximum priority. This would adversely affect mipmaps with streaming enabled: Once you run out of VRAM, they’d appear blurry and stuck at a lower mipmap. Users might run into this issue maliciously, or accidentally.

We hope this helps you understand why we currently don’t support mipmap streaming. Perhaps it’s something we can look into in the future!

1 Like

Right now the current SDK is adamant about streaming mipmaps being turned on, you can unintentionally sidestep this with a material swap. But I try to make sure it’s enabled.

Is it possible for bad settings to be corrected at runtime? I guess if implemented there should be some advisement of acceptable value for avatar, and personally I think if people exceed the priority, make it roll over to something exceedingly low.

Or just set priority to the same value on all avatar texture and just roll with it?

That’s a great idea, and would probably have to be part of the solution!

Unfortunately, that wouldn’t fully solve the problem, as avatars uploaded without streaming mipmaps enabled effectively have an ‘infinite’ priority.

2 Likes

I see, thanks for the insight!

I know many games have an option to toggle Texture Streaming on and off. Would it be possible for VRChat to also do this? This way users can at least enable it as an experimental option, especially since many avatars (afaik) already have mipmaps enabled.

I created a feedback request that is available here: Canny

But it does solve the problem still, no? Sure, they may have infinite priority, but that’s no different than how the game is now, right? Unity docs does mention that it can still load textures without mipmaps alongside mipmapped textures.

This would mostly solve the problem. I do not think a universal adoption to mipmaps needs to be a priority for the feature to exist. And if the feature did exist, users that do not use mipmaps can eventually be encouraged to do so when their avatar further lags out instances.

That might be useful, yeah.

Not quite. With mipmap streaming, if you run out of VRAM, you’d see avatars get stuck at lower, much blurrier mipmap levels. Players who decide not to use mipmaps or mipmap streaming would always appear at full resolution.

1 Like

Oh, I see. Thanks for clarifying.

Well, at the very least, I am hopeful for an experimental option. I do know it takes extra dev time, but having a feature like this I think would be useful, even if it only partially works.

It would be unfortunate if users got stuck on the lowest setting with VRAM maxed out, but I think that would be better than not having it at all. At least at that point, more people can be urged to use mipmapping, or VRChat can even eventually require it outright if the feature works well.

1 Like

I could be misunderstanding something, but wouldn’t it be better to have avatars with mipmap streaming get blurry than to run out of VRAM, which is what I assume would happen in that situation otherwise?

1 Like

I was informed that while the SDK enforces the streaming mimap option, it’s only when mipmaps are enabled, so there is possibility to not have mipmaps.

Personally I am in favor of any measure that encourages better optimization, so like an option that replaces any 2k texture without mimapping with the broken texture from source engine (black and magenta checker board) is something I’d like to see. Well, maybe start with 4 or 8

I do think the best solution will still be to allow mipmapping to work in-game. As far as I know, many textures for avatars already have it enabled, so it should work out of the box for many avatars.

I think if a client wants to disable the mipmap streaming on their end, they should have the option to. But really, we aren’t going to have people that actually want to optimize, or people that aren’t going to sacrifices features and quality.

We already tried VRAM restrictions in a community I’m a part of. Even with a 200 MB texture memory limit, people were complaining (one of whom had 193 materials on their avatar, even though, yes, only about 10-25 may be active at one time). Another somehow only had 1 4K, a few 2K, and some 1K textures and still managed to get over 200 MB.

I think VRChat can at least push for runtime optimization. If they can manage to create an “active statistics” for avatars, as well as enable mipmap streaming, it can both reduce the VRAM issue while making people more conscious of how bad their avatars actually are. As well as with what Tupper noted about really poorly performing animators, if they can be included in the game statistics somehow, or is some requirement for upload.

I’m confused, if VRChat doesn’t support Mipmap streaming then why does the SDK block uploads and force you to enable it on all your textures before you can upload an avatar? Something doesn’t add up here.

I was confused about this as well, but I realized it the other day.

Mipmaps are enabled, but mipmap streaming is not.

So currently, it will use mipmaps (which is mainly good for making textures look good and not choppy/pixelated/flickering at a distance), but they will all be loaded in VRAM.

Mipmap streaming allows the higher quality versions to be unloaded if that mipmap level is not required and VRAM is needed. So in the case that there are a lot of avatars in a single area, instead of dropping to 3-6 FPS like I usually do, it would just force the lower mipmap levels to compensate at the cost of less visual quality.

There has to be misinformation somewhere here. Why would the SDK insist on having streaming mipmaps enabled?

I don’t know, but it does. Perhaps they planned to do it eventually but wanted to come up with a solution.

I believe Fax or someone else mentioned that there are some technical issues with streaming mipmaps that they want to avoid, which is why it’s not in the game yet. One of them was that I guess everything would look awful because they’d all go to the lowest mipmap, or people can set their mipmap priority differently and it ends up making the system useless.

I mainly just wish it was an option in-game that we can toggle.