From Julia to VR

Hi all,

I am not quite sure this is the best place for this discussion so fee free to let me know and I’ll move that somewhere more appropriate if needed.
Put simply, I want to know if there exists already or if some people have been thinking of developing some Julia tools to create VR content from Julia data and visualizations. Note that I haven’t looked at or thought through the feasibility or scope of what this would entail but I think it would be quite awesome, in the literal sense.

For instance, in a utopia world, I would love to be able take my GLVisualize rendering (e.g. an animation of the rotating earth with a constellation of satellites orbiting it) and magically port it to a VR environment (and I don’t mean a “Julia” VR environment – although that would be sick – but porting it to already commercially available devices)

Cheers,
Loic

4 Likes

Are you envisioning this as an offline process where you export your rendering and import it into VR, or an online process where you can have your HMD as a target device for your rendering?

The offline case, the easiest solution would probably be to export your model and import it into a game engine like Unreal and display it in VR that way. It’d mostly be just finding an export format that your game engine of choice supports.

For online it’d require a bit more work but you could link in OpenVR and expose that for GLVisualize. At the simplest level OpenVR will give you two camera matrices (one per eye) per frame and you just pass back the rendered frame for those matrices. Some sort of OpenVR.jl could be very interesting where in Pseudocode you’d be able to do something like this:

using OpenVR

InitializeOpenVR()
RegisterEyeCallback( MyRenderFunction )
StartOpenVRAsync(<some HMD parameters>)

<Your logic runs here>

The Async thread will just on every frame query your callback and render it to the HMD. Doing it along these lines your could wrap any drawing code and as long as it returns some image for the eye it’d work fine.

Loic, there is a version of Paraview which works with VR setups:
https://blog.kitware.com/taking-paraview-into-virtual-reality/

I guess you then ask how that can relate to Julia! A Google search turns up:
https://github.com/jipolanco/WriteVTK.jl

2 Likes

Good question – I think the offline approach could be a first step but the online case sounds more appealing, of course :slight_smile:

I like where you’re going with that pseudocode, I don’t have the time (or knowledge for that matter) to take that on but that’s definitely something to look at and keep in mind.

Thanks!

@John_Hearns Oh the ParaView road looks interesting as well. I’ve played a tiny bit with VTK stuff in Julia so I could see that being of interest.

Thanks!

Wrapping OpenVR would be awesome! That indeed would be mostly it to bring GLVisualize renderings to a VR headsets - at least to get basic scene display working. Complete immersion with all the fancy tricks will be a bit more involved, but maybe OpenVR offers some help there.

We will need to pay attention to latency, but I think I’m on a pretty good way in Visualize.jl to cut down latency.
I can move the rendering almost completely to the GPU - Which is great, since it means the CPU isn’t involved as much anymore and the GC can’t actually stop what’s executing on the GPU.
We just need to figure out if we can synchronize the GC, so that it get’s scheduled while the GPU is busy rendering.

2 Likes

Any update on this? I’m just starting to discover Julia but I’ve been working in VR (and AR) for a couple of years now. I think the easiest way would be to have the dataset generated from your processing done in Julia to a standard exchange format e.g. JSON then visualize it in VR. There are quite a few visualization tools out there for that e.g. https://github.com/mustafasaifee42/vr-viz

What could be more interesting but also more challenging is indeed as some are suggesting in this thread to directly make Julia work in VR. Here again I can see as a bridge https://github.com/rdeits/MeshCat.jl which I think would be especially interesting for pair exploration. One person is in VR visually exploring a model or dataset while a partner would be on the computer parsing and visualization the data with Julia code.

I have written [my very first lines of Julia toda (JuliaBox first tutorials) so I won’t pretend I can help but I’m happy to explore!

1 Like

I’m curious if anything has happened in this space. I’d love to be able to make some of my 3D Makie.jl visuals available on a VR headset. It’s really nice being able to view them in an electron window, zoom, pan, etc., but it would be amazing if the next time my boss asks me to do an analysis I could just show up with a VR headset and say “Here it is” :smiley:

2 Likes

I’m waiting on my Valve Index kit to arrive (probably will be a few weeks due to their production backlog), and when it does I plan to setup a Julia OpenVR wrapper (if one doesn’t already exist), as well as some examples for using the headset.

5 Likes

When did you order? I ordered on March 20, just got it a few days ago. Well worth the wait though, really great hardware.

1 Like

I ordered mine on May 12th, so I guess I’m almost 2 months away from expecting to receive it. I’m really looking forward to using it, though! What platform are you using it with?

1 Like
➤ inxi -MGS
System:    Host: boondoggle Kernel: 5.4.44-1-MANJARO x86_64 bits: 64 Desktop: Gnome 3.36.3 
           Distro: Manjaro Linux 
Machine:   Type: Desktop System: Gigabyte product: X399 DESIGNARE EX v: N/A serial: <root required> 
           Mobo: Gigabyte model: X399 DESIGNARE EX-CF v: x.x serial: <root required> UEFI: American Megatrends 
           v: F11 date: 10/04/2018 
Graphics:  Device-1: NVIDIA TU102 [GeForce RTX 2080 Ti Rev. A] driver: nvidia v: 440.82 
           Display: x11 server: X.org 1.20.8 driver: nvidia resolution: <xdpyinfo missing> 
           OpenGL: renderer: GeForce RTX 2080 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA 440.82 

Index + Manjaro + AMD is… adventurous :slight_smile:

Performance is a little quirky, mostly it can jump around a bit until a game is entirely loaded into RAM. But I’m also running a lot of things through Steam Play or Proton. OTOH Half-Life Alyx is really well-done and a lot of fun (but much scarier than I expected. And Beat Saber is ridiculously smooth, so that’s a lot of fun. Oh, and Elite Dangerous is much easier in VR, since you can look all around you.

In case you haven’t seen it already, this helped a lot with the long wait:
https://www.reddit.com/r/ValveIndex/comments/ffr50u/availabilityorder_megathread_march_9th/

2 Likes