## Convex or Concave?

My next few projects were derived from an excellent book I was lent by my professor. While reading through Visual Perception From a Computer Graphics Perspective I found a section that discussed how we use shading to determine the shape of objects. Darker areas are generally perceived to be farther away, so the shapes below appear to be 3D spheres while they’re actually 2D circles.

Credit : http://guidetodrawing.com/contrast/distinguishing-concave-from-convex/
For more on the book: http://dl.acm.org/citation.cfm?id=2031421

Demonstrating this was extremely easy. I started by using Maya to create a simple 3D rectangular prism with convex and concave areas. I imported the prism into Unity, placed a spotlight that faced the top of the prism, and wrote a script to move the camera closer when the space bar is pressed. Initially you are placed far from the prism and asked if you can tell which square is sticking out towards you and which square is sticking in away from you. It is nearly impossible to tell due to the lack of shadows. After space bar is pressed, you are moved closer to the prism and the answer is revealed. VR didn’t really play much of a role in this experiment, but it was still neat to see it through the Oculus Rift.

Convex: Right
Concave: Left

When I first started doing my research at the Institute for Simulations and Training, my professor came to me with a really interesting idea to test. He questioned if Edward Adelson’s Checker Shadow illusion would hold up from different perspectives in Virtual reality. For those of you who are unfamiliar with this illusion, take a look at the image below. Although it may be hard to believe, the squares marked A and B are actually the exact same color! It’s hard to believe, but using the eyedropper tool in Photoshop or Paint will prove it. For more information visit https://en.wikipedia.org/wiki/Checker_shadow_illusion

Credit to Wikipedia for these images

To start I used Autodesk Maya to recreate the board and the stylishly colored cylinder.

Next came the actual simulation. To start off I used Unity’s 3D polygons to create an environment that consisted of a house surrounded by walls. Inside the house I placed the checkerboard and cylinder. Now I needed to add in lighting. The lighting is extremely important to this illusion because it is what brings it all together. I placed the spotlight in the top right corner of the room so that it created a shadow similar to the picture. I adjusted the intensity and color of the light until I got a shade that made the two squares look almost identical.

When showing people this illusion, they usually don’t believe it at first. To get people from “No they’re not” to “WOW” you generally have to use some sort of trick, like drawing a same color line between the two or pulling up Photoshop. I had to think of a way to get people to that “WOW” stage. I accomplished this by creating two real time camera feeds that would be displayed on the back wall of the house. Each of the cameras are pointed at a different marked square, and you can see that they are real time feeds by using one of the laser pointers that I will add in later. Having these two isolated views really display the similarities in color between the squares.

Next I needed to make a way to move around and interact with the environment. I was still new to Unity, so I decided to take it slow and start by creating a regular first person camera view where you use the arrow keys to move and the mouse to look and interact. Unity’s default first person camera was used to save time, and I added two large switches in the back that you can click to toggle the cylinder and light on and off. First thing I noticed after everything was up and running was that the illusion was holding up quite well from every angle. I still pushed through and implement Virtual Reality to see if this would change though.

Transitioning from a traditional first person camera to VR support was quite a ride. I had never developed with VR before, and I had only been recently introduced to it. Fortunately, Oculus has very easy to use developer utilities to for use with the Oculus Rift. I was aware of the issues that come with smooth movement and Virtual Reality, but I wanted to see for myself what it was like. After trying it out, I decided to move to a move appropriate VR movement system. I used a system similar to Valve’s The Lab, a free to play VR introductory game. Movement is done by pointing at the location you would like to move to and pressing a button. You will instantly be teleported there. This system proved very easy on the stomach, so I decided to keep it. I wanted to make toggling the light and cylinder on and off fun and interactive, so I made it so you have to physically point at the switches to do it. At first, it was kind of hard to tell what you were pointing at, so I implemented red 3D rectangular prism hands and a laser pointer. Next I added in the ability to crouch so you can get up close and personal with the board. Lastly, I added in a prism that runs over the A and B squares that you can turn on by holding a button on the Oculus Touch controller. This is just more proof to highlight the similarities in color for the stubborn people who still refuse to see it.

Additionally, I experimented with changing the color of the checker board. I was able to recreate the setup using light and dark red and I found that the illusion still held even with different colors.

Moving the experiment to VR showed that perspective really does not seem to matter when it comes to this illusion. Moving around the board and getting low and right up on it really did not change how it appeared. This is about what I expected after playing around in first person, so I was not too surprised. This was a great experiment to dip my toes into VR, and I am very proud of the overall product I created!

## Overview

Hi, welcome to my mind. Keep scrolling to check out my blog, or you can follow the progress on some of my personal projects by clicking on the projects tab above.