llSetLinkGLTFOverrides fails to clear alpha override
tracked
Medea Destiny
According to https://wiki.secondlife.com/wiki/LlSetLinkGLTFOverrides, "Passing an empty string ("") as the override value will clear that override." This is true as far as I have tested except for OVERRIDE_GLTF_BASE_ALPHA, where setting to "" seems to simply do nothing.
To Reproduce: Rez a prim, add a PBR material to it, and put the following script into it:
default
{
touch_start(integer total_number)
{
toggle=!toggle;
if(toggle) llSetLinkGLTFOverrides(LINK_THIS,ALL_SIDES,[OVERRIDE_GLTF_BASE_ALPHA_MODE,PRIM_GLTF_ALPHA_MODE_BLEND,OVERRIDE_GLTF_BASE_ALPHA,0]);
else llSetLinkGLTFOverrides(LINK_THIS,ALL_SIDES,[OVERRIDE_GLTF_BASE_ALPHA_MODE,"",OVERRIDE_GLTF_BASE_ALPHA,""]);
}
}
You will see that the alpha will set to 0 on the first click, but will not return to its previous value on the second click. The alpha mode WILL revert as intended if you use a PBR material which is not in blend mode, but the prim remains invisible if the material is not opaque.
The wiki page provides a toggle alpha on/off function, but this simply toggles the alpha value between 0 and 1 rather than setting and then removing an override. Where the base alpha value of a material is not 1, this will fail as it will set the alpha to 1 rather than the correct value.
Log In
Maestro Linden
One thing I realized later on is that there's a caveat pointed out in the wiki:
OVERRIDE_GLTF_BASE_COLOR_FACTOR and OVERRIDE_GLTF_BASE_ALPHA parameters are coupled. If an override is set for one parameter, then the other is automatically given an override. The default OVERRIDE_GLTF_BASE_COLOR_FACTOR is <1,1,1>, and the default OVERRIDE_GLTF_BASE_ALPHA is 1.0.
With your (and my) original test scripts, the first call to set OVERRIDE_GLTF_BASE_ALPHA actually also sets a white-tint override for OVERRIDE_GLTF_BASE_COLOR_FACTOR as well. Since it's not possible to clear OVERRIDE_GLTF_BASE_ALPHA while keeping the OVERRIDE_GLTF_BASE_COLOR_FACTOR override intact, it's arguably expected that setting
[OVERRIDE_GLTF_BASE_ALPHA,""]
by itself in this state should fail.That said, I also see that calling llSetLinkGLTFOverrides () with
[OVERRIDE_GLTF_BASE_ALPHA, "", OVERRIDE_GLTF_BASE_COLOR_FACTOR, ""]
fails to clear the OVERRIDE_GLTF_BASE_ALPHA or OVERRIDE_GLTF_BASE_COLOR_FACTOR overrides. This should definitely be possible - so there's still a bug.Medea Destiny
Maestro Linden Yeah I wondered the same thing and experimented with setting BASE_COLOR_FACTOR and removing it at the same time as setting the alpha, but the behaviour was the same with all variations I tried. However I was just setting a 1,1,1 override that didn't actually change the tint to see if that was working and thus didn't notice it's not working either, so omitted that from the report. Trying to override JUST the base color factor on its own produces the same result, the override not being removed.
Considering the caveat, could it be that it's attempting to clear the overrides in order and each one fails because the other has not been cleared? In which case it may be unfixable as is. Perhaps that could be addressed by reading the other value from the material's base values when asked to clear an override and setting the override value to that rather than actually clearing it. However for a cleaner solution if these two remain linked then [OVERRIDE_GLTF_BASE_RGBA,vector color, float alpha] that handles both at the same time might be the only valid solution that
actually
clears the override.Maestro Linden
tracked
Maestro Linden
Hi Medea Destiny, I can reproduce this as well. My version of the repro script is:
integer toggle;
float alpha_override = 0.8;
default
{
state_entry()
{
llListen(0, "", NULL_KEY, "reset");
}
listen(integer channel, string name, key id, string msg)
{
// 'reset' command received. clear any preexisting GLTF material to remove any stray overrides
llSetRenderMaterial(NULL_KEY, 0);
/* the base 777d41ea-1552-eaf3-e048-dda143902154 asset includes an
alpha-blended heart texture with a default alpha level of 0.5 */
llSetRenderMaterial("777d41ea-1552-eaf3-e048-dda143902154", 0);
llSay(0, "Initial material set. Should have no overrides.");
string base_overrides = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0])); // get overrides on face 0
llSay(0, "Base overrides on face 0 are: " + base_overrides);
}
touch_start(integer total_number)
{
toggle = !toggle;
if(toggle)
{
llSay(0, "Setting OVERRIDE_GLTF_BASE_ALPHA = " + (string)alpha_override);
llSetLinkGLTFOverrides(LINK_THIS, 0, [OVERRIDE_GLTF_BASE_ALPHA, alpha_override]);
}
else
{
llSay(0, "Setting OVERRIDE_GLTF_BASE_ALPHA = \"\" (no override)");
llSetLinkGLTFOverrides(LINK_THIS, 0, [OVERRIDE_GLTF_BASE_ALPHA, ""]);
}
llSleep(0.1);
string base_overrides = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0])); // get overrides on face 0
llSay(0, "Base overrides on face 0 are: " + base_overrides);
}
}
In my case, I changed the alpha override value to 0.8 - just in case 0.0 was special somehow. However, I'm seeing that after initially setting OVERRIDE_GLTF_BASE_ALPHA to 0.8, trying to clear it has no effect. This is observed by querying PRIM_GLTF_BASE_COLOR with the script:
Base overrides on face 0 are: ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000,"<1.000000, 1.000000, 1.000000>",0.800000,"","",""]
or by looking at the payload of the
GenericStreamingMessage
that gets sent out (which describes an override update) - OVERRIDE_GLTF_BASE_ALPHA is consistently stuck at 0.8.Medea Destiny
Maestro Linden Yeah I tried with other values, nothing's getting cleared. It's as if the empty string leads to nothing being changed rather than the current value being cleared for the instance of OVERRIDE_GLTF_BASE_ALPHA specifically