Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
random_surface(3)		  Arcan Lua API 	       random_surface(3)

NAME
     random_surface - Generate a pseudo-random image surface.

SYNOPSIS
     vid
     random_surface( int:width, int:height )
     random_surface( int:width, int:height, string:method=uniform-3 )
     random_surface( int:width, int:height, string:method=uniform-4 )
     random_surface( int:width, int:height, string:method=fbm, float:lacunarity,
     float:gain, float:octaves, int:xstart, int:ystart, int:z )
     random_surface( width, height, method )

DESCRIPTION
     This  function  is  used  to  create  pseudorandom noise textures, a useful
     building block in many graphics effects. If no method or an unknown one  is
     specified,  it will default to 1 channel randomness from the global csprng,
     duplicated into the RGB  channels of a RGBA   destination	buffer	(A=fully
     opaque).  The  other  methods,  uniform-3 and uniform-4 work similarly, but
     have different values in 3 or all 4 channels.  FBM  creates  fractal  noise
     by adding multiple octaves of perlin noise together.

EXAMPLE
     function random_surface0()
	   a = random_surface(64, 64);
	   b = random_surface(64, 64, "uniform-3");
	   c = random_surface(64, 64, "fbm", 2, 0.5, 6, 0, 0, 0);
	   show_image({a,b,c});
	   move_image(b, 64, 0);
	   move_image(c, 0, 64);
     end

image				   August 2026		       random_surface(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=random_surface&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help