Virtual Screen

Virtual Screen Template/Example

Located in ExampleScripts- 2D Screen

Note there are also additional Mixed Reality versions in the ExampleScripts- Mixed Reality folder

In the ExampleScripts- 2D Screen folder  you find a few examples related to using a virtual screen within a SightLab script. There are examples for both single and multi-user, as well as using either a stereo or mono screen. Also a example with an optional video player that lets you more easily cycle through a series of videos. Here's a brief overview of the examples and how to use them.  Note that K-Lite Codec pack may be needed to play back some video files. https://codecguide.com/download_kl.htm 

In the VideoScreenConfig file you can choose the following:

#Choose environment, use empty for mixed reality

ENVIRONMENT = "utils/resources/environment/empty.osgb"


#Choose stereo or Mono and Stereo Video Type

VIDEO_TYPE ='Mono'

#VIDEO_TYPE ='Stereo'


#STEREO_VIDEO_FORMAT ='Left_Right'

STEREO_VIDEO_FORMAT ='Top_Bottom'


#Choose location of Media

USE_DIRECTORY = False

USE_SPECIFIC_VIDEO_PATH= False


if USE_DIRECTORY == True:

video_directory=r'C:\Path_To_Video'

video_files = [f for f in os.listdir(video_directory) if f.endswith(('.mp4', '.avi','.mov','.wmv'))]

current_video_index = 0

MEDIA_FILE = viz.addVideo(os.path.join(video_directory, video_files[0]))

elif USE_SPECIFIC_VIDEO_PATH==True:

video_file = r'C:\Path_To_Video'

MEDIA_FILE = viz.addVideo(os.path.join(video_file))

else:

MEDIA_FILE = viz.addVideo('utils/resources/media_2D/droneShots.mp4')

STEREO_MEDIA_FILE = viz.addVideo('utils/resources/media_2D/SBS.mp4')


#These can swap out the default keys used for play/pause and restarting of the video

VIDEO_PLAYBACK_KEY = 'v'

VIDEO_RESET_KEY = 'k'

FAST_FORWARD_KEY = 'f'

NEXT_VIDEO_KEY = 'c'

Running the Session

NOTE: For Multi-User you need to select "empty.osgb" for the environment on the server (so that it uses the hard coded path)


2D_Screen

3D_Screen

Video_Player

2D_Screen_server and 2D_Screen_client

Cycle Videos

Video_Player_STIM_File

Swapping out the environment

Find in the code where it has: 

env = vizfx.addChild("utils/resources/environment/Stimulus.osgb")

and change this path to whatever environment you want to use. 


Adding a screen

To add a video screen to your environment model, you will need to either access a screen object in your environment using:

screen = env.getChild('screen') #where 'screen' is the name of that component

Or you can use File-Add and add a 2D image to your environment model and rename it to 'screen' and place it where you want in your scene. 

You can also use File-Add and add the "screen.osgb" from utils/resources/objects

See the page on Inspector for more information