Class OpenSimplex2S

java.lang.Object
cn.nukkit.level.generator.noise.nukkit.OpenSimplex2S

public class OpenSimplex2S extends Object
K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex") - 2D is standard simplex, modified to support larger kernels. Implemented using a lookup table. - 3D is "Re-oriented 8-point BCC noise" which constructs a congruent BCC lattice in a much different way than usual. - 4D uses a naïve pregenerated lookup table, and averages out to the expected performance. Multiple versions of each function are provided. See the documentation above each, for more info. Taken from https://github.com/KdotJPG/OpenSimplex2/blob/master/java/OpenSimplex2S.java , thanks for having this code public for use!
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpenSimplex2S(long seed)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    noise2(double x, double y)
    2D SuperSimplex noise, standard lattice orientation.
    double
    noise2_XBeforeY(double x, double y)
    2D SuperSimplex noise, with Y pointing down the main diagonal.
    double
    noise3_Classic(double x, double y, double z)
    3D Re-oriented 8-point BCC noise, classic orientation Proper substitute for what 3D SuperSimplex would be, in light of Forbidden Formulae.
    double
    noise3_XYBeforeZ(double x, double y, double z)
    3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y).
    double
    noise3_XZBeforeY(double x, double y, double z)
    3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z).
    double
    noise4_Classic(double x, double y, double z, double w)
    4D SuperSimplex noise, classic lattice orientation.
    double
    noise4_XYBeforeZW(double x, double y, double z, double w)
    4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes.
    double
    noise4_XYZBeforeW(double x, double y, double z, double w)
    4D SuperSimplex noise, with XYZ oriented like noise3_Classic, and W for an extra degree of freedom.
    double
    noise4_XZBeforeYW(double x, double y, double z, double w)
    4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes.

    Methods inherited from class java.lang.Object

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

    • OpenSimplex2S

      public OpenSimplex2S(long seed)
  • Method Details

    • noise2

      public double noise2(double x, double y)
      2D SuperSimplex noise, standard lattice orientation.
    • noise2_XBeforeY

      public double noise2_XBeforeY(double x, double y)
      2D SuperSimplex noise, with Y pointing down the main diagonal. Might be better for a 2D sandbox style game, where Y is vertical. Probably slightly less optimal for heightmaps or continent maps.
    • noise3_Classic

      public double noise3_Classic(double x, double y, double z)
      3D Re-oriented 8-point BCC noise, classic orientation Proper substitute for what 3D SuperSimplex would be, in light of Forbidden Formulae. Use noise3_XYBeforeZ or noise3_XZBeforeY instead, wherever appropriate.
    • noise3_XYBeforeZ

      public double noise3_XYBeforeZ(double x, double y, double z)
      3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Y). Recommended for 3D terrain and time-varied animations. The Z coordinate should always be the "different" coordinate in your use case. If Y is vertical in world coordinates, call noise3_XYBeforeZ(x, z, Y) or use noise3_XZBeforeY. If Z is vertical in world coordinates, call noise3_XYBeforeZ(x, y, Z). For a time varied animation, call noise3_XYBeforeZ(x, y, T).
    • noise3_XZBeforeY

      public double noise3_XZBeforeY(double x, double y, double z)
      3D Re-oriented 8-point BCC noise, with better visual isotropy in (X, Z). Recommended for 3D terrain and time-varied animations. The Y coordinate should always be the "different" coordinate in your use case. If Y is vertical in world coordinates, call noise3_XZBeforeY(x, Y, z). If Z is vertical in world coordinates, call noise3_XZBeforeY(x, Z, y) or use noise3_XYBeforeZ. For a time varied animation, call noise3_XZBeforeY(x, T, y) or use noise3_XYBeforeZ.
    • noise4_Classic

      public double noise4_Classic(double x, double y, double z, double w)
      4D SuperSimplex noise, classic lattice orientation.
    • noise4_XYBeforeZW

      public double noise4_XYBeforeZW(double x, double y, double z, double w)
      4D SuperSimplex noise, with XY and ZW forming orthogonal triangular-based planes. Recommended for 3D terrain, where X and Y (or Z and W) are horizontal. Recommended for noise(x, y, sin(time), cos(time)) trick.
    • noise4_XZBeforeYW

      public double noise4_XZBeforeYW(double x, double y, double z, double w)
      4D SuperSimplex noise, with XZ and YW forming orthogonal triangular-based planes. Recommended for 3D terrain, where X and Z (or Y and W) are horizontal.
    • noise4_XYZBeforeW

      public double noise4_XYZBeforeW(double x, double y, double z, double w)
      4D SuperSimplex noise, with XYZ oriented like noise3_Classic, and W for an extra degree of freedom. Recommended for time-varied animations which texture a 3D object (W=time)