llSetAgentEnvironment snaps Cloud Coverage to new value instead of smooth change
tracked
Sominel Edelman
When using llSetAgentEnvironment to slowly change environment values in an experience, all parameters change gradually over the transition period except Cloud Coverage: this value changes suddenly at the end of the transition, giving an unwanted sudden change in lighting.
Log In
Sominel Edelman
Additional technical details
Root cause is in indra/newview/llenvironment.cpp, in LLSettingsInjected<LLSettingsVOSky>::applyInjections() and updateSpecial().
cloud_shadow appears in two sets:
LLSettingsSky::getSkipInterpolateKeys() in llsettingssky.cpp (~L690-704), which makes the standard interpolateSDValue() path skip it.
getSpecialKeys<LLSettingsVOSky>() in llenvironment.cpp (~L601-617), with the comment "due to being part of skips". It is the only non-texture entry in that set.
The workaround in updateSpecial() is broken. Frame trace while mix < 1.0:
applyInjections() creates local LLSD "clone A" via mSource->cloneSettings().
The loop reaches cloud_shadow, falls into the specials branch, and calls updateSpecial(injection, mix).
updateSpecial() creates a separate "clone B" via this->cloneSettings() (~L687), writes the lerped value into clone B, and commits clone B via setSettings().
Control returns to the outer loop. this->setSettings(settings) at ~L522 commits clone A, which has never had the lerped cloud_shadow written into it. This overwrites the commit that updateSpecial() just made.
Net effect: every frame the lerped cloud_shadow is computed, briefly committed, then immediately overwritten by the stale value from clone A.
At mix >= 1.0 the first branch (~L481) writes settings[key] = target directly into clone A, which the outer setSettings() then commits. This is the only moment a non-source value actually lands in the committed settings, producing the instant jump.
Suggested fix — make updateSpecial() take a reference to the outer settings LLSD and remove the internal cloneSettings() / setSettings() in the cloud_shadow branch. The outer loop's single setSettings() then commits the lerped value correctly. Alternatively, remove cloud_shadow from both sets so it goes through the standard interpolateSDValue() path.
Impact — cloud_shadow is the only non-texture parameter in getSpecialKeys(). The other entries are texture UUIDs that cannot be lerped and use setBlendFactor() shader crossfade instead, so the defect is invisible there. Any future non-texture scalar added to the specials set would inherit the same bug.
Dan Linden
updated the status to
tracked
Dan Linden
Thank you for the report, Sominel!
Issue tracked at https://github.com/secondlife/viewer/issues/4843. We have no estimate when it may be implemented. Please see future updates here.
Maestro Linden
This is a viewer rendering issue - the viewer creates the smooth transition between one environment value and another.
For this bug report, it would be helpful to provide:
- Details about the base environment asset being used
- The full set of SKY_CLOUDS parameters (which includes coverage) that you're using in your llSetAgentEnvironment call.
- Some video showing the rough transition in the clouds
Sominel Edelman
Maestro Linden Can this feedback be moved there, or do I need to create new feedback under that category?
Maestro Linden
Sominel Edelman: I've moved it to the correct category for you �
Sominel Edelman
Maestro Linden
This script will reproduce the issue. The cloud coverage changes between both settings from 0.3 to 0.7 and back again, but not in a smooth way. No base environment asset is used in the script, all relevant settings are present in the settings list. It should work with any base environment on a piece of land with allowed experience.
default
{
state_entry()
{
llRequestExperiencePermissions(llGetOwner(), "");
}
experience_permissions(key target_id)
{
list settings_1 = [SKY_CLOUDS, <0.54, 0.54, 0.54>, 0.30, 0.10, 0.05, <0.30, 0.30, 0.0>, <0.50, 0.50, 0.70>, <0.50, 0.50, 0.05>, SKY_AMBIENT, <0.0, 0.0, 0.0>, SKY_DOME, 0.96, 15000.0, 600.0, SKY_GAMMA, 1.0, SKY_GLOW, 1.0, 0.07, SKY_MOON, <0.422618, 0.0, 0.906308, -0.0>, 5.0, 1.0, 10, 6360.0, 6360.0, 6420.0, SKY_REFRACTION, 0.0, 5.0, 0.0, SKY_STAR_BRIGHTNESS, 0.0, SKY_SUN, <0.422618, 0.0, 0.906308, -0.0>, 3.21, <0.578800, 0.578800, 0.641200>, SKY_CLOUD_TEXTURE, "c912c552-b04f-4a96-fac9-2d0fdfa13c98", SKY_BLUE, <0.089600, 0.184800, 0.470400>, <0.17, 0.17, 0.17>, SKY_HAZE, 0.078000, 0.25, 0.75, 1.0, SKY_REFLECTION_PROBE_AMBIANCE, 1.0];
list settings_2 = [SKY_CLOUDS, <0.54, 0.54, 0.54>, 0.70, 0.10, 0.05, <0.30, 0.30, 0.0>, <0.50, 0.50, 0.70>, <0.50, 0.50, 0.05>, SKY_AMBIENT, <0.069267, 0.076904, 0.032471>, SKY_DOME, 0.96, 15000.0, 400.0, SKY_GAMMA, 1.0, SKY_GLOW, 1.0, 0.07, SKY_MOON, <0.422618, 0.0, 0.906308, -0.0>, 5.0, 1.0, 10, 6360.0, 6360.0, 6420.0, SKY_REFRACTION, 0.0, 5.0, 0.0, SKY_STAR_BRIGHTNESS, 0.0, SKY_SUN, <0.422618, 0.0, 0.906308, -0.0>, 3.21, <0.457500, 0.457500, 0.495623>, SKY_CLOUD_TEXTURE, "c912c552-b04f-4a96-fac9-2d0fdfa13c98", SKY_BLUE, <0.089600, 0.184800, 0.470400>, <0.17, 0.17, 0.17>, SKY_HAZE, 0.131400, 0.25, 1.50, 1.0, SKY_REFLECTION_PROBE_AMBIANCE, 1.0];
float delay = 5.0;
llSetAgentEnvironment(llGetOwner(), delay, settings_1);
llSleep(delay + 0.5);
llSetAgentEnvironment(llGetOwner(), delay, settings_2);
llSleep(delay + 0.5);
llSetAgentEnvironment(llGetOwner(), delay, settings_1);
}
}