Okabintaro / SubmersedVR

A Subnautica VR mod aiming to bring full motion controler support and common VR mechanics to the game.
MIT License
181 stars 10 forks source link

Updated to allow game completion #71

Closed jbusfield closed 10 months ago

jbusfield commented 11 months ago

First let me say that your original Subnautica mod made playing the game a truly wonderful experience. You did an amazing job and your VR version is one of the best games I've ever played. As a token of my appreciation I wanted to upgrade Below Zero with the same VR features as the original. I started a few weeks ago using the master branch as the basis, not realizing you had already started a subzero branch. I played through my version to completion with about 50 game hours so it should be pretty solid. Then a few days ago I realized you has a subzero branch so I patched your branch with my changes. Hopefully I didn't miss anything in the conversion but from my limited testing it looks good.

Changes include: Various cinematics enabled to allow game progression to completion. - Cutscene cinematics can't be skipped or else the game does not progress so I added the critical ones back in. Unfortunately the cinematics takes control of the players head which can cause nausea. Probably not a bad thing for scenes like crash landing where you should be disoriented anyway, but not great for people with bad motion sickness. I will keep looking for a way to disable the cinematic from taking control of the head.

Various UI tweaks to make the game more playable. - The Snow bike was locking the player's head so that any yaw or pitch of the bike was translated to the head. There was no way to use the bike without being nauseous so I disabled yaw and pitch while riding the bike.

Fixed the clouds using code from https://github.com/tommaier123/VRTweaks/blob/master/VRTweaks/VolumeCloudPatches.cs

Fixed some materials, for example MobileExtractorMachine sample container had invisible glass because its RenderQueue geometry was wrong for VR. However, there are still many materials that are not showing up, most notably the holographic material for the SeaGlide display, the scanner room and the building tool when a building item is first placed and 0% constructed.

Fixed the camera pivot points when piloting the SeaTruck and HoverBike but wasn't able to do it using the pilotPosition.localPosition because of Player.Mode.LockedPiloting so had to force it using Player.main.transform.localPosition. This unfortunately causes the PDA to flicker slightly when opened while piloting because the Player.main.transform.localPosition is fighting with the LockedPiloting position. Still need to figure out a better solution but I played the whole game that way and it wasn't too annoying

To re-enable VR I did not use https://github.com/Raicuparta/unity-vr-patcher. Instead I downloaded BZVR2.0.2 from here https://www.nexusmods.com/subnauticabelowzero/mods/118?tab=files and copied the BepInEx/patchers/GlobalGameManagerVRPatcher folder only, into SubnauticaZero/BepInEx/patchers. I also added the "Switch to SteamVR" file to the SubnauticaZero root directory and ran it once so that the VRMODE file was created. I can send a zip file of the result if that's not clear.

Note that the build directory in the .csproj file is currently set to my local folder structure.

Thanks again for all your hard work!

Okabintaro commented 10 months ago

First let me say that your original Subnautica mod made playing the game a truly wonderful experience. You did an amazing job and your VR version is one of the best games I've ever played. As a token of my appreciation I wanted to upgrade Below Zero with the same VR features as the original. I started a few weeks ago using the master branch as the basis, not realizing you had already started a subzero branch. I played through my version to completion with about 50 game hours so it should be pretty solid. Then a few days ago I realized you has a subzero branch so I patched your branch with my changes. Hopefully I didn't miss anything in the conversion but from my limited testing it looks good.

This is awesome. Great work! I gave it a quick test yesterday and it ran really well. Would like to give it a proper look though on the weekend.

Various cinematics enabled to allow game progression to completion. - Cutscene cinematics can't be skipped or else the game does not progress so I added the critical ones back in. Unfortunately the cinematics takes control of the players head which can cause nausea. Probably not a bad thing for scenes like crash landing where you should be disoriented anyway, but not great for people with bad motion sickness. I will keep looking for a way to disable the cinematic from taking control of the head.

Yeah, I it's sad they don't have an option to skip the cinematic like in the first game. There kind of is a hidden option I think which I tried to set but it broke the Sea Truck for example, since the positioning of the player is managed by an animation too.

Various UI tweaks to make the game more playable. - The Snow bike was locking the player's head so that any yaw or pitch of the bike was translated to the head. There was no way to use the bike without being nauseous so I disabled yaw and pitch while riding the bike.

Still have to try that out, but sounds good!

Fixed the clouds using code from https://github.com/tommaier123/VRTweaks/blob/master/VRTweaks/VolumeCloudPatches.cs

Works nicely! I was looking at the cloud shader a bit myself, but didn't knew there was a patch already.

Fixed some materials, for example MobileExtractorMachine sample container had invisible glass because its RenderQueue geometry was wrong for VR. However, there are still many materials that are not showing up, most notably the holographic material for the SeaGlide display, the scanner room and the building tool when a building item is first placed and 0% constructed.

Yeah I noticed too there are some transparency issues. The Bladderfish and the oxygen giving Plant thingy are also completely transparent. I wonder how easy it would be to apply the same fix there.

Fixed the camera pivot points when piloting the SeaTruck and HoverBike but wasn't able to do it using the pilotPosition.localPosition because of Player.Mode.LockedPiloting so had to force it using Player.main.transform.localPosition. This unfortunately causes the PDA to flicker slightly when opened while piloting because the Player.main.transform.localPosition is fighting with the LockedPiloting position. Still need to figure out a better solution but I played the whole game that way and it wasn't too annoying

Hmm. Maybe that is too related to the SeaTruck using an animation to position the player. In those cases you can try to update positions on LateUpdate() instead of Update(), see the unity manual about event exection. I will try to take a closer look on the weekend too.

To re-enable VR I did not use https://github.com/Raicuparta/unity-vr-patcher. Instead I downloaded BZVR2.0.2 from here https://www.nexusmods.com/subnauticabelowzero/mods/118?tab=files and copied the BepInEx/patchers/GlobalGameManagerVRPatcher folder only, into SubnauticaZero/BepInEx/patchers. I also added the "Switch to SteamVR" file to the SubnauticaZero root directory and ran it once so that the VRMODE file was created. I can send a zip file of the result if that's not clear.

Nice. Yeah both should work and the latter one is more user friendly anyways. For the release of the mod I though about writing an installer for people that would apply the patch and install the mod file, but not sure if it's worth it tbh.

Thanks again for all your hard work!

Thanks to you too :)

jbusfield commented 10 months ago

I've been doing some more testing with the transparency issue and have determined that the issue is with the WBOIT shader. In Materials.cs you'll see that I have done:

mat.DisableKeyword("WBOIT");

to the Bladderfish, Oxygen plant and Antidote injector. Disabling the shader makes "something" show up for these items but its not the correct thing since the shader hasn't been applied. Also if you go to MiscTweaks.cs and uncomment lines 76 to 83 and then while in game do a "Recenter in VR" you will see all the "noisy background stuff" in the ocean that is currently not being rendered because the WBOIT shader phase is currently outputting nothing.

I don't have much experience with shaders and I see that you have some experience, so if you could take a look or point me to where I could locate/troubleshoot/debug the shader that would be great! Thanks.

Okabintaro commented 10 months ago

I tried the most recent version and it's cool that some of the transparency is now working! Still gotta look into the shader code though for the remaining cases. The ones I noticed are the PDA Frame, Glass of the Seatruck and Scanning Beam of the Scanner

Two other issues I saw while testing the most recent version:

Keep up the good work! I hope I will be able to help again sometime soon.

jbusfield commented 10 months ago

We must be on the same wavelength. I just checked in the fix for the death scaling :)

Okabintaro commented 10 months ago

Awesome. I was like wow, you work fast. Do you think we could release a first test version for people to try out soon? I want to see if I can write down all the main issues or some kind of TODO list tomorrow. We could also talk on Discord about the project if you like(Name is okabintaro) there.

jbusfield commented 10 months ago

I made an installable version of this build at https://github.com/jbusfield/SubmersedVR/releases/tag/0.1.0-bz. It has instructions on how to install it, pretty much exactly like for the original but uses Below Zero Bepinex. I'll leave it up to you if you want to announce it on Discord

jbusfield commented 10 months ago

Found the WBOIT fix I've been looking for at https://github.com/elliotttate/VRTweaks/blob/master/VRTweaks/WBOITFixes.cs so all the materials that weren't showing up are now visible. With this check in the game is now working really well. Will do some more testing and then I think it will be ready for a release.