Closed raleesound closed 3 years ago
Hi @raleesound
Thanks, and thanks for the suggestion.
Unfortunately, I don't think JkGfxMod would be much help in writing a VR port. JkGfxMod doesn't hook the executable, it just intercepts JK's original calls to Direct3D 5. Solving the first three problems you listed would require enough reverse-engineering of JK.exe that, at that point, I think you would be better off replacing the rendering code in situ rather than using an external wrapper like this one.
Potential issue, JK does all software T&L. It's not a given that you can inject the HMD matrices at all; it's not a given that you can force the game to render multiple times per frame without issue; it's not a given that you can reliably pump all of those pre-transformed triangles to the GPU every frame.
Stereo rendering: There's enough depth information in JK's pre-transformed triangles to do some things, like SSAO. You might be able to use this for a really basic (not physically accurate) parallax effect, but JK also does its own software clipping so this would look very bad near the screen edges. This is probably good enough for red-blue glasses, but it's nowhere near what you'd need for VR.
Independent camera + hands: The player thing is both the camera and the weapon projectile source, each with different offsets (controlled through a variety of ways). Much like the overrides you'd need for the camera/renderer, you'd need to override the first person weapon mesh to use the VR controller's model matrix, and somehow hook the (iirc) fireprojectile
COG verb to use the controller as the real source instead of using the source thing's position.
Altogether, this would be some fairly extensive modifications to the original game executable. It's not impossible, but the work involved is much closer to the scale of a reverse-engineering effort like OpenRCT2 than it is a wrapper like JkGfxMod.
As much as I'd like to play this, it's outside the scope of JkGfxMod. Closing.
So I know that this is almost certainly out of scope for what you are trying to do here, but would it be possible to add VR support into what you have done here? I would be interested in taking a crack at it, but I mostly wanted to know if any of this is theoretically possible with what you have created here (which is awesome, BTW) before I start spending a lot of cycles on it.
Again, really just spitballing here, but Jedi Knight really would be an incredible experience in VR, with the scale and type of movement in the game. I also see that you were working on a full source port, which would naturally be a better candidate for this type of thing, but that is also a much bigger lift than what you are doing with jkgfxmod.
In any event, I have to let you know that this work you have done here is phenomenal -- this game is a huge part of my childhood, and it has become worse and worse to try and play it over the years, to the point that I had just basically given up on it until I found your amazing mod. Thank you so much for this!