VR: Controller Based Picking #77128

Open
opened 2020-05-28 16:02:17 +02:00 by Julian Eisel · 11 comments
Member

VR: Controller Based Picking

Picking in this context means, finding which item (object, bone, vertex, etc) is being pointed at by the controller.

How to implement picking? OpenGL selection or ray casting?

(To perform OpenGL picking we would draw a controller's perspective to an offscreen buffer select based on that result.)

Few things to consider:

  • Blender has an own OpenGL selection implementation that does not use the legacy GL_SELECT.
  • Picking is not only needed for objects, but also vertices/edges/faces, bones, bezier control points, etc. Also: Gizmos.
  • Gizmos do currently only support OpenGL selection.
  • Empties, cameras, lights and other selectable items have no real geometry that can be used for ray casting. Unless that changes, OpenGL gives a more WYSIWYG selection.
  • We could in theory perform different selection methods in different modes. E.g. in Edit Mode we could do BVH accelerated selection, we have utilities ready for this.
  • Should we ever get acceleration structures for other modes that we could rely on for selection, ray casting would be much preferable, because of better scalability. Nothing like this is planned short term though.
  • Ray casting could be performed in a separate thread, especially to avoid blocking viewport drawing.
  • It's probably too expensive to perform picking on every frame. It should only be performed when needed (e.g. on trigger press). It seems like we can do some drawing tricks to visualize where the virtual controller ray intersects objects though. Needs more investigation.

How is picking executed?

What happens when pushing the trigger to select, or even select and tweak an object?
Some options:

  • Add an own operator for VR controller based selection.
  • Add a invoke_3d() callback for operators. It can wrap the existing logic, but directly hand it the 3D direction vector to use, rather than projecting the cursor from 2D to 3D space first.
  • Have a function to trigger picking, e.g. bpy.types.XrSessionState.pick() in Python. The result can be cached for multiple calls per frame.
# VR: Controller Based Picking Picking in this context means, finding which item (object, bone, vertex, etc) is being pointed at by the controller. **How to implement picking? OpenGL selection or ray casting?** (To perform OpenGL picking we would draw a controller's perspective to an offscreen buffer select based on that result.) Few things to consider: * Blender has an own OpenGL selection implementation that does not use the legacy `GL_SELECT`. * Picking is not only needed for objects, but also vertices/edges/faces, bones, bezier control points, etc. Also: Gizmos. * Gizmos do currently only support OpenGL selection. * Empties, cameras, lights and other selectable items have no real geometry that can be used for ray casting. Unless that changes, OpenGL gives a more WYSIWYG selection. * We could in theory perform different selection methods in different modes. E.g. in Edit Mode we **could** do BVH accelerated selection, we have utilities ready for this. * Should we ever get acceleration structures for other modes that we could rely on for selection, ray casting would be much preferable, because of better scalability. Nothing like this is planned short term though. * Ray casting could be performed in a separate thread, especially to avoid blocking viewport drawing. * It's probably too expensive to perform picking on every frame. It should only be performed when needed (e.g. on trigger press). It seems like we can do some drawing tricks to visualize where the virtual controller ray intersects objects though. Needs more investigation. **How is picking executed?** What happens when pushing the trigger to select, or even select and tweak an object? Some options: * Add an own operator for VR controller based selection. * Add a `invoke_3d()` callback for operators. It can wrap the existing logic, but directly hand it the 3D direction vector to use, rather than projecting the cursor from 2D to 3D space first. * Have a function to trigger picking, e.g. `bpy.types.XrSessionState.pick()` in Python. The result can be cached for multiple calls per frame.
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Author
Member

Added subscriber: @PeterK-4

Added subscriber: @PeterK-4
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Member

Added subscriber: @nfauvet

Added subscriber: @nfauvet
Contributor

Added subscriber: @RedMser

Added subscriber: @RedMser

Added subscriber: @satishgoda1

Added subscriber: @satishgoda1

Added subscriber: @kenthinson

Added subscriber: @kenthinson

Does anyone currently own this task? Or is currently working on it? My first intuition is to use the mentioned selection code already built into Blender in case it's doing any magic. Unless something prevents doing so. I would be interested in looking into it if this is not currently being owned by someone.

Does anyone currently own this task? Or is currently working on it? My first intuition is to use the mentioned selection code already built into Blender in case it's doing any magic. Unless something prevents doing so. I would be interested in looking into it if this is not currently being owned by someone.
Member

Added subscriber: @muxed-reality

Added subscriber: @muxed-reality
Member

@kenthinson Currently no one owns this task so you are free to look into it.
I submitted a patch a while ago (D13153: XR: Mouse Position Simulation) to add viewplane projection-based selection but haven't had time to update it.
You might find it helpful as a reference though, and feel free to take over the patch if you want.

@kenthinson Currently no one owns this task so you are free to look into it. I submitted a patch a while ago ([D13153: XR: Mouse Position Simulation](https://archive.blender.org/developer/D13153)) to add viewplane projection-based selection but haven't had time to update it. You might find it helpful as a reference though, and feel free to take over the patch if you want.
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:14:56 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#77128
No description provided.