## Problems with sun position tool (vector math help)

A forum for exporter development discussion.
4 posts • Page 1 of 1
Whaat
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Contact:

### Problems with sun position tool (vector math help)

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!

OnoSendai
Posts: 6227
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

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

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).

Whaat
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Contact:

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

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?

OnoSendai
Posts: 6227
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

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

It's basically 10x max radius of scene.

4 posts • Page 1 of 1

### Who is online

Users browsing this forum: No registered users and 1 guest