Currently, I am attempting to modify this code (which was originally based on an implementation found here). While I have successfully achieved the desired visualization and rendering effects, my goal now is to introduce realistic movement into the animation.
The location of the light source is determined by a normalized vector (e.g. THREE.Vector3(1, 0.75, 0)
, giving the appearance that the light is shining from the top right corner). My next step involves rotating this vector around the sphere in a manner that simulates the sphere orbiting the light source. However, I have encountered difficulties in calculating the appropriate values for the next set of x, y, z
coordinates. Various attempts were made, including adjustments to the position of the vector, as well as the application of Euler angles and rotational matrices:
euler = new THREE.Euler(f,g,h, 'XYZ');
matrix = new THREE.Matrix4().makeRotationFromEuler(euler);
light = vector.applyMatrix4(matrix);
Despite these efforts, uncertainties linger regarding how to determine the correct values for f, g, h
that would prevent erratic movements of the light around the sphere.
Would you say that I'm heading in the right direction?
You can view a demonstration of the current setup here: http://jsfiddle.net/VsWb9/3890/