Mirror Demo
Overview
The Mirror Demo, located in ExampleScripts - Mirror_Demo, allows you to view your reflection in a virtual mirror in VR. It includes features such as:
- Avatar swapping
- Facial expression tracking
- Body and hand tracking
- Customizable environments
- Adding a reflective mirror object
Additionally, facial expression data can be saved and analyzed later. The demo is part of SightLab, accessible under ExampleScripts - Mirror_Demo.

-
Configure Settings
Edit the MirrorConfig.py file to customize the following parameters:
swapAvatarKey: Key to advance media (default:'c').UseExternalPath: Set toTrueto use a custom path for avatars (head and hands). The full body uses the local folderresources/full_body.AvatarFolderPath: Path to your avatars.environment: Path to the environment file.starting_position: Starting point coordinates.reset_starting_position: Coordinates for resetting the starting position ('r'key).Avatar Library AdjustmentsCan add names to the various avatar libraries if needing to move the position or change facial morph values.- Mixamo Avatars:
MIXAMO: Add Mixamo avatar names here.MIXAMO_POSITION_POSITION:[0, -1.1, -0.09]`- ReadyPlayerMe Avatars:
- Add names in
READY_PLAYER_ME. READY_PLAYER_ME_POSITION:[0, -0.7, -0.09]- RocketBox Avatars:
- Add names in
ROCKET_BOX. ROCKET_BOX_POSITION:[0, -0.07, -0.09]
- Other Options:
MORPH: Set toTrueto enable facial morphs.BIOPAC_ON: Toggle Biopac AcqKnowledge signal sending.videoRecording: Set to1to enable video recording (saved in therecordingsfolder).
Adding New Avatars
To add new avatars:
- Place them in the
resourcesfolder. - They will automatically be included in the scene.
- Support for most avatar libraries (Reallusion, Metaperson, Mixamo, ReadyPlayerMe, RocketBox and more. See this page for more details). Can also download more avatars with the additional assets pack.
Run the Demo
Follow these steps to run the demo:
- Execute
virtual_mirror.py. - Choose your hardware.
- Use the
'c'key to cycle through avatars. - Use
sessionReplayto replay the scene (only shows the first selected avatar). - Features such as:
- Facial expressions, hand, and body tracking (Meta Quest Pro).
- Body and hand tracking only (Meta Quest 3).
- Save facial expression data in the
datafolder asdate_time+expressions.csv.
To visualize facial expressions over time, use facial_expressions_over_time with Matplotlib and Pandas.
Alternate Version
The virtual_mirror_w_slider version displays a panel showing data from all face tracking parameters.
Adding a Mirror to Your Scene
To add a mirror to your own scene:
-
Import the mirror module using from sightlab_utils.mirror import placeMirror
-
Use Inspector
(Tools > Inspector) to:
-
Add a 2D plane (any image works) to your scene.
- Position it where desired.
- Rename it
'mirror'(right-click to rename).
If the mirror isn't visible, adjust its rotation via "Euler" values.
# Import the mirror module
from sightlab_utils.mirror import placeMirror
#Name of environment and mirror object
placeMirror(env , 'mirror')
#Optional add to view avatar head (not needed for the full body avatars)
sightlab.setAvatarHead(head=vizfx.addChild(AVATAR_HEAD_RESOURCE_PATH + "/Male1.osgb"))
Avatar Modification
Included avatars are in resources\full_body and referenced to C:\Program Files\Sightlab2\sightlab_resources\avatar\full_body. To modify:
- Open avatars in Inspector.
- Choose "Open external reference."
- Edit features like animations and facial morphs.
