hyperlogic / splatapult

A 3d gaussian splatting renderer in C++ and OpenGL
MIT License
89 stars 12 forks source link

VR control does not working when using other VR headmount #9

Closed oUp2Uo closed 6 months ago

oUp2Uo commented 6 months ago

Hi, I am now trying on another VR headmount (HTC vive), but VR control does not working. Render result can be seen. Last time, the program went well on Quest 3. Do you have any idea about this? Thank you.

hyperlogic commented 6 months ago

I don't have a functioning HTC Vive to test with, but likely the issue is that the hand controllers do not have a thumbstick, but instead have those weird trackpad things. It might be possible to map the trackpad_x and trackpad_y input to stick. Here's a suggestion to fix it:

diff --git a/src/app.cpp b/src/app.cpp
index 33e5cf4..dd9d741 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -784,6 +784,12 @@ bool App::Process(float dt)
         bool valid, changed;
         xrBuddy->GetActionVec2("l_stick", &leftStick, &valid, &changed);
         xrBuddy->GetActionVec2("r_stick", &rightStick, &valid, &changed);
+
+        xrBuddy->GetActionFloat("l_trackpad_x", &leftStick.x, &valid, &changed);
+        xrBuddy->GetActionFloat("l_trackpad_y", &leftStick.y, &valid, &changed);
+        xrBuddy->GetActionFloat("r_trackpad_x", &rightStick.x, &valid, &changed);
+        xrBuddy->GetActionFloat("r_trackpad_y", &rightStick.y, &valid, &changed);
+
         MagicCarpet::ButtonState buttonState;
         xrBuddy->GetActionBool("l_select_click", &buttonState.leftTrigger, &valid, &changed);
         xrBuddy->GetActionBool("r_select_click", &buttonState.rightTrigger, &valid, &changed);

The fix might be more involved then this... I'm not sure the trackpad origin is (0,0) and I'm not sure if the trackpad origin goes back to (0,0) after your thumb is lifted from it.

oUp2Uo commented 6 months ago

This works! Thank you very much. One trackpad for moving left/right and front/back, another for rotating roll.

Btw, HTC vive is too old, and trackpad is sooo hard to use. How could they design such a control device at that time.

hyperlogic commented 6 months ago

I modified that patch a bit, I now check to see if the trackpad is "pressed" before moving the user. This should make it less prone to move if your thumb brushes up against the trackpad. Let me know if this works or not, if you get a chance.

Thanks

hyperlogic commented 6 months ago

You can re-download the zip, or build off of the main branch to get this fix.

oUp2Uo commented 6 months ago

Hi, I have tested the latest version. This latest version need to press the trackpad then move it. Last old version both pressing or not worked. I think the latest version is better, which could reduce mis-operation.

oUp2Uo commented 6 months ago

And one more thing is about the rendering speed. When using a small ply file(<100MB, like a figure/doll), the program can run >60 fps on Geforce RTX 2080 Ti. But if using a big ply file(~2GB, like a room), the program can only run ~9 fps, whcih is hard for VR. I saw an issue of gpu-radix-sort https://github.com/loryruta/gpu-radix-sort/issues/3 And I wonder if this is why having low FPS when points number is huge.

Btw, I have tried some other GS rendering program, like https://github.com/shg8/VulkanSplatting, this one can render the same big ply file very fast. (Is Vulkan a new version of OpenGL? Sorry I have no knowledege about this.)