// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Touch-sampled smooth value noise // Not compiled or tested in-world // Setup: Put in a spare ordinary cube you own. Touch different places on one face to sample the procedural pattern at live surface coordinates. Edit the constants to design a pattern. // Stop / restore: Disable/remove. Only private owner messages are produced; no texture or tint is applied. // Notes: The sine hash is decorative and may vary slightly across floating-point implementations; it is not secure randomness. Surface coordinates depend on the viewer and mesh; ordinary prim faces are the clearest test surface. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Live surface-coordinate sampler. float FREQUENCY=6.0; float hash(float x,float y) { float n=llSin(x*127.1+y*311.7)*43758.5453; return n-llFloor(n); } float noise(vector q) { integer x=llFloor(q.x); integer y=llFloor(q.y); float u=q.x-x; float v=q.y-y; u=u*u*(3.0-2.0*u); v=v*v*(3.0-2.0*v); float a=hash(x,y); float b=hash(x+1,y); float c=hash(x,y+1); float d=hash(x+1,y+1); return (a+(b-a)*u)*(1.0-v)+(c+(d-c)*u)*v; } default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; vector uv=llDetectedTouchST(0); if(llDetectedTouchFace(0)<0||uv==TOUCH_INVALID_TEXCOORD) { llOwnerSay("Surface coordinates unavailable."); return; } vector p=2.0*uv-<1.0,1.0,0.0>; if(FREQUENCY<=0.0) { llOwnerSay("Positive frequency required."); return; } llOwnerSay("Smooth noise="+(string)noise(uv*FREQUENCY)); } }