diff --git a/noise/noise.pas b/noise/noise.pas
new file mode 100644
index 000000000..2196be0c1
--- /dev/null
+++ b/noise/noise.pas
@@ -0,0 +1,56 @@
+unit noise;
+
+{$ifdef fpc}
+ {$mode delphi}
+{$endif}
+
+interface
+
+uses
+ Classes, SysUtils;
+
+function IntNoise(x: Integer): Double;
+
+function Linear_Interpolate(a, b, x: Double): Double;
+function Cosine_Interpolate(a, b, x: Double): Double;
+function Cubic_Interpolate(v0, v1, v2, v3, x: Double): Double;
+
+implementation
+
+function IntNoise(x: Integer): Double;
+var
+ xl: Integer;
+begin
+ xl := (x shl 13) xor x;
+ Result := (xl * (xl * xl * 15731 + 789221) + 1376312589) and $7fffffff;
+ Result := 1.0 - (Result / 1073741824.0);
+end;
+
+function Linear_Interpolate(a, b, x: Double): Double;
+begin
+ Result := a * (1-x) + b * x;
+end;
+
+function Cosine_Interpolate(a, b, x: Double): Double;
+var
+ f, ft: Double;
+begin
+ ft := x * Pi;
+ f := (1.0 - cos(ft)) * 0.5;
+ Result := a * (1 - f) + b * f;
+end;
+
+function Cubic_Interpolate(v0, v1, v2, v3, x: Double): Double;
+var
+ P, Q, R, S: Double;
+begin
+ P := (v3 - v2) - (v0 - v1);
+ Q := (v0 - v1) - P;
+ R := v2 - v0;
+ S := v1;
+
+ Result := P * x * x * x + Q * x * x + R * x + S;
+end;
+
+end.
+
diff --git a/noise/noise1d.dpr b/noise/noise1d.dpr
new file mode 100644
index 000000000..2711dbcf7
--- /dev/null
+++ b/noise/noise1d.dpr
@@ -0,0 +1,113 @@
+program noise1d;
+
+{$ifdef fpc}
+ {$mode delphi}
+{$endif}
+
+uses
+ {$ifdef fpc}
+ Interfaces, // this includes the LCL widgetset
+ {$endif}
+ Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
+ noise;
+
+type
+
+ { TMainWindow }
+
+ TMainWindow = class(TForm)
+ private
+ { private declarations }
+ SelectInterpolation: TComboBox;
+ procedure DoPaint(Sender: TObject);
+ procedure DoRefresh(Sender: TObject);
+ function NormalizeNoise(x: Double): Integer;
+ public
+ { public declarations }
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
+ end;
+
+var
+ vMainWindow: TMainWindow;
+
+{ TMainWindow }
+
+procedure TMainWindow.DoPaint(Sender: TObject);
+var
+ i, j, interpolation: Integer;
+begin
+ { Draws rulers }
+ Canvas.MoveTo(25, 25 );
+ Canvas.LineTo(25, 275);
+ Canvas.LineTo(275, 275);
+
+ { Draws 12 points and the interpolation between them }
+ for i := 0 to 11 do
+ begin
+ Canvas.Ellipse(i * 20 + 25 + 1, NormalizeNoise(IntNoise(i)) + 1,
+ i * 20 + 25 - 1, NormalizeNoise(IntNoise(i)) - 1);
+
+ if (i = 11) then Continue;
+
+ for j := 1 to 19 do
+ begin
+ case SelectInterpolation.ItemIndex of
+ 0: interpolation := Linear_Interpolate(NormalizeNoise(IntNoise(i)), NormalizeNoise(IntNoise(i + 1)), j / 20);
+ 1: interpolation := Cosine_Interpolate(NormalizeNoise(IntNoise(i)), NormalizeNoise(IntNoise(i + 1)), j / 20);
+ else
+ interpolation := Cubic_Interpolate(NormalizeNoise(IntNoise(i - 1)),
+ NormalizeNoise(IntNoise(i)), NormalizeNoise(IntNoise(i + 1)),
+ NormalizeNoise(IntNoise(i + 2)), j / 20);
+ end;
+
+ Canvas.Pixels[i * 20 + 25 + j, interpolation] := clBlack;
+ end;
+ end;
+end;
+
+procedure TMainWindow.DoRefresh(Sender: TObject);
+begin
+ Repaint;
+end;
+
+function TMainWindow.NormalizeNoise(x: Double): Integer;
+begin
+ Result := Round( 25 + (x + 1.0) * 125 );
+end;
+
+constructor TMainWindow.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+
+ Position := poScreenCenter;
+ Width := 300;
+ Height := 300;
+ Caption := 'Noise 1D';
+
+ OnPaint := DoPaint;
+
+ SelectInterpolation := TComboBox.Create(Self);
+ SelectInterpolation.Parent := Self;
+ SelectInterpolation.Items.Add('Linear Interpolation');
+ SelectInterpolation.Items.Add('Cosine Interpolation');
+ SelectInterpolation.Items.Add('Cubic Interpolation');
+ SelectInterpolation.Left := 100;
+ SelectInterpolation.Width := 200;
+ SelectInterpolation.ItemIndex := 0;
+
+ SelectInterpolation.OnChange := DoRefresh;
+end;
+
+destructor TMainWindow.Destroy;
+begin
+
+ inherited Destroy;
+end;
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TMainWindow, vMainWindow);
+ Application.Run;
+end.
+
diff --git a/noise/noise1d.lpi b/noise/noise1d.lpi
new file mode 100644
index 000000000..e7d117815
--- /dev/null
+++ b/noise/noise1d.lpi
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/noise/perlin1d.dpr b/noise/perlin1d.dpr
new file mode 100644
index 000000000..5f92da3e3
--- /dev/null
+++ b/noise/perlin1d.dpr
@@ -0,0 +1,170 @@
+program perlin1d;
+
+{$ifdef fpc}
+ {$mode delphi}
+{$endif}
+
+uses
+ {$ifdef fpc}
+ Interfaces, // this includes the LCL widgetset
+ {$endif}
+ Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
+ noise;
+
+type
+
+ { TMainWindow }
+
+ TMainWindow = class(TForm)
+ private
+ { private declarations }
+ G1, G2, G3, G4: array of double;
+ SelectInterpolation: TComboBox;
+ procedure DoPaint(Sender: TObject);
+ procedure DoRefresh(Sender: TObject);
+ procedure DoPaintGraph(Graph: array of Double; StartX, StartY, WL, A, NPoints: Integer);
+ procedure DoCalculateNoise(Graph: array of Double; WL, NPoints: Integer);
+ function NormalizeNoise(x: Double; Amplitude: Integer): Integer;
+ public
+ { public declarations }
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
+ end;
+
+var
+ vMainWindow: TMainWindow;
+
+{ TMainWindow }
+
+procedure TMainWindow.DoPaint(Sender: TObject);
+begin
+ SetLength(G1, 20 * 12);
+ DoCalculateNoise(G1, 20, 12);
+ DoPaintGraph(G1, 25, 25, 20, 250, 12);
+
+{ SetLength(G3, 40 * 6);
+ DoPaintGraph(G2, 325, 25, 40, 125, 6);
+
+ SetLength(G3, 80 * 3);
+ DoPaintGraph(G3, 25, 325, 80, 62, 3);}
+end;
+
+procedure TMainWindow.DoRefresh(Sender: TObject);
+begin
+ Repaint;
+end;
+
+{*******************************************************************
+* TMainWindow.DoCalculateNoise ()
+*
+* DESCRIPTION: Creates a array with a 1D Noise plus interpolation
+*
+* PARAMETERS: Graph - Array to store the points
+* WL - Wavelength in units.
+* Those are filled with interpolation
+* NPoints - Number of Noise points to be created
+*
+*******************************************************************}
+procedure TMainWindow.DoCalculateNoise(Graph: array of Double; WL, NPoints: Integer);
+var
+ i, j: Integer;
+ interpolation: Double;
+begin
+ for i := 0 to NPoints - 1 do
+ begin
+ Graph[i * WL] := IntNoise(i);
+
+ if (i = NPoints - 1) then Continue;
+
+ for j := 1 to WL - 1 do
+ begin
+ case SelectInterpolation.ItemIndex of
+ 0: interpolation := Linear_Interpolate(IntNoise(i), IntNoise(i + 1), j / WL);
+ 1: interpolation := Cosine_Interpolate(IntNoise(i), IntNoise(i + 1), j / WL);
+ else
+ interpolation := Cubic_Interpolate(IntNoise(i - 1), IntNoise(i),
+ IntNoise(i + 1), IntNoise(i + 2), j / WL);
+ end;
+
+ Graph[i * WL + j] := interpolation;
+ end;
+ end;
+end;
+
+{*******************************************************************
+* TMainWindow.DoPaintGraph ()
+*
+* DESCRIPTION: Draws a graphic that represents a 1D Noise function
+*
+* PARAMETERS: Graph - Array to store the points
+* StartX - Starting X position for the graphic
+* StartY - Starting Y position for the graphic
+* WL - Wavelength in pixels
+* A - Amplitude in pixels
+* NPoints - Number of points to be drawn
+*
+*******************************************************************}
+procedure TMainWindow.DoPaintGraph(Graph: array of Double; StartX, StartY, WL, A, NPoints: Integer);
+var
+ i, j: Integer;
+begin
+ { Draws rulers }
+ Canvas.MoveTo(StartX, StartY );
+ Canvas.LineTo(StartX, StartY + 250);
+ Canvas.LineTo(StartX + 250, StartY + 250);
+
+ { Draws NPoints points and the interpolation between them }
+ for i := 0 to NPoints - 1 do
+ begin
+ Canvas.Ellipse(i * WL + StartX + 1, NormalizeNoise(Graph[i], A) + StartY + 1,
+ i * WL + StartX - 1, NormalizeNoise(Graph[i], A) + StartY - 1);
+
+ if (i = NPoints - 1) then Continue;
+
+ for j := 1 to WL - 1 do
+ begin
+ Canvas.Pixels[i * WL + StartX + j, NormalizeNoise(Graph[i * WL + j], A) + StartY] := clBlack;
+ end;
+ end;
+end;
+
+function TMainWindow.NormalizeNoise(x: Double; Amplitude: Integer): Integer;
+begin
+ Result := Round( 125 + x * Amplitude / 2 );
+end;
+
+constructor TMainWindow.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+
+ Position := poScreenCenter;
+ Width := 600;
+ Height := 600;
+ Caption := 'Perlin Noise 1D';
+
+ OnPaint := DoPaint;
+
+ SelectInterpolation := TComboBox.Create(Self);
+ SelectInterpolation.Parent := Self;
+ SelectInterpolation.Items.Add('Linear Interpolation');
+ SelectInterpolation.Items.Add('Cosine Interpolation');
+ SelectInterpolation.Items.Add('Cubic Interpolation');
+ SelectInterpolation.Left := 100;
+ SelectInterpolation.Width := 200;
+ SelectInterpolation.ItemIndex := 0;
+
+ SelectInterpolation.OnChange := DoRefresh;
+end;
+
+destructor TMainWindow.Destroy;
+begin
+
+ inherited Destroy;
+end;
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TMainWindow, vMainWindow);
+ Application.Run;
+end.
+
diff --git a/noise/perlin1d.lpi b/noise/perlin1d.lpi
new file mode 100644
index 000000000..3c7e60633
--- /dev/null
+++ b/noise/perlin1d.lpi
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+