Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
134 stars 2 forks source link

Adjustments to View overrides and render transform overrides. #2904

Open ko-tengu opened 1 week ago

ko-tengu commented 1 week ago

Is your feature request related to a problem? Please describe.

With the new locomotion animations, there is a render transform override placed on the user's head bone, to help minimize disruption from animations. However, if you use an View override with an AvatarUserRootOverrideAssigner, then you get some very unintended side effects of your head stretching and distorting as you move or look around. These components are used for various avatar gimmicks, as well as VR based third person/drone cameras.

20240908050731_1

Describe the solution you'd like

I think the best answer would be for the UserView context of the RTO to exclude when View gets overridden, or a new context added for this circumstance.

Describe alternatives you've considered

Disabling or altering the RTO component with protoflux when a view override is used, but this seems to mostly result in other side effects displacing the head. Entirely removing the RTO is a potential answer, but then the new locomotion is pretty disruptive, especially in desktop.

I've also considered simply not having the gimmicks, I suppose.

Additional Context

No response

Requesters

No response

Frooxius commented 1 week ago

I don't quite understand why do you see your head stretched out like that. Normally it's supposed to override the view only in the first person view, so you shouldn't be able to see it stretch out like that.

This feels like there's a bug going on.

ko-tengu commented 1 week ago

In the interest of if it is a bug, here's the logs and I tested it on a couple of different seats and avatars in this session. BUFU - 2024.9.6.1189 - 2024-09-08 05_18_36.log image

This is an issue for a few friends I have that use other systems that involve view overrides too. All of the effected avatars did not have an RTO before the update, and have made no changes to the RTO that was added.

My replication steps are putting a view override on an external slot, using an anchor (in this case the official resonite dawn stool and also a Ren's EZ Seat) and then simply standing up IRL.

ko-tengu commented 1 week ago

I realized I should check the Unity logs since this is a mostly unmodified Unity component, and sure enough it's actually full of null reference errors, included from the same test session as the above Resonite log. Player.log

NullReferenceException: Object reference not set to an instance of an object
  at UnityFrooxEngineRunner.RenderTransformOverrideConnector.Override () [0x00022] in <7eb3c5d9f24e41fa93f4cfd4017e80be>:0 
  at UnityFrooxEngineRunner.RenderContextOverride`1[D].RunOverride () [0x00025] in <7eb3c5d9f24e41fa93f4cfd4017e80be>:0 
  at UnityFrooxEngineRunner.RenderContextOverride`1[D].HandleRenderingContextSwitch (UnityFrooxEngineRunner.RenderingContextStage stage) [0x00003] in <7eb3c5d9f24e41fa93f4cfd4017e80be>:0 
  at UnityFrooxEngineRunner.RenderHelper.BeginRenderContext (FrooxEngine.RenderingContext context) [0x0004a] in <7eb3c5d9f24e41fa93f4cfd4017e80be>:0 
  at UnityFrooxEngineRunner.HeadOutput.OnPreCull (UnityEngine.Camera camera) [0x00015] in <7eb3c5d9f24e41fa93f4cfd4017e80be>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_Camera(UnityEngine.Camera)
  at UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) [0x0000d] in <c5a41139b01b40a09f2ec8dd4a1062f7>:0 
CybrixTheProot commented 1 week ago

So is this why I keep unity crashing?

shiftyscales commented 1 week ago

Can you please provide a ResonitePackage (zipped up so it can be uploaded here), or a direct link to content that exhibits this issue, @ko-tengu?

ko-tengu commented 1 week ago

Here's an avatar with a simple third person camera and a stool, I suppose. Replication.zip

In creating this I noticed an unusual issue where the bug only applies in like, every other world. I can try the same avatar in the same seat in a gridworld and it'll work, and if I open a second identical grid world the RTO will function normally. The unity log errors persist however, and it's consistently inconsistent.

shiftyscales commented 1 week ago

I see- I better understand the issue now from playing with the above replication object, @Frooxius.

I don't quite understand why do you see your head stretched out like that. Normally it's supposed to override the view only in the first person view, so you shouldn't be able to see it stretch out like that.

This feels like there's a bug going on.

This seems to be happening specifically because they are using a AvatarUserRootOverrideAssigner to set a custom view position- but technically speaking, that is still a "first person" view context, even though it isn't necessarily on the avatar, so as a consequence you are seeing the stretching you otherwise wouldn't.

You are effectively viewing your avatar in the third person from out of body but still in the "first-person" view context.

As had been noted- some avatars make use of this as a gimmick, and apparently third-person modes while in VR.

Unless I'm misunderstanding something though- it seems the anchor is otherwise unrelated to the issue, @ko-tengu?

I was getting the head stretching just by being in the avatar you provided.

ko-tengu commented 1 week ago

yeah, the anchor is unrelated, it's just an easy way for me to replicate it, since it roots my hips and i can simply step around in my playspace

ko-tengu commented 1 week ago

I felt it's worth mentioning that while today's update (2024.9.10.682) is an effective stopgap fix for this problem, the bug is still present if you have a manually driven RTO.

lxw404 commented 5 days ago

I think this should be classified as a bug not an enhancement. I just noticed this when going from first person to third person that it stretches out the neck, but only for me when I'm viewing it. Not sure if this is the same thing though as what is described with the view override, but in this basic case the render context is changing as well.

https://github.com/user-attachments/assets/d396a3c6-ce2b-4829-b7a3-08fd260dc4e6

https://github.com/user-attachments/assets/1defaa24-1e4d-4ea1-8830-22916b411213

shiftyscales commented 5 days ago

I think the issue there is the camera lerping instead of instantly repositioning itself, @lxw404. I think in that case the view context changes before the camera moves into its final / resting position.

It didn't really matter prior as the head position didn't change between view contexts- so if anything I'd consider that a tweak / enhancement / oversight more so than a bug. It's visually similar, but I feel unrelated to this issue and should probably be reported separately.

This issue pertained more specifically to the use of the AvatarUserRootOverrideAssigner component and manually repositioning the user's view while it still remains in a first-person view context.

ko-tengu commented 5 days ago

To a degree your issue is probably working as intended, since the whole point of the RTO is to remove any locomotion and display issues that desktop would have with the various head animations. I don't know the exact nature of the desktop chase camera returning home though, if it is a view override being moved home it could be the same issue.