Valheim
0 of 0

File information

Last updated

Original upload

Created by

Brandon Mousseau

Uploaded by

manicmoose99

Virus scan

Safe to use

Tags for this mod

About this mod

This mod adds VR support to Valheim using OpenVR and SteamVR Unity integration.

Requirements
Permissions and credits
Changelogs
VHVR - Valheim VR
This is an experimental mod for the PC game Valheim that adds in native VR support using Unity and SteamVR with OpenVR.

IMPORTANT
If you have trouble loading the mod, it would be very helpful if you can add a post here with what mods/plugins you have installed as well as any logs from the game!
Thanks!

News:
Using the LookBasedLocomotion config file option, you can turn your head/body to change the direction your character is walking in game. This change also required some creative changes with the GUI. Please provide any feedback you have for any bugs with this update or what does or does not work well.
Thanks!

Upcoming Updates:
  • Use VR controllers as input (not fully motion/hand support, but will be able to user VR controllers as gamepad style input and use hands for UI interaction and building)

Recent Changes:
Version 0.2.0 Changes
  • Enabled look-based locomotion
    • You can now use the "EnableLookLocomotion" config file option to set the direction the player faces and walks by using the direction of the HMD, which allows you to turn your whole body to turn in game.
    • Without this option turned on, the GUI rotation is set by the direction of the player. This works fine when not using look-locomotion because you can turn your head and look at the whole GUI panel. However, with EnableLookLocomotion on, turning your head rotates your body, which would make it impossible to look at either edge of the GUI. So now while EnableLookLocomotion is on, the GUI will only re-center on your current look direction under a few circumstances:
      • Your head turns outside of a configurable angle from the center of the GUI. This can be configured separately for angles while moving or while stationary. See options StationaryGuiRecenterAngle and MobileGuiRecenterAngle
      • The GUI will automatically re-center when you first start moving. This behavior can be disabled using the config file option RecenterGuiOnMove .


  • Minor changes:
    • Fixed issue with non-overlay GUI object interacting with game's physics engine and resulted in strange behavior with boats.
    • Minimap player icon will now always face the direction of the player model rather than strictly where you are looking. If EnableLookLocomotion is on, this is the same thing, but if you are using the original locomotion method, now you can look at the minimap and your player character's icon on the map will match the direction you are walking.


0.1.9 Changes
  • Added UI for ship rudder below the Ship wind indicator
  • Fixed problem with crosshairs not rendering at the correct distance. Problems with double images of text should now be resolved.
  • Fixed Stealth GUI bar so it is now in the correct location on the crosshair
  • Fixed "Repair Mode" piece health bar and moved it to the object being hovered over. Originally it was tied to the crosshair position, but this doesn't make sense with the changes made to the UI for placement mode. Now the health bar will sit on top of whatever the currently hovered object is.
  • Added a visual indicator (a hammer icon) of where the placement mode cursor is. Since in placement mode, the cursor is no longer tied to the crosshair, having this indicator helps guide the player when repairing and building.

Have questions or just want to chat? Join the Discord!

Requirements
This mod requires BepInExPack Valheim. BepInEx is a mod framework for Unity games that allows modders to inject their code into the game's runtime. It also includes Harmony, which is a tools used to patch existing methods in C# libraries.

Additionally, you need an HMD that supports OpenVR/SteamVR. I've only tested it using a Valve Index, but it should theoretically work on anything that meets those requirements. Please feel free to create issues if you find incompatibilities and I'll work on any problems related to specific headsets if possible.

Installation
Note: This mod doesn't yet support any mod manager installation. I am looking at what is involved in supporting Vortex. I'm hitting some issues figuring this out because this mod has some files that need to go under valheim_Data, but Vortex wants to copy everything into BepInEx - looking for a workaround.

Helpful step-by-step guide!

Unzip the contents of the mod file directly into your game's installation folder. It contains a BepInEx plugin file as well as numerous assets/DLL files.

Running:
  • Make sure SteamVR is running BEFORE starting the game
  • Having trouble keeping the game window in focus? In SteamVR settings, change "SteamVR Always on Top" to Off
  • To properly center the camera on the player model, I recommend sitting upright and still, facing the direction you wish to be "center" and reset tracking with the Home key. This should get you very close to where you want. Only at this point would I use the repositioning keys to adjust position to your preference.
  • Due to some graphical glitches, disable Bloom and Anti-aliasing in the graphics menu. I'll work on seeing if I can fix these effects, but right now they produce all kinds of artifacts on the screen. I also recommend turning off Motion Blur for VR. Finally, SSAO looks great, but is very demanding on performance. I've included a third party post processing effect called "Amplify Occlusion" that can be used in place of it (See configuration section). I strongly recommend using amplify and disabling SSAO. Other settings you can configure to your liking/adjust for performance needs (turning down shadows to the lowest level actually doesn't change the graphics that much but is way better performance-wise, so I recommend doing that - but just experiment and see what works for you).
  • Due to what I needed to do to get the mouse cursor to work in game, the "real" cursor is locked to center of the screen. You need to make sure the game window is focused for the in game mouse cursor to work - you might need to alt-tab into the window if it doesn't load on top.
  • Disable "Use Desktop Game Theatre while SteamVR is active" under Valheim properties in Steam.
  • Some users have reported that the game needs to be in full screen to get it running properly - while I haven't experienced this, it is something to try if you have problems.
  • Vulkan is not supported - so make sure you run without Vulkan activated.

Tips
  • You can re-center the HMD tracking using the Home key. Sit upright and face forwards and still and use this to center the tracking. This should put you correctly aligned on the player model in first person.
  • Set "EnableHands" to false in the config file if you don't want to see them or use them in any way
  • If recentering won't work to get you correctly positioned on the character model, you can use the arrow keys to reposition the camera in-game horizontally and the PageUp/PageDown keys to set the vertical position (these keys are also configurable in the mod's config file if you want).
  • When in placement mode, you control the position of the thing being placed with either the mouse or the right joystick. You will have a hammer icon floating in the air to indicate where the placement cursor is currently located.

Configuration
After running the game for the first time, a config file will be generated in <valheim install directory>\BepInEx\config\org.bepinex.plugins.valheimvrmod.cfg

The following options can be configured:
ModEnabled
Setting that can be used to disable the mod without uninstalling it. The mod will load, check this setting, and immediately disable itself if you set this to off.

UseOverlayGui 
This setting causes the GUI to be displayed on an OpenVR Overlay, which provides a high performance clean surface for the GUI canvas to be displayed on. This will not be compatible with Motion Controls once they are fully supported, but highly recommended to be on for mouse & keyboard controls.

UseLookLocomotion 
Use this setting to turn on the feature that will cause your in game body to rotate with your HMD. This will allow you to turn your meatspace body to turn your VR body/direction you are walking.

StationaryGuiRecenterAngle/MobileGuiRecenterAngle
These are the angles that will trigger the GUI to re-center when your head angle diverges from the center of them while using UseLookLocomotion. These are two settings for stationary and while moving respectively.

RecenterGuiOnMove 
This will cause the GUI to re-center when you first start moving when you are using UseLookLocomotion

OverlayCurvature 
This is a setting from 0.0-1.0 that sets the amount of curvature applied when using the Overlay GUI. A default amount of 0.25 is used and is probably sufficent, although you can adjust in game using the -/+ keys.

OverlayWidth/UIPanelSize
Options to set the size of the displayed GUI in game for the respective GUI types.

OverlayDistance/UIPanelDistance
Options to set the distance of the displayed GUI in game for the respective GUI types

OverlayVerticalPosition/UIPanelVerticalOffset
Options to adjust the vertical position of the displayed GUI in game for the respective GUI types.

MirrorMode 
This allows you to set the mirror mode that is used to display the contents on the desktop. You can select, None, Left, Right (for left or right eye images), or OpenVR. OpenVR is needed if you want to be able to see the Overlay GUI that you see in the HMD displayed in the desktop view (just a consequence of how the Overlay works) - the problem is though that I've found that with OpenVR mirror mode causes some issue that makes you have to restart SteamVR or the game freezes up after restarting it - so for that reason I don't recommend using it unless you really need to see the GUI in the desktop mode for some reason (like capturing video or something). Alternatively if you want to see the GUI in the mirror with Left or Right instead, you can disable "UseOverlayGui", but that GUI mode just doesn't look as nice.

ThirdPersonHeadOffsetX/ThirdPersonHeadOffsetY/ThirdPersonHeadOffsetZ
Adjust the positioning of the third person camera. You can adjust these in game using the repositioning keys instead of manually updating these values.

EnableHeadRepositioning
Set this to true (default is true) to enable using the arrow keys to reposition the head while in first person mode without having to manually update the config file, which would be way inconvenient. Settings you adjust using the arrow keys in game will be be updated and saved back into the FirstPersonHeadOffsetX/Z config listed above.

EnableHands
If you wish, you can disable rendering hands/laser pointers. You can use this if you want to keep the controllers on but don't want to use them at all in game to keep them from appearing.

PreferredHand 
This is not fully useful to configure right now since motion controls aren't really supported, but it is used to select which hand you as the player wish to use for GUI inputs (i.e., you will be able to use your controller as a laser pointer for the mouse as well as for object placement in building mode.)

ShowStaticCrosshair
By default this is disabled. This is the crosshair that is always on in the base game. In VR, having a crosshair out in front of you is a bit disorienting because your eyes can't focus correctly on it and stuff in the background, so you end up getting double vision images of the crosshair. Other crosshair elements are enabled and context specific, so you will tend to look directly at them and focus on them more.

CrosshairScale
You can use this to adjust the size of the crosshair, but you probably won't need to change this.

RecenterOnStart
Defaulted to true, this will cause the tracking to be re-centered on game start. You can also always re-center anytime using the Home key.

UseAmplifyOcclusion 
This is used to enable a post-processing effect I've included with the mod that can be used in place of SSAO. SSAO has a very high performance impact, which is bad for VR. You can use the built-in SSAO instead if you prefer, but I highly recommend using this instead, as the effects are very similar but the performance impact is way less severe. If you enable this, make sure you disable SSAO in the graphics menu.

RepositionKey Controls
This is a set of config options you can use to change the key binding for the keys used to reposition the head or re-center tracking

ShowRepairHammer 
This can be used to turn on and off the repair hammer icon that is used to indicate cursor position when in placement mode.

ShowEnemyHuds
You can disable enemy huds if you'd like.

EnemyHudScale
Use this to re-size the enemy huds.

Compatibility
  • This mod is almost certainly not compatible with any mods that affect the game camera, as that is central to how it works.
  • The mod is also highly unlikely to be compatible with anything that adds or modifies post processing effects
  • Mods that make changes to the GUI may not work properly, but it depends on the specifics
  • Mods that mess with the controls - probably fine but could be some issues. Feel free to report specific problems
  • Texture mods and other non-post process effect graphical mods should work.
  • Most content or gameplay mods I expect to work fine.

Known Incompatibilities:

  • Time Mod: https://www.nexusmods.com/valheim/mods/68 - Something about pausing the game while my mod is loaded causes things to lock up permanently. There was a similar issue regarding the SteamVR dashboard pausing the game. If I figure out the root cause I might be able to fix it, but for now this mod is incompatible.

More About the Mod
The mod will let you play using native Open VR support in full stereoscopic 3D. Motion controls are not yet supported, but they are in the works. Some limited GUI interactions are currently supported (you can point/click on the GUI with a laser pointer assuming you have UseOverlayGui off and you can point the placement mode stuff but it's not yet fully functional). Aside from that though, the GUI is compatible with M&K/gamepad controls.

The mod is primarily meant to be played in first person, but it does support zooming out using the mouse wheel to a third person overhead camera if you prefer. I mainly included this to help get better angles when building stuff, but play how you like :)

When in first person mode, I've made the head invisible. There are some animations that cause the character model to lunge forward sometimes, such as chopping wood. This results in seeing a headless character model lunge out in front of you. I initially had the camera tied directly to the head location, so the camera was dragged along with these animations. While more realistic in a sense, it was quite uncomfortable to be moved around in this way, not to mention other slight movements like head bobbing while walking etc. Therefore I disconnected the camera position from the head and just place it at a fixed height above the player model - this results in smooth walking and no more uncomfortable motions - with the tradeoff being that you see some goofy animations sometimes - but the tradeoff for VR comfort is definitely the right tradeoff.

As stated in the configuration section, I'm still trying to find a good programmatic way to find the exact coordinates of where the player model's head should be - right now I can get very close, but have to apply a constant offset to get it just right. As a result, based on your tracking setup, it might be offset off the character when you start the game. You can use the arrow keys to adjust the head position in game if you keep EnableHeadRepositioning turned on in the mod's config. This is not an ideal solution and I hope to be able to find a way to accurately find the center of the player model body going forward.

This is an experimental mod and almost certainly will contain a bunch of bugs and glitches. Additionally, Valheim is currently an early access game, so there is a high probability that patches will be released for the game that break this mod. Please be patient as fixes are worked on and feel free to report any issues you find :)

It should only be played seated and with a mouse and keyboard or gamepad (motion controls WIP!!!).

You should be able to play this mod in multiplayer on any server, regardless of whether or not other users on the server are using VR.

As Valheim was not made for VR, this implementation isn't going to be as comfortable as a built-for-VR game. If VR tends to make you feel queasy, then this mod probably isn't for you.

If you feel inclined to donate via Patreon, here is the official link - and if not, enjoy the mod anyways!
https://www.patreon.com/brandonmousseau

Source Code:
https://github.com/brandonmousseau/vhvr-mod