Skip to content

chiragferwani/flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FLOW Logo

FLOW

Immersive VR Companion Application
Bridging real-time gyroscope head tracking, ML-based hand gesture control, and side-by-side stereoscopic rendering.

Flutter Version Dart Version Platform State Management Navigation


๐Ÿ“– Introduction & Overview

FLOW is a state-of-the-art Flutter-based immersive VR companion app. It transforms standard Android smartphones into interactive virtual reality headsets using cardboard-style goggles.

Unlike traditional mobile VR apps that offer passive viewing, FLOW combines Side-by-Side (SBS) stereoscopic video playback with dual-channel gyroscopic head tracking and ML-powered hand tracking (via front/back cameras). This allows users to see their hand skeletons overlaid in real-time on top of the video sphere and control playback through intuitive, hands-free head and hand gestures.

๐ŸŒŸ Key Features

  • ๐Ÿ•ถ๏ธ Stereoscopic SBS Viewer: Horizontally tiled eye views with horizontal and vertical translations simulating a 3D VR environment.
  • ๐Ÿ”„ Dual-Channel Gyroscopic Sensor Processing: Independent damping and sensitivity constants for viewport translation and gesture detection.
  • ๐Ÿ–๏ธ MediaPipe Hand Tracking Pipeline: Stream frames from camera, detect 21 landmarks, and paint virtual glowing skeletons inside the VR view.
  • ๐Ÿง  Gesture Recognition:
    • Head Gestures: Tilt head left (seek back), right (seek forward), up (play/pause), or down (toggle telemetry HUD).
    • Hand Gestures: Detect finger counts (2 = seek back, 3 = seek forward, 4 = play/pause, 5 = toggle HUD).
  • ๐Ÿช„ Air Touch: Spatial drawing experience using the device's camera and ML-based hand tracking. Users can draw in mid-air using a single finger, change brush colors with 2-4 fingers, and clear the canvas with an open palm.
  • ๐Ÿš€ Guided Device Validation: A three-step setup flow checking headset readiness, gyroscopic capability, and camera permissions before entering VR mode.
  • ๐Ÿ“บ Native Fallback Launch Path: Optional ExoPlayer implementation rendering spherical 360ยฐ OpenGL surfaces.
  • ๐Ÿ”’ Pilot Authorization Gate: Restricts usage based on expiration dates and optional device whitelists.

๐ŸŽฌ Runtime Demonstration

Below is a preview of the animated bootstrapping and startup experience from the loader:


๐Ÿ› ๏ธ Guided Setup Experience

Before jumping into the VR engine, users go through a strict calibration and authorization wizard to ensure their device matches the hardware requirements:

1. VR Goggles Readiness 2. Gyroscope Calibration 3. Hand Tracking Verification
Manual step explaining cardboards headset assembly. Invokes the Android sensor manager to verify the presence of rotation vector fallback sensors. Requests runtime camera permissions and launches a test screen to verify real-time landmarks.
Lottie VR Headset Lottie Head Tracking Lottie Hand Tracking

๐Ÿ—๏ธ System Architecture

FLOW is built using a modern, scalable feature-first architecture with strict isolation between core libraries, state layers, screens, and Android native integrations.

graph TD
    A[main.dart Bootstrap] --> B(Pilot Gate Validation)
    B -->|Authorized| C[GoRouter Navigation Graph]
    B -->|Expired/Unauthorized| D[Blocking System Dialog]
    
    C --> E[Loader Screen]
    E -->|Redirect 2200ms| F[Shell Router Base]
    
    F --> G[Home Dashboard]
    F --> H[Setup Wizard]
    F --> I[Play Content Library]
    F --> J[Profile Stats]
    
    I -->|Play Selection| K[VrImmersiveScreen Engine]
    
    subgraph VrImmersiveScreen Pipeline
        K --> L[SBS Video Player]
        K --> M[Gyroscope Controller]
        K --> N[Camera Image Streamer]
        N --> O[MediaPipe ML Detector]
        O --> P[Hand Overlay Painter]
    end
Loading

๐Ÿ”ฌ Core Immersive Engine & Mathematics

The primary engine (vr_immersive_screen.dart) runs a loop executing multiple tracking calculations concurrently:

1. Viewport Translation Mapping

The stereoscopic depth feel is achieved by horizontal and vertical shifting. Left and right views receive a small disparity offset:

$$\Delta x_{\text{left}} = (\text{viewYaw} - 0.02) \times 300,\text{px}$$ $$\Delta x_{\text{right}} = (\text{viewYaw} + 0.02) \times 300,\text{px}$$ $$\Delta y_{\text{both}} = \text{viewPitch} \times 200,\text{px}$$

The translation is handled inside a custom nested ClipRect + OverflowBox widget hierarchy, which allows clipping oversized videos as a relative window frame.

2. Dual-Channel Gyroscope Processing

To avoid conflicts between smooth camera navigation and strict gesture detection thresholds, events are parsed through two distinct filters:

  • Control Channel (Gesture Gating): Optimized for damping accidental minor shakes. $$\text{yaw}t = (\text{yaw}{t-1} + \omega_z \times 0.04) \times 0.85$$ $$\text{pitch}t = (\text{pitch}{t-1} + \omega_x \times 0.04) \times 0.85$$
  • View Channel (Smooth Camera): Higher sensitivity and gentler decay for natural look-around behavior. $$\text{viewYaw}t = (\text{viewYaw}{t-1} + \omega_z \times 0.06) \times 0.92$$ $$\text{viewPitch}t = (\text{viewPitch}{t-1} + \omega_x \times 0.06) \times 0.92$$

3. Finger Detection Geometry

Landmarks returned by the model are mapped using vector thresholds to check extension status:

  • Thumb Extension Rule: $$\text{isThumbExtended} \iff |x_{\text{tip}} - x_{\text{wrist}}| > |x_{\text{IP}} - x_{\text{wrist}}|$$
  • Fingers Extension Rule (Index, Middle, Ring, Pinky): $$\text{isFingerExtended} \iff y_{\text{tip}} < y_{\text{PIP}}$$ (Since coordinate space starts at the top-left, a lower Y index represents a vertically higher point)

๐Ÿช„ Air Touch Feature

FLOW introduces Air Touch, an interactive spatial drawing experience using the device's camera and ML-based hand tracking.

  • Real-time Camera Streaming: Captures low-resolution YUV420 image streams for optimized hand tracking performance.
  • Dynamic ML Hand Detection: Uses hand_detection to process frames and map 21 landmarks into a normalized coordinate space, correcting for device orientation changes on the fly.
  • Intuitive Gestures:
    • Draw (1 Finger): Extend your index finger to begin painting dynamic strokes.
    • Color Picker (2-4 Fingers): Hold 2, 3, or 4 fingers to switch brush colors seamlessly.
    • Clear Canvas (5 Fingers): Open your palm to wipe the drawing space.
  • Custom Rendering: Uses an overlay painter pipeline to visualize both skeletal hand structures and user-generated strokes in real-time.

๐Ÿ—‚๏ธ Project File Structure

flow/
โ”œโ”€โ”€ android/app/src/main/
โ”‚   โ”œโ”€โ”€ kotlin/com/example/flow/
โ”‚   โ”‚   โ”œโ”€โ”€ MainActivity.kt        # Method channel handlers & sensor verification
โ”‚   โ”‚   โ””โ”€โ”€ VRPlayerActivity.kt    # Native Android Media3 Spherical Video Player
โ”‚   โ”œโ”€โ”€ res/layout/
โ”‚   โ”‚   โ””โ”€โ”€ activity_vr_player.xml # spherical_gl_surface_view rendering surface
โ”‚   โ””โ”€โ”€ AndroidManifest.xml        # Permission locks & Activity registration
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ fonts/                     # NASA, Geist, and GeistPixel fonts
โ”‚   โ””โ”€โ”€ images/                    # SVGs, animations, and app icons
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ main.dart                  # App bootstrap and orientation locks
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ constants/             # Centralized strings
โ”‚   โ”‚   โ”œโ”€โ”€ native/                # VRChannel method interface
โ”‚   โ”‚   โ”œโ”€โ”€ providers/             # Riverpod providers (pilot, theme, profile)
โ”‚   โ”‚   โ”œโ”€โ”€ router/                # App navigation configuration
โ”‚   โ”‚   โ””โ”€โ”€ theme/                 # AppColors, radii, spacings, and theme definitions
โ”‚   โ”œโ”€โ”€ features/
โ”‚   โ”‚   โ”œโ”€โ”€ home/                  # Dashboard and quick actions
โ”‚   โ”‚   โ”œโ”€โ”€ loader/                # Startup splash animation
โ”‚   โ”‚   โ”œโ”€โ”€ play/                  # Immersive video player engine
โ”‚   โ”‚   โ”œโ”€โ”€ profile/               # User analytics and metrics
โ”‚   โ”‚   โ”œโ”€โ”€ settings/              # Configurations and theme toggles
โ”‚   โ”‚   โ”œโ”€โ”€ setup/                 # Calibration and test screens
โ”‚   โ”‚   โ””โ”€โ”€ shell/                 # Bottom navigation shell route layout
โ”‚   โ””โ”€โ”€ shared/widgets/            # Reusable components (GlassPanel, PilotBadge)
โ””โ”€โ”€ pubspec.yaml                   # Flutter dependencies declaration

๐Ÿ“ฆ Key Libraries Used

Package Version Purpose
flutter_riverpod 2.5.1 Decoupled reactive state management
go_router 13.2.0 Declarative deep-linking navigation
sensors_plus 6.1.1 Gyroscopic motion rate listeners
hand_detection 3.0.7 MediaPipe model processor interface
camera 0.11.0+2 Image stream frames pipeline
shared_preferences 2.2.3 Local persistent cache for step completion

๐Ÿš€ Getting Started

Prerequisites

  • Flutter SDK version โ‰ฅ 3.5.0
  • Android SDK setup with Min SDK level 23 (Marshmallow)
  • A physical Android device containing a hardware gyroscope sensor and a functional back camera.

Run / Build Commands

  1. Clone the Repository:
    git clone https://github.com/your-username/flow.git
    cd flow
  2. Fetch Dependencies:
    flutter clean
    flutter pub get
  3. Run Development Build:
    flutter run
  4. Assemble Release APK:
    flutter build apk --release

๐Ÿ”ฎ Future Enhancements

  • ๐ŸŽจ Barrel Distortion Shaders: Simulating physical fish-eye lenses to compensate for cardboard lenses.
  • ๐Ÿ“ Calibration UI: Add screen-space sliders inside the HUD to alter yaw/pitch sensitivities and hand overlay translation multipliers.
  • ๐Ÿ•ถ๏ธ 3D Stereoscopic Hand Projection: Translate 2.5D coordinates to complete 3D vectors mapping real depth distances.
  • ๐ŸŒ Cloud Video Library: Stream user-uploaded content directories rather than hardcoded mock feeds.

Made with ๐Ÿฉถ for immersive exploration.

About

where motion meets reality

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors