PBR Script - The llGetPrimitiveParams function returns the texture UUID in clear on the PRIM_GLTF_* properties
closed
Gael Streeter
The PBR texture UUIDs are returned in clear by the llGetPrimitiveParams function even when you HAVE NO RIGHT on these textures.
To reproduce the issue:
- Apply a PBR material on a prim
- Set the different PBR textures with your own textures
- Put the following script in it :
default
{
state_entry()
{
}
touch_start(integer total_number)
{
list params;
params = llGetPrimitiveParams([PRIM_RENDER_MATERIAL, 4]);
llOwnerSay("PRIM_RENDER_MATERIAL : " + llList2CSV(params));
llOwnerSay("PRIM_GLTF_BASE_COLOR : " + llList2CSV(params));
params = llGetPrimitiveParams([PRIM_GLTF_NORMAL, 4]);
llOwnerSay("PRIM_GLTF_NORMAL : " + llList2CSV(params));
params = llGetPrimitiveParams([PRIM_GLTF_METALLIC_ROUGHNESS, 4]);
llOwnerSay("PRIM_GLTF_METALLIC_ROUGHNESS : " + llList2CSV(params));
params = llGetPrimitiveParams([PRIM_GLTF_EMISSIVE, 4]);
llOwnerSay("PRIM_GLTF_EMISSIVE : " + llList2CSV(params));
}
}
- Send the prim to another avatar who does not have any right on the PBR textures.
-> If this other avatar clicks the prim, the UUIDs of the PBR textures are indicated in the chat.
Log In
Maestro Linden
closed
Maestro Linden
Hi Gael, what you're seeing is expected behavior. The PRIM_GLTF_ parameters will show the details of any material GLTF overrides that have been set on the object.
If you wish to prevent scripts from reading the asset_ids contained in the GLTF overrides that have been set on the object, you can bake the overrides into the object like so:
- Click 'Save To Inventory' in the texture tab, and specify a name for the new material. This material will have your overrides baked into it.
- Apply the material asset from inventory onto the prim face. The appearance should be the same as before, but now no overrides are in use.
- If you wish to prevent scripts from looking up the PRIM_RENDER_MATERIAL asset_id, add the material to prim inventory as well.
With these changes in place, the script output becomes:
PRIM_RENDER_MATERIAL : ["baked material"]
PRIM_GLTF_BASE_COLOR : ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000,"","","","",""]
PRIM_GLTF_NORMAL : ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000]
PRIM_GLTF_METALLIC_ROUGHNESS : ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000,"",""]
PRIM_GLTF_EMISSIVE : ["","<1.000000, 1.000000, 0.000000>","<0.000000, 0.000000, 0.000000>",0.000000,""]
In general, if you're worried about scripts looking up varoius details (PRIM_TEXTURE, etc.) of an object you're distributing, the best way to lock it down is to make the object no-modify so that no snooping LSL scripts can be added.
Kristy Aurelia
Maestro Linden "If you wish to prevent scripts from looking up the PRIM_RENDER_MATERIAL asset_id, add the material to prim inventory as well."
Shouldn't the opposite be true? Having material in prim's inventory would allow reading the UUID and not having it, would not allow it. Just like textures for legacy materials?
Gael Streeter
Thank you Maestro Linden for the information.
Is there a documentation somewhere regarding all this mechanism ?
And do you know the reason behind the decision to let the GLTF overrides UUIDs readable ?
Maestro Linden
PRIM_RENDER_MATERIAL is behaving the same as reading textures via llGetTexture() or PRIM_TEXTURE. If the texture exists in prim inventory, the name of the texture will be returned (like "wood1" rather than the asset_id, allowing scripts to get a reference to the texture (which may be no-copy or no-trans) without getting full access to apply the texture anywhere.
Likewise, when a texture or removed material is removed from prim inventory, any references to that asset are automatically removed from prim faces. This is useful to prevent LSL scripts from accessing asset_id of no-copy or no-trans materials/textures.