This assignment shows a light sensitive input device. This device presents an intuitive and tangible interface for computer graphics
lighting design. Users use a small flashlight to shine light from different directions to modify the virtual light in the computer graphics scene. This design aims to free designers from placing lights with numerical coordinates and to provide an intuitive and tangible experience. The main challenge is how to construct a device that senses and compute lighting directions, which we will address in this assignment.

This device senses the direction of the light source by using multiple photoresistors. These photoresistors vary their resistance according to how much light they receive. In our implementation, we connect four photoresistors in parallel. We place them at different positions and orientations to ensure each photoresistor receives a different amount of light from the same light source. By measuring the power difference among the resistors, we can estimate and visualize the position of the light source.


Lighting Design

Lighting design is an important artist step in computer graphics and animations. As lighting and shadow conveys important 3D shape information in 2D scenes. Artists use their experience to place virtual lights in computer graphics and animation studio software. They have to translate their artistic lighting experience to mathematical coordinates for the software to render their scene. This is often a time consuming process, in part, because computer graphics software is still high mathematical for the artist. We build an input device to let artists input the lighting configuration by simply shining light using a small flashlight.

Arduino Sensor Circuit

We used the analog inputs on the Arduino board to measure the resistance on the photoresistors. We connect the Arduino's 5V power supply with four photoresistors in parallel such that, the photoresistors are independent of one another. The extra resistors are used to adjust the sensitivity of the photoresistors. A serial circuit makes the resistance of a photoresistor dependent on other photoresistors, which results in inaccurate estimation of the light source direction. For each photo resistor, we feed its output to an analog input. Arduino's internal analog-to-digital convertor converts the voltage to a 10 bit reading, a high reading shows high light intensity. We print this reading to the serial port of the host computer. A client program that uses this sensor polls the readings from the serial port at an interactive rate. We map each of these readings to an angle.


Reconstructing the Light Directions

Reconstructing the light direction from photo resistor readings is the main challenge in this assignment. We first eliminate the effect of ambient lighting and we analytically map the sensor readings into directions.

Ambient Lighting

Ambient lighting affects our sensors' reading. In order to keep the readings invariant across different lighting environment. We first
subtract the ambient lighting from our readings, then we normalize the sensor readings to a unit vector. Since the ambient lighting changes from environment to environment, we calibrate this ambient constant by recording the ambient light at the beginning of our application. The normalization turns the photoresistors' readings into ratios for inferring the light direction.

Compute the Light Direction

We first analytically establish the relationship between light directions and the resistance of the photoresistors. We divide 360
degrees into 16 directions and then we estimate the ratio of the resistance among the 4 photo resistors at each of these 16
directions. We also attempt to calibrate the light direction according to the actual sensor reading, however the results are less accurate than the analytic approach. For each reading, we compute the nearest-neighbor interpolation to infer the light direction.


We have implemented our system in Python with OpenGL. The example is adapted from the PyOpenGL shader tutorials. It shows a sphere with Phong shading. We extended this program to poll the serial port for sensors readings and modify the light directions. Our video demonstration shows how we use a small flash light to modify the light positions in interactive realtime.