#vnyan — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #vnyan, aggregated by home.social.
-
My method for comms between #VNyan plugins works well, but feels wrong. Any #CSharp experts want to tell me the correct way?
The idea is to avoid reflection at runtime by having a function that returns a ref to the actual function which we then assign to a public function that is otherwise a dummy
For sharing variables this gives us things like Get_GetMainFollowCamActive which returns GetMainFollowCamActive and the same for Set.
At the other end these are local functions that can be overridden if the other plugin is present, then finally a {get;set;} that calls them
The relevant bits of code are here:
Source plugin:
https://github.com/LumKitty/VRnyan/blob/master/VNyan_Liv/FollowCam_Handlers.csCalling plugin:
https://github.com/LumKitty/VNyan-FollowCam/blob/master/VNyan-FollowCam/VRnyan_Handlers.csSome of these are called multiple times per frame. In my own setup it's 180fps, but in a worst case scenario, someone might need 3600fps
-
Test footage from v0.6 of my #VNyan followcam and its VR integration. A quick test (with no body trackers on, just head + hands) and it is so smooth now.
The XYZ indicator in the middle, as well as my model are being rendered in VNyan, the VR world is Beat Saber, rendered by OnAirTap.
The challenge I've had to overcome is my headset is fixed to 90fps, while VNyan is set to match my stream which is 60fps, so the two elements being blended together are running at wildly different framerates.
The fix I came up with is to calculate followcam movements at 180fps as this is the lowest common multiple of 60 and 90 and make the most up to date value available to OnAirTap whenever it decides to render a frame, and likewise for VNyan (although there, there is the additional complexity of the Cursed Camera Queue when doing VR compositing). This means no matter how much framerates vary between the two apps, whenever they render one, it will always be in an appropriate place, so they always appear to move smoothly, even when frames are dropped
The downside to this approach is that there is, potentially, always 1 frame of difference in movement between the two elements. This isn't really avoidable, but in practice it's only noticeable if you're staring hard at a point where two static objects in the scene touch, and even then only at high camera speeds, so really I just need to add a camera speed limit to the options to resolve this.
I still have more to do.
-
Followcam 0.6-beta and VRnyan 2.3-RC6 released.
With this I think they're actually good for people to try out together!Redid comms and removed all use of reflection at runtime, via silliness = better performance
Replaced Unity InvokeRepeating with a reliable high res timer = much smootherLive testing in prod on Wednesday!
#VNyan #VTuberTech #VTuber #ENVTuber #VTuberEN
https://github.com/LumKitty/VNyan-FollowCam/
https://github.com/LumKitty/VRnyan