Editing Environment

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 166: Line 166:
 
The following is a simplified explanation of the procedure by which the game determines the light intensity supplied by the sun at a given latitude, day of the year, and time of day.
 
The following is a simplified explanation of the procedure by which the game determines the light intensity supplied by the sun at a given latitude, day of the year, and time of day.
  
# The latitude normal vector <code>N</code> can be calculated as the vector <code>{cos(''latitude''), sin(''latitude''), 0}</code>. Note that this is always orthogonal to the Z-axis (the Y-axis passes through the planet's poles, not the Z-axis) with a positive X-value. For example, the latitude normal vector at the equator would be <code>{1, 0, 0}</code> while at 45° N it would be <code>{0.707, 0.707, 0}</code>.
+
First, the latitude normal vector <code>N</code> can be calculated as the vector <code>{cos(''latitude''), sin(''latitude''), 0}</code>. Note that this is always orthogonal to the Z-axis (the Y-axis passes through the planet's poles, not the Z-axis) with a positive X-value. For example, the latitude normal vector at the equator would be <code>{1, 0, 0}</code> while at 45° N it would be <code>{0.707, 0.707, 0}</code>
# The latitude fraction equals <code>0.2</code> below latitude <code>70</code>, <code>1.5</code> above latitude <code>75</code>, and is linearly interpolated between.
+
 
# The unmodified sun position vector <code>P</code> is the vector <code>{cos((''day_percent'' - 0.5) &times; 360°), -cos(''day_of_year''/60 &times; 360°) &times; ''latitude_fraction'', sin((''day_percent'' - 0.5) &times; 360°)}</code>.
+
To calculate the sun position vector <code>P</code>, [[wikipedia:Unit vector|normalize]] the vector <code>{cos((''day_percent'' - 0.5) &times; 360°), -cos(''day_of_year''/60 &times; 360°) &times; latitude_fraction(''latitude''), sin((''day_percent'' - 0.5) &times; 360°)}</code> then rotate it an amount towards latitude normal vector <code>N</code> based on the graph on the right, but not passing it (if applicable). The function <code>latitude_fraction(''latitude'')</code> equals <code>0.2</code> below latitude <code>70</code>, <code>1.5</code> above latitude <code>75</code>, and is linearly interpolated between.
# [[wikipedia:Unit vector|Normalize]] the unmodified sun position vector <code>P</code>.
+
 
# Rotate the normalized sun position vector <code>P</code> an amount towards latitude normal vector <code>N</code> based on the graph on the right, but not passing it (if applicable).
+
Using latitude normal vector <code>N</code> and sun position vector <code>P</code> (both should have magnitude <code>1.0</code>), the daylight intensity is based on the [[wikipedia:Dot product|dot product]] of the two, with <code>0.0</code> to <code>0.7</code> linearly corresponding with 0% to 100% light intensity and <code>0.7</code> to <code>1.0</code> being clamped at 100% light intensity.
# The unmodified daylight intensity is equal to the [[wikipedia:Dot product|dot product]] of the latitude normal vector <code>N</code> and sun position vector <code>P</code> (both should have magnitude <code>1.0</code>).
 
# The final daylight intensity scales based on the unmodified daylight intensity, with <code>0.0</code> to <code>0.7</code> linearly corresponding with 0% to 100% light intensity and <code>0.7</code> to <code>1.0</code> being clamped at 100% light intensity.
 
  
 
Interestingly, while some effects are applied differently above latitude <code>70</code> (70° N), these do not seem to apply below <code>-70</code> (70° S).
 
Interestingly, while some effects are applied differently above latitude <code>70</code> (70° N), these do not seem to apply below <code>-70</code> (70° S).

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: