Problems with sun position tool (vector math help)
Posted: Thu Sep 10, 2009 7:00 am
So I am writing a tool to position the sun in SkIndigo but I ran into a problem. I assumed that the <sundir> vector from the camera position to the sun was the same as the vector from the scene origin [0,0,0] to the sun. Apparently this is not the case.
This tells me that the position of the sun in Indigo is actually some fixed distance from the scene origin. So my question is this:
Given:
- Vector from camera to sun (direction only, not length)
- Vector from scene origin to camera (direction and length)
Determine:
- Vector from scene origin to sun (length not required)
This is probably very easy but I am a bit rusty on my 3D math...
Thanks!
This tells me that the position of the sun in Indigo is actually some fixed distance from the scene origin. So my question is this:
Given:
- Vector from camera to sun (direction only, not length)
- Vector from scene origin to camera (direction and length)
Determine:
- Vector from scene origin to sun (length not required)
This is probably very easy but I am a bit rusty on my 3D math...
Thanks!