Sunday, April 8, 2012

Trouble with the camera

While trying to figure out a way to let the user control the camera, I ran into the problem where changing the camera location messes up the shading of the scene.

With the eye position of  E=vec3(-sin(time/10000.0)*10.0,5,cos(time/10000.0)*10.0); I get the following result:


However, when I try to set the position using a constant, such as E=vec3(-sin(0.0001)*10.0,5,cos(0.0001)*10.0); the lighting messes up compeltely:


I'm not really sure why this is happening, since the x and z values of the eye are basically sin waves going between 0 to 1, so replacing the time function with a constant should at most only change the viewing angle. I've been kind of stuck on this for a while, so if nothing changes in the next few days, I'll probably stick to the hack of dividing time by a really large float so it looks constant. 

1 comment:

  1. Sounds like a coding error. Are you sure the light does not depend on time?

    ReplyDelete