[1220] [Q&A] Avatar Distance Hiding & Write Defaults
tracked
MisutaaAsriel
Preface
Whilst the team at VRChat likely has busy schedules, and especially in the wake of the realization that perhaps focus on rapid iteration of QoL & accessibility features is necessary, I was hoping someone with technical knowledge could take the time to explain a little further on how the Hide Avatar by Distance system functions,
on a technical level
?There is, I'm sure,
plenty of us in the VRChat community who would more than love the,
I quote
, "pretty in-depth"
explanations of how one of our favorite platforms work.
— For some of us, that is the difference between knowing why
something behaves the way it does, being capable to work with it, and being able to file effective feedback
; and merely filing generalized feedback whilst we operate under the assumption that VRChat is "broken" or in disrepair.On Write Defaults
As it stands,
Write Defaults is a necessity for many complex state machines
on Avatars; Working without Write Defaults is nigh impossible with these avatars, as the sheer amount of "exit animations" required, let alone the conflict of blended/intermingling states, would more
than double the work, if not triple, needed to carry out the same functions.However, there's still questions to how avatars are actually, well,
hidden
.And How?
As it stands, the behavior
appears
to exhibit the following, based on both user experience and existing developer language:- Avatars are removed from the visual plane
- Animators themselves continue to run
- Animator properties, or animations themselves, are perhapspartiallyculled.
- Properties or Animations which are culled do not properly reset when un-hidden
- This is perhaps why Write Defaults is problematic; The nature of animators withoutwrite defaults means that they will have a series of "exit animations" which will effectivelyresetthe avatar's state; upon being un-hidden, these animations will fire, essentially meaning thatallavatars are broken, but that avatarswithoutWrite Defaults areself-recovering.
Speculating, there are a number of ways which the avatars
could
be hidden, each with unique drawbacks. However, I myself lack some knowledge in Unity behaviors to have any solid
notion exactly how the VRChat team has done this.Unity is like an onion...
The easiest method, to my understanding, however, would be to
leverage Unity's layer system to move avatars to a reserved layer which is "culled" from the player camera
; This would essentially make player avatars present, but invisible
, removing them from draw calls whilst still running their logic in the background. In
theory
, as I do not yet have a full grasp on the intricacies of Unity, if the Animator's cullingMode
was set to AnimatorCullingMode.AlwaysAnimate
, it would continue running critical animations off-screen
, meaning avatars with Write Defaults would not break. However
, conversely, this would mean that logic & animations for these avatars would continue to run in the background, reducing the performance savings. The only savings would be on the actual drawing of the avatar to the screen.This would still offer a considerable benefit to platforms, like Oculus Quest, where complex avatars making frequent draw-calls severely hamper performance.
There is a reason the avatar ranking system is so drastically different between mobile & PC, after all.
— In public lobbies where there are a considerable number of complex avatars, where a user may desire to see those avatars when up close, but no longer when they are actively nearby, this could still offer a potentially-considerable performance boost.By other means...
Tupper laid out in the August 5th Developer Update that there are other means, for sure, which could be used to hide the avatar, or to resolve conflicts with Write Defaults, but each with their own issues.
|
As for some examples: fully unloading and reloading/reinitializing the avatar is really heavy. We can’t do that. Stopping the animator isn’t good either, as we could run into issues. Can’t hide renderers easily, as we’d have to fight with animators for control – setting something every frame, which could be bad for performance.
From this it is at the very least clear:
- The avatar is not being "unloaded" — The GameObject itself is still present.
- The animator itselfis continuing to run; disabling this would likely cause issues withallavatars getting stuck, rather than just those with Write Defaults,I imagine.
- The Mesh Renderers are not being disabled; this makes sense, as this could break avatars with multiple meshes which are intermittently displayed.
But Why?
In all, you may ask yourself:
"Why go through the effort to explain the technical underpinnings of something that is subject to change?"
However, the VRChat community isn't just filled with
e-Kid avatars and asset rippers
. Heck, the modding community itself has, if you will bare with me, proven an invaluable asset in helping VRChat these past couple of years determine the direction future feature-updates should take;
OSC, accessibility updates, QoL improvements, Avatar Dynamics, and more!
By being up front with us; By
going into those
"in-depth explanations"
; VRChat can potentially leverage the more talented and technically inclined folk to power future solutions to VRChat's problems; To collectively brainstorm, troubleshoot, and implement solutions which further the very platform....
After all, people didn't mod VRChat for no reason.
Perhaps they felt they were not being heard.
Log In
Scout - VRChat Head of Quality Assurance
tracked
MisutaaAsriel
Scout - VRChat Head of Quality Assurance: Heh. I wonder what "tracked internally" means in this context.
~Babo~
holy lol
Dauw_Jonas
How did the Avatar Hider mod work?
°sky
i feel like itd be important to know how this mod worked too, cause it might help solve some of the write default issues
GenesisAria
I think it disabled the avatar parent object and just either left the animator running or disable it. I never did spend any time sitting in UnityExplorer inspecting what it did, nor did i bother asking the creator of the mod (can't remember who was working on it last).
Gireison
For the write defaults thing:
Additionally to what you wrote, the documentation says:
We recommend keeping Write Defaults off and explicitly animating any parameter that needs to be set by the animation.
Which means its recommended, not required to turn write defaults off. A lot of avatars are built with write defaults and the avatar hider as is right now might cause some issues to these.
Your description of how the avatar hider works does match from what I assume due to seeing it in action as well, however the last point of your description, the part " "exit animations" which will effectively reset the avatar's state" is not 100% the full story. Best practice and what most write-defaults off avatars are doing, is to have at any point in time a _defined_ state of an animated property by an animation.
During my testing (i have a couple of avis with mixed write defaults on and off layers), i only saw the wd off layers failing, due to their writeback not functioning correctly while being hidden. (wd off layers had no issue in that moment, since like mentioned earlier their animated properties where always defined)
Personal opinion is, that keeping write-defaults animators functional is about to be a crucial part for avatar hiders functionalities in the future, since too many avatars (and a lot for good reasons) depend on it.
MisutaaAsriel
Gireison: The docs actually even go a step further:
|
All that being said, if you get into more advanced use cases and setups, it may be advantageous to use Write Defaults On.
The docs themselves leave room for it to be allowed. Like other practices from the docs, they're more about a "beginner friendly" best-practices angle, as opposed to what's actually best for a particular situation (kinda like how some Quest optimizations will actually rank avatars
worse
in the system in select cases).