Problems with sun position tool (vector math help)

A forum for exporter development discussion.
Post Reply
4 posts • Page 1 of 1
User avatar
Whaat
Developer
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Location: Canada
Contact:

Problems with sun position tool (vector math help)

Post by Whaat » 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!

User avatar
OnoSendai
Developer
Posts: 6236
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Problems with sun position tool (vector math help)

Post by OnoSendai » Thu Sep 10, 2009 9:37 am

Well, sundir in Indigo is actually the vector from the origin to the sun. It's just that the sun is actually a finite distance away (the sky model is just a sphere around the scene).

User avatar
Whaat
Developer
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Location: Canada
Contact:

Re: Problems with sun position tool (vector math help)

Post by Whaat » Thu Sep 10, 2009 12:15 pm

OnoSendai wrote:Well, sundir in Indigo is actually the vector from the origin to the sun. It's just that the sun is actually a finite distance away (the sky model is just a sphere around the scene).
Could you please share the distance to the sun from the origin? :)

User avatar
OnoSendai
Developer
Posts: 6236
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Re: Problems with sun position tool (vector math help)

Post by OnoSendai » Thu Sep 10, 2009 1:33 pm

It's basically 10x max radius of scene.

Post Reply
4 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest