OpenXR/OpenVR (virtual reality support), new Python workbench WiP

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: OpenXR/OpenVR (virtual reality support)

Post by realthunder »

kwahoo wrote: Sat Sep 12, 2020 7:20 am Do you mean mixed reality? Because in VR room scale locomotion does work for a while. That's why my test project is a simple room Fcstd Video

There is not collision detection, but I fell it would be more distracting than useful.
Not really, I just mean to have a room with better graphics.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
T33
Posts: 11
Joined: Sun Oct 11, 2020 8:55 am

Re: OpenXR/OpenVR (virtual reality support)

Post by T33 »

Hi kwahoo,

Thank you for all your great work on adding OpenXR support!

It seems that the last update post and pre-release build of the git repo ( https://github.com/kwahoo2/FreeCAD ) were more than 2 months ago. So development seems to have stopped/slowed down and the build of current features (e.g working HMD) looks stable ( https://www.youtube.com/watch?v=K8pXt4s0YU4 ).

I thought it might be a good idea to push the current changes to the mainline so that everyone can use it with the latest features/version.
A 'smaller' commit would also make it easier to review and see what has been added. It would also allow other people ( like me ) to implement additional stuff like edit capability in VR.

Side note: If controller support is still missing we can add that later, since there are many controllers out there (Xbox 360/One, Playstation, Oculus Touch, Vive wand, Hydra's etc, WII motes and other custom things).
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Post by kwahoo »

T33 wrote: Mon Oct 12, 2020 6:34 am So development seems to have stopped/slowed down and the build of current features (e.g working HMD) looks stable
This is because I've started working on a different things lately, and I'm going to return to XR view development later. I still listen for a feedback. The truth is: I have no idea if the code works for others at all. There is no point mainlining not tested code. For testing, there is a preview release.

Also, should I make pull request for OpenXR view or the OpenVR one? Which one gives more compatibility (listening feedback here)? Is there a hardware that supports OpenGL+OpenVR but does not support OpenGL+OpenXR? OpenXR was supposed to be THE VR standard, but current implementations are limited. I cannot even run OpenXR on Nvidia+Linux, because of lack of asynchronous reprojection.

Finally, after seeing how slow is mainline FreeCAD rendering, I'm going to wait for LinkStage3 merge.
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Post by kwahoo »

realthunder wrote: Sat Sep 12, 2020 9:09 am Not really, I just mean to have a room with better graphics.
Btw, do you still use these Xenial/Bionic scripts as the base for your Appimages? I would like to build a custom Appimage based on LinkStage3 brach, but I have to disable Python2/QT4 part and move to Focal, since XR libraries do not exist in older Ubuntu releases.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: OpenXR/OpenVR (virtual reality support)

Post by realthunder »

kwahoo wrote: Sun Oct 25, 2020 2:26 pm Btw, do you still use these Xenial/Bionic scripts as the base for your Appimages? I would like to build a custom Appimage based on LinkStage3 brach, but I have to disable Python2/QT4 part and move to Focal, since XR libraries do not exist in older Ubuntu releases.
No, that is for debian packages. The AppImage scripts are here.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Post by kwahoo »

realthunder wrote: Sun Oct 25, 2020 9:51 pm
No, that is for debian packages. The AppImage scripts are here.
Thanks, unforunately I cannot get it working (using your repository for testing):

Code: Select all

+ test conda-fc-dev
+ docker_name=conda-fc-dev
++ date +%Y%m%d
+ date=20201026
+ conda_img_name=FreeCAD-img-Conda-Py3-Qt5-20201026-glibc2.12-x86_64
+ cat
+ bash -c ' docker build -t conda-fc-dev -f tmp.dockfile'
"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: OpenXR/OpenVR (virtual reality support)

Post by realthunder »

kwahoo wrote: Mon Oct 26, 2020 10:42 pm Thanks, unforunately I cannot get it working (using your repository for testing):
Should be fixed now.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Post by kwahoo »

I would like to show a very simple way to get basic creation/modification support in VR using doCommand:
https://forum.freecadweb.org/viewtopic.php?f=10&t=17944
https://wiki.freecadweb.org/Command

Small example, adding a box, when trigger is pressed:
phpBB [video]


Code added in CoinXRWidget.cpp:

Code: Select all

    
#include "PreCompiled.h"
#include "CoinXRWidget.h"

#include "Base/Exception.h"
#include <Base/Console.h>       

#include <Command.h>
#include "Application.h"
#include "Document.h"

           (...)
           
            SbRotation conZrot = SbRotation(conZaxis, xaxis);
            SbRotation padrot = SbRotation();
            padrot = conXrot * conZrot;
            padrot.scaleAngle(0.5f * movSpeed);
            transfMod->rotation.setValue(padrot);
            worldTransform->combineRight(transfMod);
        }

        /***** testing command invocation ***/
        if (currTriggerVal[i] > 0.5 && oldTriggerVal[i] <= 0.5)
            {

            double l = 100.0;
            double w = 100.0;
            double h = 100.0;

            App::Document* doc = App::GetApplication().getActiveDocument();
            QString cmd = QString::fromLatin1("box = App.getDocument('%1').addObject('%2','%3')\n"
            "box.Length = %4\n"
            "box.Width = %5\n"
            "box.Height = %6\n"
            "box.Placement.move(App.Vector(%7, %8, %9))\n"
            )
            .arg(QString::fromLatin1(doc->getName()))
            .arg(QString::fromLatin1("Part::Box"))
            .arg(QString::fromLatin1("Cube"))
            .arg(l)
            .arg(w)
            .arg(h)
            .arg(conTrans[i]->translation.getValue()[0] * 1000)
            .arg(conTrans[i]->translation.getValue()[1] * 1000)
            .arg(conTrans[i]->translation.getValue()[2] * 1000);

            Gui::Command::doCommand(Gui::Command::Doc, cmd.toUtf8());
            doc->recompute();
        }
        oldTriggerVal[i] = currTriggerVal[i];
        /***** ***/

tran10 wrote: ping
Of course such hard-codding have no sense. But an user could make his own (editable) Python script for interaction, and pass values to the script using doCommand.

Edit: I did some experimentation in the XRInteraction.cpp https://github.com/kwahoo2/FreeCAD/comm ... b0f245281d

Update: above code may crash, because it seems you should not call Python from another thread https://forum.freecadweb.org/viewtopic. ... =10&t=2597

Edit 2:
I added ray for picking objects. It draws a red sphere where an object is hit https://github.com/kwahoo2/FreeCAD/comm ... dca3002fac
Image
chrimu
Posts: 10
Joined: Tue Aug 03, 2021 6:27 pm
Location: Beersel (Belgium)

Re: OpenXR/OpenVR (virtual reality support)

Post by chrimu »

Dear All,

I'm pretty novice to FreecadOpenXR, and installded Kwahoo's win64 version next to SteamVR. WMR and StemVR run flawlessly. I came to have the video-part running, but I don't get the controllers to move at all (Lenovo WMR) in Freecad. The controller (one only) lays on the ground and doesn't move along with my physical controllers.

Do you know of settings or software that could be missing or improved? Sorry to disturb you with this, but many-many searches and blind attempts didn't help...

Kind regards, C.
Post Reply