Class NoiseFunctions

java.lang.Object
swingtree.style.NoiseFunctions

public final class NoiseFunctions extends Object
A collection of noise functions that can be used to generate procedural textures. The functions in this class are also supposed to serve as an example which demonstrates how to create procedural textures yourself.
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    cells(float xIn, float yIn)
     
    static float
    clouds(float xIn, float yIn)
    Soft, billowing clouds produced by fractal Brownian motion and a sigmoid contrast curve which crisps the cloud edges up against the open sky.
    static float
    cracks(float xIn, float yIn)
    A network of thin cracks separating irregular plates, computed from the difference between the two closest Worley (Voronoi) feature points.
    static float
    fabric(float xIn, float yIn)
     
    static float
    flow(float xIn, float yIn)
    A fluid, organic flow field produced by "domain warping": fractal noise is sampled at coordinates that are themselves displaced by other fractal noise.
    static float
    foliage(float xIn, float yIn)
    A leafy foliage texture.
    static float
    grainy(float xIn, float yIn)
     
    static float
    hardSpots(float xIn, float yIn)
     
    static float
    hardTopology(float xIn, float yIn)
     
    static float
    haze(float xIn, float yIn)
     
    static float
    lightning(float xIn, float yIn)
    Crackling electric arcs.
    static float
    mandelbrot(float xIn, float yIn)
     
    static float
    marble(float xIn, float yIn)
    A turbulent marble texture: a regular striped pattern is distorted by several octaves of value noise, bending the stripes into organic, swirling veins.
    static float
    plasma(float xIn, float yIn)
    A smooth, flowing interference pattern built from a handful of summed sine waves - the classic "plasma" demo effect, great for vivid color gradients.
    static double
    projectPointOntoLine(double x1, double y1, double x2, double y2, double px, double py)
     
    static float
    retro(float xIn, float yIn)
     
    static float
    smoothSpots(float xIn, float yIn)
     
    static float
    smoothTopology(float xIn, float yIn)
     
    static float
    spirals(float xIn, float yIn)
     
    static float
    stochastic(float xIn, float yIn)
     
    static float
    tiles(float xIn, float yIn)
     
    static float
    voronoiBasedCellMosaic(float xIn, float yIn)
     
    static float
    voronoiBasedCellTissue(float xIn, float yIn)
     
    static float
    voronoiBasedPolygonCell(float xIn, float yIn)
     
    static float
    voronoiBasedPondInDrizzle(float xIn, float yIn)
     
    static float
    voronoiBasedPondInRain(float xIn, float yIn)
     
    static float
    voronoiBasedPondOfStrings(float xIn, float yIn)
     
    static float
    voronoiBasedPondOfTangledStrings(float xIn, float yIn)
     
    static float
    vortex(float xIn, float yIn)
    A swirling vortex created by rotating the sampling angle as a function of the radius and an underlying fractal noise field.
    static float
    wood(float xIn, float yIn)
    Concentric, slightly distorted growth rings reminiscent of a cross-cut piece of timber.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • stochastic

      public static float stochastic(float xIn, float yIn)
    • smoothTopology

      public static float smoothTopology(float xIn, float yIn)
    • hardTopology

      public static float hardTopology(float xIn, float yIn)
    • hardSpots

      public static float hardSpots(float xIn, float yIn)
    • smoothSpots

      public static float smoothSpots(float xIn, float yIn)
    • grainy

      public static float grainy(float xIn, float yIn)
    • tiles

      public static float tiles(float xIn, float yIn)
    • fabric

      public static float fabric(float xIn, float yIn)
    • retro

      public static float retro(float xIn, float yIn)
    • cells

      public static float cells(float xIn, float yIn)
    • haze

      public static float haze(float xIn, float yIn)
    • spirals

      public static float spirals(float xIn, float yIn)
    • mandelbrot

      public static float mandelbrot(float xIn, float yIn)
    • voronoiBasedCellTissue

      public static float voronoiBasedCellTissue(float xIn, float yIn)
    • voronoiBasedCellMosaic

      public static float voronoiBasedCellMosaic(float xIn, float yIn)
    • voronoiBasedPolygonCell

      public static float voronoiBasedPolygonCell(float xIn, float yIn)
    • projectPointOntoLine

      public static double projectPointOntoLine(double x1, double y1, double x2, double y2, double px, double py)
    • voronoiBasedPondInDrizzle

      public static float voronoiBasedPondInDrizzle(float xIn, float yIn)
    • voronoiBasedPondInRain

      public static float voronoiBasedPondInRain(float xIn, float yIn)
    • voronoiBasedPondOfStrings

      public static float voronoiBasedPondOfStrings(float xIn, float yIn)
    • voronoiBasedPondOfTangledStrings

      public static float voronoiBasedPondOfTangledStrings(float xIn, float yIn)
    • marble

      public static float marble(float xIn, float yIn)
      A turbulent marble texture: a regular striped pattern is distorted by several octaves of value noise, bending the stripes into organic, swirling veins.
    • wood

      public static float wood(float xIn, float yIn)
      Concentric, slightly distorted growth rings reminiscent of a cross-cut piece of timber. The rings are warped by fractal noise to give them a natural grain.
    • plasma

      public static float plasma(float xIn, float yIn)
      A smooth, flowing interference pattern built from a handful of summed sine waves - the classic "plasma" demo effect, great for vivid color gradients.
    • clouds

      public static float clouds(float xIn, float yIn)
      Soft, billowing clouds produced by fractal Brownian motion and a sigmoid contrast curve which crisps the cloud edges up against the open sky.
    • cracks

      public static float cracks(float xIn, float yIn)
      A network of thin cracks separating irregular plates, computed from the difference between the two closest Worley (Voronoi) feature points.
    • vortex

      public static float vortex(float xIn, float yIn)
      A swirling vortex created by rotating the sampling angle as a function of the radius and an underlying fractal noise field.
    • flow

      public static float flow(float xIn, float yIn)
      A fluid, organic flow field produced by "domain warping": fractal noise is sampled at coordinates that are themselves displaced by other fractal noise.
    • lightning

      public static float lightning(float xIn, float yIn)
      Crackling electric arcs. A fractal noise field is traced along the contour where it crosses its mid value - that contour naturally branches and loops - while a jagged domain warp makes the arcs zig-zag like a real discharge.

      The contour is rendered as a uniformly thin bolt by dividing the distance to the mid value by the local gradient: |field - 0.5| / |gradient| is an estimate of the true distance to the contour, so the bolt keeps the same width regardless of how steep the field is (no fat blobs on flat spots).

    • foliage

      public static float foliage(float xIn, float yIn)
      A leafy foliage texture. Leaves are scattered from a jittered grid - jittered far enough that the underlying grid disappears - and layered by a random depth so they overlap naturally. To avoid a sterile, too-perfect look, every leaf is individually irregular: its spine bends like a banana, its outline is asymmetric (rounded toward the base, drawn to a point at the tip) with a wavy edge, and its surface is broken up by value-noise mottling. Each leaf carries a lit midrib and faint herringbone side veins, and leaves further back are shaded darker for depth.