Manipulating the Clipping Plane in VR

Manipulating the Clipping Plane in VR

emre_ergene4YJKG
Participant Participant
2,991 Views
13 Replies
Message 1 of 14

Manipulating the Clipping Plane in VR

emre_ergene4YJKG
Participant
Participant

Hi everyone,

 

We would like to manipulate the clipping plane during a VR session. Right now someone from outside can change the position and the angle of the clipping plane but it would be much more intuitive if the person with the headset can move the clipping plane. While I was researching regarding this I just saw a help page where it seems like there was a Python code for this (here). However when I follow the link, it sends me to a page where the only thing I can find is a list of Python codes I can use (Module vrClippingModule). I can see that we can build a new tool by using these functions, but it seems like there is already a tool for this. I am attaching below the screenshot of what I can see on the first help page.

 

Can anybody help me with this? Is there a tool for this already somewhere?

 

Many thanks,

Emre

 

toolsmenu_home.png

0 Likes
Accepted solutions (1)
2,992 Views
13 Replies
Replies (13)
Message 2 of 14

emre_ergene4YJKG
Participant
Participant

Hi Everyone,

 

I was just about to give up looking into editing the clipping plane dynamically in VR since there was no reply. But today I just saw this video on YouTube from 2016, almost 7 years ago, showing this interactive clipping tool, exactly the tool we are looking for.

 

I wonder, has this tool been discontinued? If so, why? Or, is the tool we see in the video something custom made by a certain company?

 

Can anybody give me an idea?

 

Many thanks,
Emre

0 Likes
Message 3 of 14

Christian_Garimberti
Advisor
Advisor
Accepted solution

Hi, what you see in the video was the first VR Tool provided for Vred. It was not inside Vred buy some python to be added manually.

From the 2018 or 2019 version it was replaced by the actual out of the box VR menu.

You can still find it here: https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/2tj0Q3UeUkNDTWj5zvg5ty.html

Note that it was written for Vred 2017, so it will be quite old...

 

I think the bast way is to write your own code to add a new feature to the vr menu following the examples you can find in the help

https://help.autodesk.com/view/VREDPRODUCTS/2025/ENU/?guid=11Tutorial-VREDPro

or

https://help.autodesk.com/view/VREDPRODUCTS/2025/ENU/?guid=11Tutorial-VREDPro

in Vr Menu section

 

Best

Chris

 

 

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 4 of 14

emre_ergene4YJKG
Participant
Participant

Hi Christian, thank you for shedding light on the subject, it is very much appreciated.

 

I have tried to download the old VR menu sample files just to have a look but, unfortunately, the links are not working anymore. Looks like we will write our own code from scratch. But I am still puzzled, why such a simple, useful and needed tool is not included on the default VR menu? Especially since there has been one written before.

 

Anyway, thanks again for the input.

 

Kind regards,
Emre

 

Message 5 of 14

__daniel.lincoln__
Alumni
Alumni

Hello,

 

I noticed if you go to the link shown at the top of the first URL that Christian mentioned, the scripts can be downloaded from there.

 

-Dan

0 Likes
Message 6 of 14

emre_ergene4YJKG
Participant
Participant

Hi Dan,

 

Great tip, I could download the file and the script from there. Will give them a go when I'm back at the office.

 

Thank you very much,

Emre Ergene

0 Likes
Message 7 of 14

vredeye
Enthusiast
Enthusiast

In the attachments only the ,py file is downloadable all others when i try to extract is throwing errors , any ideas ?

 

Attachments

0 Likes
Message 8 of 14

__daniel.lincoln__
Alumni
Alumni

Hi, select all .zip files, then right mouse options, '~Zip', 'Extract Here' should create a .vpb file.

0 Likes
Message 9 of 14

vredeye
Enthusiast
Enthusiast

yes using 7zip to unzip but getting an error 

kpmkhaja2_0-1724789073413.png

 

0 Likes
Message 10 of 14

__daniel.lincoln__
Alumni
Alumni

You are selecting 4 files, then unzip?
zip_example.png

0 Likes
Message 11 of 14

kpmkhajaC26TK
Community Visitor
Community Visitor

yes did that , thanks i got the .vpb file thanks

0 Likes
Message 12 of 14

kpmkhajaC26TK
Community Visitor
Community Visitor

thanks

not sure if this is the correct platform to ask , 

does this code work as shown in the video ? -- https://www.youtube.com/watch?v=8aCPgWggwH4

especially the "Sectioning" part ? where the user clips the car ?

as i am also analysing the code to develop another functionality is this the code where the sectioning or clipping happens ?

 

def controller0Moved():
    leftNode.setTransformMatrix( controller0.getWorldMatrix(), false)
    oldPosMenuRotate =getTransformNodeRotation(menuRotate)
    oldPosMenuScale=getTransformNodeScale(menuScale)
    touchPos = controller0.getTouchpadPosition()
    moveScaleSideways = -2.0 * touchPos.x() *touchPos.x() *touchPos.x()
    moveScaleForward = -0.05 * touchPos.y() * touchPos.y() * touchPos.y() *touchPos.y()*touchPos.y()
    setTransformNodeRotation(menuRotate, 0, 0, moveScaleSideways+oldPosMenuRotate.z())
    size = moveScaleForward + oldPosMenuScale.x()
    if size < 1.25 and size >0.75:
        setTransformNodeScale(menuScale, size, size, size)
0 Likes
Message 13 of 14

Eduardt_AlbergEZ998
Participant
Participant

Hello world,

the code snippet you provided is just the update of the controller model and some menu stuff according to the input data of the htc vive controller input. The sectioning itself happens on line ~434

    if tool == 4:
        if controller1.isTouchpadPressed():
            touchPos1 = controller1.getTouchpadPosition()
            if touchPos1.y() > -0.2:
                cMatrix = controller1.getWorldMatrix()
                clipPos = Pnt3f( cMatrix[3], cMatrix[7], cMatrix[11])
                clipNor = Vec3f( cMatrix[2], cMatrix[6], cMatrix[10])
                setClippingPlane(clipPos, clipNor, false)
            else:
                enableClippingPlane(false)

The script is very old and depending on your input controllers it may need some adjustment. If you need some further help with this i can take a short look at your setup.

best regards

vreduardt

0 Likes
Message 14 of 14

vredeye
Enthusiast
Enthusiast

yes figured it out the sectioning happens by default but only that i encountered this error

" File "<string>", line 428 SyntaxError: name 'moveSel' is used prior to global declaration" , 

But when i sorted it out i.e i declared at top , or even i commented out , the script seems to work. 

Do we need to declare here movesel at all , not sure but any way script works 

Thanks for the support

0 Likes