// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Composite one translucent color over another // Not compiled or tested in-world // Setup: Use a spare owned prim. Set source/destination colors and opacity values0..1. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: The blend is performed directly in the supplied channel space; decode sRGB first for physically meaningful linear-light mixing. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. vector SOURCE=<1.0,0.2,0.0>; vector DEST=<0.0,0.2,1.0>; float SA=0.4; float DA=0.8; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(SA<0.0||SA>1.0||DA<0.0||DA>1.0) { llOwnerSay("Alphas must be0..1."); return; } float alpha=SA+DA*(1.0-SA); vector color=ZERO_VECTOR; if(alpha>0.000001)color=(SOURCE*SA+DEST*DA*(1.0-SA))/alpha; llOwnerSay("Composite RGB="+(string)color+" alpha="+(string)alpha); } }