j3d.org Code

org.j3d.texture.procedural Class PerlinNoiseGenerator

```java.lang.Object
org.j3d.texture.procedural.PerlinNoiseGenerator
```

`public class PerlinNoiseGeneratorextends java.lang.Object`

Computes Perlin Noise for three dimensions.

The result is a continuous function that interpolates a smooth path along a series random points. The function is consitent, so given the same parameters, it will always return the same value. The smoothing function is based on the Improving Noise paper presented at Siggraph 2002.

Computing noise for one and two dimensions can make use of the 3D problem space by just setting the un-needed dimensions to a fixed value.

Version:
\$Revision: 1.4 \$
Author:
Justin Couch

Constructor Summary
`PerlinNoiseGenerator()`
Create a new noise creator with the default seed value
`PerlinNoiseGenerator(int seed)`
Create a new noise creator with the given seed value for the randomness

Method Summary
` double` ```imporvedTurbulence(double x, double y, double z, float loF, float hiF)```
Create a turbulent noise output based on the core noise function.
` double` ```improvedNoise(double x, double y, double z)```
Computes noise function for three dimensions at the point (x,y,z).
` float` `noise1(float x)`
1-D noise generation function using the original perlin algorithm.
` float` ```noise2(float x, float y)```
Create noise in a 2D space using the orignal perlin noise algorithm.
` float` ```noise3(float x, float y, float z)```
Create noise in a 3D space using the orignal perlin noise algorithm.
` float` ```tileableNoise1(float x, float w)```
Create a 1D tileable noise function for the given width.
` float` ```tileableNoise2(float x, float y, float w, float h)```
Create a 2D tileable noise function for the given width and height.
` float` ```tileableNoise3(float x, float y, float z, float w, float h, float d)```
Create a 3D tileable noise function for the given width, height and depth.
` float` ```tileableTurbulence2(float x, float y, float w, float h, float freq)```
Create a turbulance function that can be tiled across a surface in 2D.
` float` ```tileableTurbulence3(float x, float y, float z, float w, float h, float d, float freq)```
Create a turbulance function that can be tiled across a surface in 3D.
` float` ```turbulence2(float x, float y, float freq)```
Create a turbulance function in 2D using the original perlin noise function.
` float` ```turbulence3(float x, float y, float z, float freq)```
Create a turbulance function in 3D using the original perlin noise function.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

PerlinNoiseGenerator

`public PerlinNoiseGenerator()`
Create a new noise creator with the default seed value

PerlinNoiseGenerator

`public PerlinNoiseGenerator(int seed)`
Create a new noise creator with the given seed value for the randomness

Parameters:
`seed` - The seed value to use
Method Detail

improvedNoise

```public double improvedNoise(double x,
double y,
double z)```
Computes noise function for three dimensions at the point (x,y,z).

Parameters:
`x` - x dimension parameter
`y` - y dimension parameter
`z` - z dimension parameter
Returns:
the noise value at the point (x, y, z)

noise1

`public float noise1(float x)`
1-D noise generation function using the original perlin algorithm.

Parameters:
`x` - Seed for the noise function
Returns:
The noisy output

noise2

```public float noise2(float x,
float y)```
Create noise in a 2D space using the orignal perlin noise algorithm.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
Returns:
A noisy value at the given position

noise3

```public float noise3(float x,
float y,
float z)```
Create noise in a 3D space using the orignal perlin noise algorithm.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
`z` - The Z coordinate of the location to sample
Returns:
A noisy value at the given position

imporvedTurbulence

```public double imporvedTurbulence(double x,
double y,
double z,
float loF,
float hiF)```
Create a turbulent noise output based on the core noise function. This uses the noise as a base function and is suitable for creating clouds, marble and explosion effects. For example, a typical marble effect would set the colour to be:
```    sin(point + turbulence(point) * point.x);
```

turbulence2

```public float turbulence2(float x,
float y,
float freq)```
Create a turbulance function in 2D using the original perlin noise function.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
`freq` - The frequency of the turbluance to create
Returns:
The value at the given coordinates

turbulence3

```public float turbulence3(float x,
float y,
float z,
float freq)```
Create a turbulance function in 3D using the original perlin noise function.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
`z` - The Z coordinate of the location to sample
`freq` - The frequency of the turbluance to create
Returns:
The value at the given coordinates

tileableNoise1

```public float tileableNoise1(float x,
float w)```
Create a 1D tileable noise function for the given width.

Parameters:
`x` - The X coordinate to generate the noise for
`w` - The width of the tiled block
Returns:
The value of the noise at the given coordinate

tileableNoise2

```public float tileableNoise2(float x,
float y,
float w,
float h)```
Create a 2D tileable noise function for the given width and height.

Parameters:
`x` - The X coordinate to generate the noise for
`y` - The Y coordinate to generate the noise for
`w` - The width of the tiled block
`h` - The height of the tiled block
Returns:
The value of the noise at the given coordinate

tileableNoise3

```public float tileableNoise3(float x,
float y,
float z,
float w,
float h,
float d)```
Create a 3D tileable noise function for the given width, height and depth.

Parameters:
`x` - The X coordinate to generate the noise for
`y` - The Y coordinate to generate the noise for
`z` - The Z coordinate to generate the noise for
`w` - The width of the tiled block
`h` - The height of the tiled block
`d` - The depth of the tiled block
Returns:
The value of the noise at the given coordinate

tileableTurbulence2

```public float tileableTurbulence2(float x,
float y,
float w,
float h,
float freq)```
Create a turbulance function that can be tiled across a surface in 2D.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
`w` - The width to tile over
`h` - The height to tile over
`freq` - The frequency of the turbluance to create
Returns:
The value at the given coordinates

tileableTurbulence3

```public float tileableTurbulence3(float x,
float y,
float z,
float w,
float h,
float d,
float freq)```
Create a turbulance function that can be tiled across a surface in 3D.

Parameters:
`x` - The X coordinate of the location to sample
`y` - The Y coordinate of the location to sample
`z` - The Z coordinate of the location to sample
`w` - The width to tile over
`h` - The height to tile over
`d` - The depth to tile over
`freq` - The frequency of the turbluance to create
Returns:
The value at the given coordinates

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org