Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.2.6 crashes and 4.0.0 a3 is too slow/visual artifacts #98

Open
Corsair427 opened this issue Jun 4, 2020 · 12 comments
Open

Version 3.2.6 crashes and 4.0.0 a3 is too slow/visual artifacts #98

Corsair427 opened this issue Jun 4, 2020 · 12 comments
Labels
performance Issues related to performance (FPS, graphical anomalies, etc.)

Comments

@Corsair427
Copy link

So im stuck in between a rock and a hard place. the version that works completely smooth and with no texture disagreements is 3.2.6 however on launching a rocket, as soon as I enable VR mode it crashes. If i load a game in orbit it works fine for 30 seconds to a few minutes. Im using KSP 1.9.1. Version 4.0.0 a3 is way to slow and the camera is nowhere near as stable its almost unplayable and there are massive texture conflicts from orbit. For now i would love to get 3.2.6 working. Ive tried a slew of things such as a clean stock game and the crashing issue is still the same. Does the mod manager version have an effect?

@Vivero
Copy link
Owner

Vivero commented Jun 4, 2020

Yikes, that doesn't sound too good. Unfortunately, KerbalVR 3.2.6 is doomed to crash randomly, due to how it is coded. The crashing is unrelated to mod manager version, or any other mods. The solution to crashing is the new rendering architecture in KerbalVR version 4.0.0.

But I'm surprised KerbalVR v4.0.0a3 is less smooth than v3.2.6. In my testing, v4 runs much much more smoothly than any previous version. Can you attach a copy of KSP.log here so I can take a look? That may provide further clues.

What VR system and controllers are you using?

@Vivero Vivero added the performance Issues related to performance (FPS, graphical anomalies, etc.) label Jun 4, 2020
@Corsair427
Copy link
Author

How do I get you the .log file?
I am using Samsung Osyssey Plus WMR tied into steam VR.

So yeah 3.2.6 at full graphics and with EVE and Astronomers pack runs with zero lag, rock steady camera and no weird orbital texture issues. I can deal with crashes but on launch its almost immediate. Plus its a dream with the clickable cockpit. Its an amazing adaption and really appreciate the work you are doing.

@Vivero
Copy link
Owner

Vivero commented Jun 4, 2020

Look in the directory where KSP is installed. On my system, it's C:\KSP_win64\KSP.log. If KSP is installed through Steam, you might find it here: C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP.log (or something like that, I'm not 100% sure).

@Corsair427
Copy link
Author

I think I got it
KSP.log

@Vivero
Copy link
Owner

Vivero commented Jun 4, 2020

Hmm... now I'm surprised this is working at all 😅 So looks like this KSP.log was generated when you ran with KerbalVR 3.2.6. I believe you ran with the -force-opengl flag, right? I know this used to be absolutely necessary some time ago, but for KSP 1.9.1+KerbalVR 3.2.6, you no longer need to run with any flags. Did you enable VR during this run? Because it seems like VR failed to initialize in the first place, which would make it impossible to activate VR at all.

Let's try another thing, run KSP with KerbalVR 4.0.0a3, make sure to load a flight, go into IVA, enter VR, then quit, exit the game etc. Then attach the KSP.log here again so I can take a look.

@Corsair427
Copy link
Author

Ahhh, I have been messing with this for hours trying a various number of things, youre right it doesnt work with the flag but I had to try it lol ill re upload with both working versions

@Corsair427
Copy link
Author

Okay heres ran with both
KSP 3.2.6.log
KSP 4.0.0 a3.log

@Vivero
Copy link
Owner

Vivero commented Jun 4, 2020

So far I'm not seeing anything unusual, however it seems like both logs get cut off... I am not seeing the log lines that say "VR is now turned on". Usually when I quit the game via the "X" button on the window, the log gets cut off and I lose like the last several minutes of log information.

When you quit the game, did you use the X on the window? If so, try instead going through the KSP menus (exit to Main Menu, Quit Game, etc)

@Corsair427
Copy link
Author

Alright I redid both and quit the normal way
KSP 3.2.6.log
KSP 4.0.0 a3.log

@Corsair427
Copy link
Author

I did alot of testing with 3.2.6 last night starting with my graphics all the way down, I ran the sim and did a sub orbital flight, it did not crash. I upped the graphics each time by a bit running the sim until it crashed again. It seems for me at least the crashes are tied to graphical settings. I re ran 4.0.0 a3 at minimal graphics and the lag is still present, no changes really but a few frames. Not sure if this helps you in coding or possibly coming up with a fix.

@Vivero
Copy link
Owner

Vivero commented Jun 4, 2020

Ok I looked at the logs, and I'm afraid nothing really looks out of the ordinary...

TLDR: I don't have a good short-term fix for your specific issues.

Re: crashing on KerbalVR 3.2.6, you may try this sub-optimal workaround: run KSP with the flag -force-gfx-direct. I think this will prevent the crashes from happening, at the cost of reduced frames per second.

This kind of perf issue requires a lot of deep dive, because you're mixing a ton of other mods that I haven't tested thoroughly for compatibility. You'll need to narrow down which mod is the problematic mod, to answer questions like, how does KerbalVR run on your system with stock KSP (no other mods), how do graphics settings impact VR performance, if I add other mods one by one, which one breaks VR? etc.

I did some quick testing with installing Astronomer's Pack (and its other required mods), and I can already tell there are some inherent incompatibilities, which might explain the visual artifacts you might see (though some screenshots would be helpful to understand this issue better).

If you want to get real technical:

I believe some of these graphics enhancement mods attach some Camera objects to KSP's existing flight cameras, to apply special effects like atmospheric glow and other shader trickery. KerbalVR 3.x.x manipulates the position of flight cameras directly, moving them to each "eye" position, calling the Render() function to generate the texture, and then making the OpenVR API calls that send that texture to your headset. And this texture frame will include all the graphical enhancements from other mods. However, all this happens on the main processing thread. Direct3D11 is multi-threaded, and thus shares access to the textures from the main thread. This unfortunately causes sporadic Access Violations and crashes the game. Using the flag -force-gfx-direct makes the rendering single-threaded, so there are no Access Violations from multi-threaded sharing. However, you lose the benefits of increased perf from multi-threaded rendering.

KerbalVR 4.x.x fixes the multi-threaded issue by offloading the OpenVR API calls to a plugin that runs solely on Unity's render thread. This plugin runs at the end of every Update frame, after the main thread has positioned all of the game cameras. At the end of the Update frame, the plugin sends the rendered textures to the VR headset. Because positioning the cameras happens on the main thread, and rendering the cameras happens on the rendering thread, this poses the problem of being unable to manipulate KSP's cameras directly to render two separate eye textures in a single Update frame. The best solution I could come up with was to make a duplicate set of cameras (one for each eye) that mimic KSP's flight cameras. However, I'm unable to duplicate all of the "extra" effects cameras that are created by the other mods. There is some under-the-hood coupling between these special effects cameras and the flight camera that I do not understand, and am unable to replicate. This is the same reason why I can't get atmospheric re-entry effects from rendering in VR in the stock game.

@Corsair427
Copy link
Author

Alright so the gfx direct flag fixed the crashing im at full graphics and though there is some frame drops its completely playable and nowhere near as bad as 4.0.0......that being said i will post screenshots of the 4.0.0 texture issues,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Issues related to performance (FPS, graphical anomalies, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants