Skip to content

Expose Recording Settings in UI #8

@samuelm2

Description

@samuelm2

🎯 Problem Statement

Recording settings like capture FPS and visualization visibility are currently only configurable via Unity Inspector. Users cannot adjust these settings from within the app on the Quest headset.

Current Limitations:

  • Capture FPS is hardcoded to 3 FPS (set in Unity Inspector)
  • Visualization can't be toggled without rebuilding the app
  • No way to experiment with different capture rates in real-time
  • Users can't disable visualization if it's distracting

Current Settings:

  • Capture FPS: CaptureTimer.targetCaptureFPS (default: 3 FPS)
  • Show Visualization: DepthPointCloudRenderer.showDebugLines (default: true)

💡 Proposed Solution

Add a settings menu accessible from the Recording Menu that allows users to adjust:

  1. Capture FPS - Slider or preset buttons (1 FPS, 3 FPS, 5 FPS, 10 FPS)
  2. Show Visualization - Toggle checkbox

Where to add:

  • Extend the existing Recording Menu (Y button on left controller)
  • Add a "Settings" button that opens a settings panel

📝 Current Implementation

Capture Timer

File: Assets/RealityLog/Scripts/Runtime/Common/CaptureTimer.cs

public class CaptureTimer : MonoBehaviour
{
    [Header("Capture Timing")]
    [Tooltip("Target FPS for synchronized camera and depth capture. Set to 0 to capture at maximum rate (~25 FPS)")]
    [SerializeField] private float targetCaptureFPS = 3f;  // Currently only in Inspector
    
    public float TargetCaptureFPS => targetCaptureFPS;  // Read-only
    
    // ... rest of implementation
}

Visualization Toggle

File: Assets/RealityLog/Scripts/Runtime/Depth/DepthPointCloudRenderer.cs

public class DepthPointCloudRenderer : MonoBehaviour
{
    [SerializeField] private bool showDebugLines = true;  // Currently only in Inspector
    
    // ... used in Update() to control visualization
}

🔨 Implementation Approach

Step 1: Make Settings Adjustable

Add public methods to change settings at runtime:

// CaptureTimer.cs
public void SetTargetFPS(float fps)
{
    targetCaptureFPS = fps;
    captureInterval = (fps > 0) ? (1f / fps) : 0f;
    Debug.Log($"[CaptureTimer] FPS changed to {fps}");
}
// DepthPointCloudRenderer.cs
public void SetVisualizationEnabled(bool enabled)
{
    showDebugLines = enabled;
    if (!enabled)
    {
        ClearPointCloud();
    }
}

Step 2: Create Settings UI Panel

Create a new UI component for settings:

// NEW FILE: Assets/RealityLog/Scripts/Runtime/UI/RecordingSettingsUI.cs
using UnityEngine;
using UnityEngine.UI;
using RealityLog.Common;
using RealityLog.Depth;

namespace RealityLog.UI
{
    public class RecordingSettingsUI : MonoBehaviour
    {
        [Header("References")]
        [SerializeField] private CaptureTimer captureTimer;
        [SerializeField] private DepthPointCloudRenderer pointCloudRenderer;
        
        [Header("UI Elements")]
        [SerializeField] private GameObject settingsPanel;
        [SerializeField] private Toggle visualizationToggle;
        [SerializeField] private Button fps1Button;
        [SerializeField] private Button fps3Button;
        [SerializeField] private Button fps5Button;
        [SerializeField] private Button fps10Button;
        
        private void Start()
        {
            // Initialize UI state
            if (visualizationToggle != null)
            {
                visualizationToggle.isOn = true;
                visualizationToggle.onValueChanged.AddListener(OnVisualizationToggled);
            }
            
            // Setup FPS buttons
            fps1Button?.onClick.AddListener(() => SetFPS(1f));
            fps3Button?.onClick.AddListener(() => SetFPS(3f));
            fps5Button?.onClick.AddListener(() => SetFPS(5f));
            fps10Button?.onClick.AddListener(() => SetFPS(10f));
            
            // Hide panel initially
            settingsPanel?.SetActive(false);
        }
        
        public void ToggleSettingsPanel()
        {
            if (settingsPanel != null)
            {
                settingsPanel.SetActive(!settingsPanel.activeSelf);
            }
        }
        
        private void SetFPS(float fps)
        {
            if (captureTimer != null)
            {
                captureTimer.SetTargetFPS(fps);
            }
        }
        
        private void OnVisualizationToggled(bool enabled)
        {
            if (pointCloudRenderer != null)
            {
                pointCloudRenderer.SetVisualizationEnabled(enabled);
            }
        }
    }
}

Step 3: Add Settings Button to Recording Menu

Update the existing Recording Menu UI to include a settings button.


✅ Acceptance Criteria

  • Users can change capture FPS from within the app (1, 3, 5, 10 FPS options)
  • Users can toggle visualization on/off from within the app
  • Settings are accessible via the Recording Menu (Y button)
  • Settings changes take effect immediately (no restart required)
  • Current FPS setting is visually indicated in the UI
  • Settings persist during the session (but don't need to save between app restarts)

🎨 UI Design Suggestions

Simple Approach:

┌─────────────────────────────┐
│     Recording Settings      │
├─────────────────────────────┤
│                             │
│ Capture FPS:                │
│  [1]  [3*] [5]  [10]       │
│                             │
│ Show Visualization: [✓]    │
│                             │
│          [Close]            │
└─────────────────────────────┘

* = currently selected

Alternative: Use a slider for FPS instead of buttons


🧪 Testing

  1. FPS Changes:

    • Start recording at 3 FPS
    • Open settings, change to 5 FPS
    • Verify capture rate changes (check logs)
    • Verify files are captured at new rate
  2. Visualization Toggle:

    • Disable visualization during capture
    • Verify particles stop appearing
    • Re-enable visualization
    • Verify particles start appearing again
  3. Settings Persistence:

    • Change FPS to 5
    • Start recording
    • Stop recording
    • Start new recording
    • Verify still using 5 FPS

💭 Other possible Enhancements

  • Save settings to PlayerPrefs (persist across app restarts)
  • More granular FPS control (slider from 1-30 FPS)
  • Advanced settings (grid density, raycast distance, etc.)
  • Quality presets (Low/Medium/High)
  • Per-session settings export

🔗 Related Files

  • Assets/RealityLog/Scripts/Runtime/Common/CaptureTimer.cs (lines 14-15)
  • Assets/RealityLog/Scripts/Runtime/Depth/DepthPointCloudRenderer.cs (line 27)
  • Assets/RealityLog/Scripts/Runtime/UI/RecordingMenuController.cs (Recording Menu, likely exists)

📚 Implementation Notes

Quick Implementation Path:

  1. Add SetTargetFPS() method to CaptureTimer (~5 lines)
  2. Add SetVisualizationEnabled() method to DepthPointCloudRenderer (~5 lines)
  3. Create simple settings UI in Unity (30 minutes)
  4. Hook up buttons/toggles to call the methods

Total Time: 1-2 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions