Uploaded image for project: 'Snowstorm'
  1. Snowstorm
  2. STORM-1330

Fixed Sky settings do not return correct Sun position



    • Defect
    • Status: Product Review
    • Major
    • Resolution: Fixed
    • None
    • project-windlight, Sprint 18
    • None
    • -
    • Code Review, Product Owner
    • TBD ... there are a number of sundials available on the Marketplace.... I'll look into using one of them (or a similar script) to create a test.


      The server sends the time to the viewer expressed as a 'sun angle' in radians. The same value (in vector form) can be read by scripts using llGetSunDirection. A related value can also be read using llGetTimeOfDay; though the documentation on just what to expect from that is much less clear, it does say: Second Life days cycles are 4 hours long (3 hours of light, 1 hour of dark). The sunrise and sunset time varies slowly.

      This does have an implication for us. It turns out that there's a difference between a region set to have a fixed time of day (previously set in the Region/Estate floater Estate tab) and one that just has a fixed sky: the phase control from that dialog causes the two LSL functions above to behave differently. When the region is set to a fixed sun, that causes the llGetSunDirection to always return that fixed value rather than one dependent on the time (it also seems to change llGetTimeOfDay, but in a less clear way). Our current implementation will break that, since we are never setting the fixed sun flag.

      There's an awkward disconnect in the old functionality though... the estate time phase on a fixed sun region controlled what llGetSunDirection returned, but that had no relationship to the sun angle in the windlight sky preset selected. It was possible to set the estate phase to one value and then set the apparent position of the sun to something else in the sky preset. If the estate manager did that (under the old controls), the llGetSunDirection would return a value that didn't match what the user saw. I suspect this came about because there used to be just the one control for the region time, but when windlight sky presets were created they added an independent control.

      I think the correct solution to reconcile this is for us to change the code so that if the estate manager selects a Fixed Sky in the Region/Estate Environment tab, then we tell the sim that it is a 'fixed sun' region, but instead of having a phase control there, we extract the sun position from the selected sky preset. This will ensure that the llGetSunDirection will return a value that points to the apparent sun in any fixed sky region. In regions set to use a day cycle, the sun position in each selected sky preset will control the apparent position; those will only match what llGetSunDirection returns if the user who created the sky and day cycle presets did so in a way that approximates the underlying SL time of day, but I don't think there's anything we can or should do about that.


        Issue Links



              Unassigned Unassigned
              oz.linden Oz Linden
              Oz Linden Oz Linden
              0 Start watching this issue



                Time Tracking

                  Original Estimate - Not Specified
                  Not Specified
                  Remaining Estimate - 0 minutes
                  Time Spent - 1 day, 4 hours
                  1d 4h