PBR Colour data is lost when setting PBR overrides
tracked
Kristy Aurelia
Reproduction steps:
- Rezz a box
- Put this script into it:
integer AlphaState = 1;
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_RENDER_MATERIAL, ALL_SIDES, "2d45cf07-04ac-64a1-daa7-83f4992f759b"]);
}
touch_end(integer num_detected)
{
list faceData = llGetLinkPrimitiveParams(0, [PRIM_GLTF_BASE_COLOR, 0]);
llOwnerSay("Colour Received: \"" + llList2String(faceData, 4) + "\"");
if (AlphaState == 1)
{
faceData = llListReplaceList(faceData, [0.0, PRIM_GLTF_ALPHA_MODE_BLEND], 5, 6);
AlphaState = 0;
}
else
{
faceData = llListReplaceList(faceData, [1.0], 5, 5);
AlphaState = 1;
}
llSetLinkPrimitiveParamsFast(0, [PRIM_GLTF_BASE_COLOR, ALL_SIDES] + faceData);
}
}
- The script will turn this box golden
- Touch the box once, observe received colour value being "" and the box vanishing
- Touch the box again, observe received value being "<1.000000, 1.000000, 1.000000>" and the box being silver
Expectation:
One of the following should happen:
- Box should remain gold, and colour value remain ""
- Colour value should always be <1.0, 0.89, 0.616> and not ""
Environment
SL Main grid sim with: Second Life Server 2024-01-19.7590161929
Log In
Spooky Pumpkins
This issue is still occurring.
When using a toggleable alpha, the tint returns as white. PRIM_RENDER_MATERIAL should, in theory, send over the information in the entire material, tint included, overwriting any of the overrides. But it doesn't. The only way I can get the mesh to not have a white tint is to remove the material or use another override.
Why would sending over the entire material, not overwrite the tint override? That doesn't make any logical sense considering the material asset contains tint information.
Maestro Linden
tracked
Maestro Linden
under review
Maestro Linden
Thanks for the report Kristy Aurelia. I think I see the issue: if a PRIM_GLTF_BASE_COLOR override update contains a changed
float alpha
value but attempts to keep vector color
unchanged with the -1 argument, vector color
is incorrectly set to a default tint of <1,1,1>. I believe the issue is specific to the alpha
-color
pair of parameters, as they are stored in the same field internally despite appearing as 2 distinct parameters in the LSL API.This is a modified version of the script with a bit more debug output. If the two commented-out
faceData
assignment lines replace the lines above them, such that alpha
remains at the default and only gltf_alpha_mode
is updated, then color
is correctly preserved as golden after each transition: integer AlphaState = 1;
string baseColor;
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_RENDER_MATERIAL, ALL_SIDES, "2d45cf07-04ac-64a1-daa7-83f4992f759b"]);
baseColor = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0]));
llOwnerSay("Initial value: PRIM_GLTF_BASE_COLOR on face 0 now reads: "
+ baseColor);
}
touch_end(integer num_detected)
{
list faceData = llGetLinkPrimitiveParams(0, [PRIM_GLTF_BASE_COLOR, 0]);
llOwnerSay("Colour Received: \"" + llList2String(faceData, 4) + "\"");
if (AlphaState == 1)
{
faceData = llListReplaceList(faceData, [0.0, PRIM_GLTF_ALPHA_MODE_BLEND], 5, 6);
//faceData = llListReplaceList(faceData, [PRIM_GLTF_ALPHA_MODE_BLEND], 6, 6);
AlphaState = 0;
}
else
{
faceData = llListReplaceList(faceData, [1.0], 5, 5);
//faceData = llListReplaceList(faceData, [PRIM_GLTF_ALPHA_MODE_OPAQUE], 6, 6);
AlphaState = 1;
}
llOwnerSay("Setting [PRIM_GLTF_BASE_COLOR, ALL_SIDES] + " + llList2Json(JSON_ARRAY, faceData));
llSetLinkPrimitiveParamsFast(0, [PRIM_GLTF_BASE_COLOR, ALL_SIDES] + faceData);
string newBaseColor = llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0]));
if(newBaseColor != baseColor)
{
llOwnerSay("After touch: PRIM_GLTF_BASE_COLOR on face 0 has changed to: "
+ llList2Json(JSON_ARRAY, llGetPrimitiveParams([PRIM_GLTF_BASE_COLOR, 0])));
}
else
{
llOwnerSay("After touch: PRIM_GLTF_BASE_COLOR is unchanged");
}
baseColor = newBaseColor;
}
}
Annryk Resident
Maestro Linden, Unfortunately, I also encountered this problem when trying to hide part of a mesh with overlaid material through a script. The server does not return the tint from the material and after hiding of the body part, it loses the tint and becomes white. This makes it impossible to disable body parts with tinted material via script. Since after developing a part of the body the color is reset to white. I tried your version of the script, but the color is still not returned by the server. I think this is a big problem for the promotion of PBR materials. Since the old hiding of a body part through alpha no longer works when the PBR material is applied.
PS. This only happens on objects that do not have full rights, but as you know, most after-sale products are just like that