// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Encode a direction as a normal-map pixel // Not compiled or tested in-world // Setup: Use a spare owned prim. Set nonzero NORMAL. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: This is numerical encoding only. A texture image also needs the intended tangent basis and channel convention. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. vector NORMAL=<0.3,-0.2,1.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(llVecMag(NORMAL)<0.000001) { llOwnerSay("Nonzero normal required."); return; } vector pixel=(llVecNorm(NORMAL)+<1.0,1.0,1.0>)*0.5; llOwnerSay("Encoded pixel="+(string)pixel); } }