Page MenuHome

Open, NormalPublic


Dear Blender Team,

First of all, please excuse our slow and clumsy navigation of proposing code. This is our first time to do so.

We're the developers of MARUI-Plug-In, a popular VR/AR/XR user interface for Autodesk Maya
( )
over the years, we have been repeatedly asked by Blender users to make a similar plug-in for Blender.
We'd be happy to do so, but rather than a clumsy plug-in we'd like to make the UI free and open for everyone to use.
Therefore, we have created BlenderXR - a simple abstraction layer that allows using common current VR headsets.
This is a temporary work-around to start working on the user interface until OpenXR will become available - then we propose switching to OpenXR and abandoning BlenderXR.
The complete user interface functionality is inside the Blender code base and can be retained.
Including BlenderXR is not required. It is an optional addition for users who want to use Blender in VR/AR/XR.

The attached patch was created based on to the blender2.8 branch,
commit fd2ffb0b9e674a5edefa159d086d6a64edb3abe5 of 2018-10-11 10:24:38.

Please let us know your opinion.
We hope we can continue contributing and provide a complete and powerful VR user interface, similar to what MARUI is for Maya.

Best regards,



Event Timeline

Hi Max,

thanx for your efforts! These are much appreciated.
Could you create a Differntial here: ?

This will make review much easier.

Philipp Oeser (lichtwerk) triaged this task as Normal priority.Oct 11 2018, 9:29 AM

Give it is based on 2.8, may i recommend uploading the diff with arc?

@Philipp Oeser (lichtwerk)
Thank you!
I have selected "Create a Patch Task" because I thought the description fitted our patch better.
Now I also tried to create a diff but I'm getting the error
"Uploaded file is too large: current limit is 8M. To adjust this limit change 'upload_max_filesize' in php.ini."

@LazyDodo (LazyDodo)
Thank you! I didn't know about arc before. I'll look into it.

I'd also like to add a quick description of the proposal:

BlenderXR Developer Proposal

List of Modified Files:

    line 538: Uninitialize VR and unload the VR shared library functions when the
      VR mirror window is closed.
  NEW FUNCTION: wm_window_new_vr_exec()
    line 1016: Create a new VR mirror window. The VR mirror window is a "main" BlenderXR
      window that contains the VR viewports used for blitting the HMD. When this function
      is called from clicking on the "Window->New VR Window" menu option in the Blender
      editor, the current window context is copied into a new window and an attempt is
      made to load the VR shared library functions and initialize VR. If successful,
      the window is created and left as-is, otherwise the window is immediately closed.
    line 1676: If the VR mirror window exists (VR is running), don't sleep the
      main thread when there are no window events (normally sleeps 5 ms).
      This is done to improve VR performance.

    line 147: Hide some viewport 2D overlays (text, cursor, etc.) because they are distracting
      and additional modifications would be necessary to render them properly in VR.
      line 282: Prevent the VR viewports and offscreen buffers from being undesirably freed
        on window resize events, window stereo changes, etc. as VR rendering does not depend
        on window size and other related settings.
    line 545: Create VR offscreen buffers and viewports if necessary and draw to the VR
      viewports / render targets. This is also where VR tracking information is updated
      and VR interaction with the Blender scene is performed.
    line 645: Blit the HMD from the VR viewports and also blit the VR mirror window.
    line 877: Always update (redraw) the VR mirror window that contains the VR viewports.
      This is done to ensure that the VR eye textures are continuously updated.

    line 1490: VR pre-scene render (for setting up view and projection matrices for each eye).
      Must be called before drw_engines_draw_background();
    line 1525: VR post-scene render (for drawing VR controllers and UI elements).
      Must be called after ED_region_draw_cb_draw() and should be called before drw_engines_draw_scene();

    line 157: Compute the VR camera viewplane / parameters for each eye.

  void view3d_viewmatrix_set()
    line 810: Compute the VR view matrix for each eye.

  line 327: Added a new RegionView3D rflag definition (RV3D_IS_VR) to identify if a given
    viewport is a VR viewport.

GPU_viewport.h (gpu_viewport.c)
  line 57: Moved the "GPUViewport" struct definition from its previous location in gpu_viewport.c.
    This is done to access the framebuffers corresponding to the VR viewports when blitting the HMD.

GPU_framebuffer.h (gpu_framebuffer.c)
  line 54: Moved the "GPUAttachmentType" enum and "GPUFrameBuffer" struct definitions
    from their previous locations in gpu_framebuffer.c. This is done to access the
    OpenGL textures for the VR viewports when blitting the HMD.

GPU_texture.h (gpu_texture.c)
  line 171: Moved the "GPUTexture" struct definition from its previous location in gpu_texture.c
    This is done to access the OpenGL texture bind codes for the VR viewports when blitting the HMD.

  line 159: Temporarily removed a "DEBUG" assertion.

  line 47: Temporarily turned off "TRUST_NO_ONE" assertions.

  line 37: Added "#ifdef __cplusplus" brackets to allow being included by VR .cpp files
    for GPU rendering.

  line 31: Added "#ifdef __cplusplus" brackets to allow being included by VR .cpp files
    for GPU rendering.

  line 31: Added "#ifdef __cplusplus" brackets to allow being included by VR .cpp files
    for GPU rendering.

  line 31: Added "#ifdef __cplusplus" brackets to allow being included by VR .cpp files
    for the VR gpencil annotation widget.

  line 31: Added "#ifdef __cplusplus" brackets to allow being included by VR .cpp files
    for the VR gpencil annotation widget.

Descriptions of Blender VR module (bf_vr) files:

  This is a temporary "build header" used to toggle VR modifications and aid in debugging.

  Contains the definition for the "VR" struct, which holds all VR device, tracking,
    and status information.

  The main VR module. Handles VR initialization/un-initialization and loading/unloading
    of external VR shared libraries.

  Serves as an internal "export" header for sending VR UI C++ functions to vr_main.c
    and other C areas of Blender that may want to access these functions.

  Contains macro, enum, and struct definitions used internally by the bf_vr module.

vr_draw.h (vr_draw.cpp)
  Contains OpenGL-related utility functions for drawing VR UI elements.

vr_math.h (vr_math.cpp)
  Contains math-related utility functions relevant to VR.

vr_ui.h (vr_ui.cpp)
  The VR user interface module. Controls VR navigation, interaction, and drawing of
    VR UI elements.

vr_widget.h (vr_widget.cpp)
  Base module for the VR UI widget system. Contains implementations for the VR widgets
    that interact with the Blender scene (for example, navigation, selection, and annotation).

vr_widget_layout.h (vr_widget_layout.cpp)
  Contains definitions for device-unified button identifiers as well as default device-specific
    widget-to-button mappings.

I hope this makes things more clear.

HI Max!

I´m Daniel Martinez Lara, one of the members of Grease Pencil Team: Thanks so much for share this, I know that is just a basic implementation but great see the potential of Grease Pencil and VR, I made this video just to test it


@Daniel Martinez Lara (pepeland)
Hi Daniel!
Thank you so much for your message and video!
I just shard it with the team - we're all happy and honored you enjoyed drawing in VR.
Also thank you so much for the awesome Grease Pencil feature!
By the way: you can also erase lines by holding the "SHIFT" button on your controller (the "A" button on the right controller) and the trigger button at the same time.

Best regards,