I love Lamp


Warning Nerdy stuff ahead

This lesson is made for people with a basic understanding of VRED and python scripting. If you are unfamiliar with coding some of the concepts might be a bit hard to comprehend. This brushes up on Python concepts but it glosses over very important structure, syntax and programming theory. I suggest going to Code Academy and taking their intro to python classes. 

If you would like to just experience the VR you can grab the file for free at my store. It will ask for a credit card but you can just put zeros, nothing will be charged. 

Prepping the file

Before we get to the coding part, we have to add a couple things to our scene. These will later be controlled by our HTC vive controllers. 


Adding a Matrix Transform

The first thing we need to add is a Matrix Transform. So in your scenegraph got to Create > Matrix Transform. Name it Main_Hand. Remember in python CAPITALIZATION counts. So keep that in mind when you are writing code. 

  1. Go to Scenegraph
  2. Create Matrix Transform
  3. Name it Main_Hand

Add a spot light

Now we need to add a spot light. Go to your scenegraph > Create Light > Spot Light. Then place this spotlight under the Matrix Transform we just made.

  1. Go to Scenegraph
  2. Create Light
  3. Spot Light
  4. Place inside Matrix Transform name Main_Hand

Add a Switch Material 

First we need to create a new material for our white ball. Go to Material Editor > Create Material > Chrome. Then remember since this will go to our white ball it needs the color_room hdr. So go to common right click environment and chose color_room. Then create a switch Material and add in both the Chrome and the Metallic Pearl shader, then assign that switch to the white ball. 

  1. Go to Material Editor
  2. Create a Chrome Material. Menu Bar > Create/Convert > Chrome
  3. Go to Chrome material Properties 
  4. Scroll down to Common
  5. Change Environment to color_room
  6. Create a Switch Material. Menu Bar > Create/Convert > Switch
  7. Add both Pearl and Chrome Materials to switch (just drag and drop) 
  8. Assign new Material to White Sphere.