LogoLogo
Sign in to Leia Developer Portal
  • LeiaSR™ Documentation
  • LeiaSR SDK
    • LeiaSR™ Native SDK Guide
  • Unity Plugin
    • LeiaSR™ Unity Plugin Guide
      • Getting Started
      • Project Setup
      • Scene Setup
      • LeiaDisplay Component
        • Selecting Objects
        • Worldspace UI Canvas
      • Quick API
      • Extensions
        • Model Viewer Sample Scene
        • Android Live Preview: Leia Remote 2
        • Auto Focus
          • LeiaRaycastFocus
          • LeiaTargetFocus
          • LeiaDepthFocus
      • Content Design
        • Optimizing Object Placement
        • UI and Depth Violations
        • Depth of Field
        • Backgrounds
      • Render Pipeline Support
  • Unreal Plugin
    • Unreal SDK Guide
      • Getting Started
      • Manual Download And Import
      • Scene Setup
      • Quick API
      • Extensions
        • Android Live Preview: Leia Remote 2
      • Required Project Settings
      • Required Build Settings: Android
      • Content Design
  • NEURD SDK
    • NeurD SDK Guide
Powered by GitBook
On this page
  1. Unity Plugin
  2. LeiaSR™ Unity Plugin Guide
  3. Extensions
  4. Auto Focus

LeiaRaycastFocus

PreviousAuto FocusNextLeiaTargetFocus

LeiaRaycastFocus

Pros:

  • Fast

  • Accurate

  • Easy to use

  • Doesn't require using shaders which write to the depth buffer (unlike ).

Cons:

  • Requires colliders to be setup properly in the scene for auto focus to work properly.

  • Physics simulation can be more expensive on performance, depending on sample count.

The LeiaRaycastFocus component uses raycasting to determine the distance to visible objects in the scene, and then uses that information to determine a suitable focal distance and depth factor for the LeiaDisplay.

Unique Parameters:

  • Max Raycast Distance

    • The maximum distance the auto focus algorithm is allowed to raycast to collect sample points. Note that if this is smaller than the focal distance range max value, then it will take precedence over the focal distance range max value when determining the max focal distance.

  • Samples

    • How many raycast samples to take to use in calculations determining the depth factor and focal distance. More samples will yield more accurate results but be more expensive performance-wise.

  • Show Debug Raycasts

    • Show debug rays in the scene editor.

LeiaDepthFocus