heres a quick excel calculator for working out the lighting vectors for a specific sun direction and angle
thanks to jlv for the calculations needed.
http://www.mediafire.com/download/2f7wi ... lator.xlsx
sun angle/rotation calculator
Re: sun angle/rotation calculator
Awesome! Always my least favorite part of adding a new sky.
-
- Posts: 907
- Joined: Mon Sep 02, 2013 6:18 pm
- Team: MotoPin Racing
- Location: idaho
Re: sun angle/rotation calculator
Got one question. Which is the bottom of the map when your in editor? Is it the side thats at the bottom of your screen or is it the side with the gates in their stock position?
Re: sun angle/rotation calculator
bottom of screen, sorry for slow replyslowngreen wrote:Got one question. Which is the bottom of the map when your in editor? Is it the side thats at the bottom of your screen or is it the side with the gates in their stock position?
-
- Posts: 631
- Joined: Tue Jun 21, 2016 4:15 am
- Team: Privateer
- Location: Oregon
- Contact:
Re: sun angle/rotation calculator
What would the formula be to go the other way, i.e. from XYZ coordinates to angle/rotation? I feel like I should be able to figure this out, but my trigonometry skills are not what they used to be.
Basically I want to figure out what rotation to set for a plane statue so that it faces the sun.
Basically I want to figure out what rotation to set for a plane statue so that it faces the sun.
jlv wrote:?
Re: sun angle/rotation calculator
atan2(x, z)
You might have to swap/negate x and z to get the right quadrant.
You might have to swap/negate x and z to get the right quadrant.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
-
- Posts: 631
- Joined: Tue Jun 21, 2016 4:15 am
- Team: Privateer
- Location: Oregon
- Contact:
-
- Posts: 631
- Joined: Tue Jun 21, 2016 4:15 am
- Team: Privateer
- Location: Oregon
- Contact:
Re: sun angle/rotation calculator
This was very helpful actually. What about getting the angle of the sun from the horizon, using XYZ coordinates?jlv wrote:atan2(x, z)
You might have to swap/negate x and z to get the right quadrant.
Re: sun angle/rotation calculator
atan2(y,sqrt(x*x+z*z))
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
-
- Posts: 631
- Joined: Tue Jun 21, 2016 4:15 am
- Team: Privateer
- Location: Oregon
- Contact:
Re: sun angle/rotation calculator
Awesome, thanks again! Definitely wouldn't have figured that out myself in any reasonable amount of time.
For anyone reading, here's a simple atan2 calculator I found: http://util.io/calculator
Also, here is a "ruler" I made for a sphere mapped sky: http://openlightpictures.com/pub/cd_SpheremapGrid.png
Using jlv's equations, and the ruler, you can quickly pinpoint where the sun should be on the sphere map to align with the in-game lighting. Then convert the sphere map to a skybox with this tool: http://forum.mxsimulator.com/viewtopic.php?f=11&t=2868
I may write a step-by-step tutorial at some point, but hopefully someone finds this useful in the meantime!
For anyone reading, here's a simple atan2 calculator I found: http://util.io/calculator
Also, here is a "ruler" I made for a sphere mapped sky: http://openlightpictures.com/pub/cd_SpheremapGrid.png
Using jlv's equations, and the ruler, you can quickly pinpoint where the sun should be on the sphere map to align with the in-game lighting. Then convert the sphere map to a skybox with this tool: http://forum.mxsimulator.com/viewtopic.php?f=11&t=2868
I may write a step-by-step tutorial at some point, but hopefully someone finds this useful in the meantime!
Re: sun angle/rotation calculator
You can use the javascript console in you browser to calculate pretty much anything. For atan2 it'd be "Math.atan2(y,x)".
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.