// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Decode a normal-map pixel // Not compiled or tested in-world // Setup: Use a spare owned prim. Set encoded PIXEL. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: Channel conventions vary, especially the green/Y channel. A neutral pixel should be near<0.5,0.5,1>. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. vector PIXEL=<0.65,0.4,0.95>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(PIXEL.x<0.0||PIXEL.y<0.0||PIXEL.z<0.0||PIXEL.x>1.0||PIXEL.y>1.0||PIXEL.z>1.0) { llOwnerSay("Pixel must be0..1."); return; } vector normal=2.0*PIXEL-<1.0,1.0,1.0>; if(llVecMag(normal)<0.000001) { llOwnerSay("Pixel encodes a zero vector."); return; } llOwnerSay("Tangent normal="+(string)llVecNorm(normal)); } }