Skip to content

Add ray_renderer to src/renderer for visualizing input rays and collision cursors #343

@yorkie

Description

@yorkie

Background

To enhance XR interaction and debugging, we need a dedicated renderer that can visualize rays (Ray) and collision cursors based on current input sources and the scene's depth buffer.

Proposal

  • Implement a new ray_renderer module in src/renderer.
  • The renderer should maintain multiple Rays, each representing an input/collision ray.
  • For each frame, it should:
    • Fetch the currently active input sources.
    • Retrieve the target ray from each input source for collision detection.
    • Based on the ray and the current FBO's depth buffer, draw:
      • The rays (lines in 3D)
      • The collision cursor at the intersection point (with option to use a configurable cursor image)
  • The ray_renderer should allow configuring the cursor image/appearance.

Technical Notes

  • Integration with the input system is needed to pull updated target rays.
  • Depth buffer readback should be considered (possibly via glReadPixels or shader-based raymarching if performance is a concern).
  • The renderer should be able to support multiple simultaneous rays (e.g., for multi-controller/multi-hand scenarios).

Acceptance Criteria

  • src/renderer/ray_renderer.* implements the above logic
  • Can visualize rays and collision cursors in the XR scene
  • Configurable cursor image/appearance
  • Supports multiple input sources
  • Hooked up to the main render loop for real-time updates

Related

  • Input system (for input source & target ray)
  • Depth buffer (for collision/cursor placement)

This will help with debugging and future user interaction features in JSAR.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions