Please watch the accompanying video for more details. For more information on using Vizard see the Vizard Documentation.
Getting a Model from Sketchfab and Opening in Inspector
Checking Size and Starting Point
Saving the Model and Creating a New Project Folder
Running in Vizard
Choosing VR Hardware
Adding Additional Objects and Interacting with Them
1. Getting a Model from Sketchfab and Opening in Inspector
First, we’re going to get a model out of Sketchfab (www.sketchfab.com) and download it as a .glTF (the most compatible model format). You can use models from many sources, but Sketchfab is a good source as they have over 150,000 creative commons free models you can use. For a list of compatible models for Vizard see this page in the documentation.
Make a free Sketchfab account, search for an environment model, click “Downloadable”
Download as “Autoconverted format glTF”)
Unzip the folder and open the scene.glTF file in Vizard’s Inspector (Tools- Inspector) using File- Open
2. Checking Size and Starting Point
Next, we’ll use File-Add to bring in an avatar from Vizard’s resources (C:\Program Files\Username\Vizard7\resources\vcc_male.cfg) to check the size of the model and where a user will be starting from.
You can see the size in meters of the model if you click on the top “root node” and look on the bottom right of Inspector
The model is very large compared to the average human height of our avatar.
You can change the size by clicking on the “scale” transform on the top left and either entering numbers in directly or using the scale tool.
To adjust the starting point, again click the root node on the environment model (not the avatar) and then use the “move” and “rotate” transform tools to move or rotate the environment until the avatar is positioned and facing where you want your starting point to be.
You can then delete the stand-in avatar.
At this point you can create and adjust lights if you wish. The model we are using has baked lighting, so it may not be necessary for this particular environment.
To create a light, go to Create- Lights- and choose from Directional, Spot or Point light.
Use the translate tools to move your light to where you want it in the scene, and the rotate tool to adjust the direction. Clicking on the light will bring up the attributes on the right, which let you adjust the intensity, color, turn on shadows and more.
Note that if the lights don’t appear to be affecting your model, you may need to turn on lighting on that part of the model’s material.
3. Saving the Model and Creating a New Project Folder
Next, go to File-Save and save your environment model into a new project folder (or your existing one if you’ve already created a Vizard project). It is also advised to have a sub-folder for models, called something like “Resources” or “Art”.
4. Running in Vizard
Next, create a new Vizard script by opening Vizard and going to “File - New Vizard File” and save this in your project folder (giving it a name as well). Add the following code to view your model with the default Vizard navigation (no hardware selected). The viz module is needed to bring in all the basic Vizard functionality, the vizfx module is usually needed for models to have the shaders look correct. Replace “kitchen.osgb” with the name you gave your model when you saved it out of Inspector.
env = vizfx.addChild('resources/kitchen.osgb')
Click the green arrow in Vizard, F5 or go to Script- Run to run the application.
5. Choosing VR Hardware
To run in your own hardware, use Vizard’s built in hardware GUI tool, “Vizconnect” by going to “Tools - Vizconnect”. You can choose from one of the common presets, or go to the advanced mode to allow for more unique configurations and customization. For more information on vizconnect see the Vizard documentation on vizconnect.
Save your vizconnect file in your project folder and give it a name (a common naming convention we suggest is calling it “vizconnect_config”).
Add the vizconnect module to your vizard script and point it to the name of your vizconnect hardware configuration.
#Can use desktop one for desktop mode or create your own
env = vizfx.addChild('resources/kitchen.osgb')
You can now run the scene again and view it in your headset or specific hardware.
6. Adding Additional Objects and Interacting with Them
There are a few ways you can add additional objects to your Vizard project, you could do that in code or go back to Inspector and place them using the 3D scene builder. We’re going to go back to Inspector.
You can use Sketchfab or any other resource to find some more 3D models and then use File-Add in Inspector to place them in your scene. You may need to adjust the size, as many models from Sketchfab come in at a different unit than meters. Use the move, scale and rotate tools to place whatever objects you want in your scene and then click “save” to save them in your Inspector scene.
You will then want to right click on the object in the scene graph and choose “rename” to give it a unique name.
To be able to grab the objects in Vizard, first add a grabber tool for both the right and left hands in vizconnect, by opening your vizconnect file you saved and going to Advanced Options- Tools- Grabber. Uncheck “using physics” unless your script has physics turned on. Click “Apply and Exit”.
Click the “Mappings” button, change the dropdown from “keyboard” to “r_hand_input” (or whatever your input is named) and then choose the button for “grabAndHold” by clicking the button on your controller (usually the trigger button).
The Right hand should automatically be attached to your avatar’s right hand. The left hand you may need to drag under the l_hand node.
Now to grab your objects add this code to your Vizard script, where you can replace the names “blueCup” and “silverCup” with the names of your objects in Inspector. .getChild will look for the object’s names from the main environment model.
#Add objects to grab
# Code to get the grabber tool by name and supply the list of items which can be grabbed
grabber = vizconnect.getRawTool('grabber')
grabber2 = vizconnect.getRawTool('grabber2')
7. Data Collection
To collect data, first you’ll need to create a folder in your project and call it “data”. This will hold your data files.
Now add this additional code to your main Vizard script:
This section uses vizinput to create a screen that a participant will enter their ID number into, viz.tick starts a timer that will begin counting in seconds and the session_data variable creates a data file called “session_data” we will use to store our data.
The “onGrab” function checks for how much time has passed, then prints out and saves to the session_data file every time an object is grabbed. This would be a similar setup if you were also wanting to collect other data to a file, such as when a proximity sensor is entered, or when a user’s heart rate goes past a certain threshold if using a physiological sensor. The function is then being called with the “GRAB_EVENT”.
Finally, we are creating a “tracking_data” file that uses a function that is called every frame (using vizact.onupdate) to print out the head position of the user (head position is linked to viz.MainView).
This is just a quick example of some of the basic things you can do with Vizard, take a look at the documentation or send us an email at firstname.lastname@example.org to learn how you can perform a wide range of other research related tasks in VR, such as adding advanced hardware like data gloves and physiological measurement devices, setting up the stages of an experiment, using proximity sensors, adding avatars and multiple users, physics, advanced data collection and a whole lot more.