3D Perlin Noise Generation in Hardware Using CG

By: Andrew DeKelaita

CPE471

 

Introduction

 

For my project I implemented 3D Perlin Noise in Hardware using CG and OpenGL. If you are doing a project or interested in learning about

 

            1.Perlin Noise

            2.Vertex Shading using CG

 

this website may help you.

 

Project Goal

 

Using OpenGL as my API, I worked on the vertex processing portion of the programmable graphics pipeline. The goal was to manipulate vertices of objects as to implement the 3d Perlin Noise Algorithm using hardware.

 

Purpose

 

The purpose of implementing the algorithm through a graphics card is that the card will take the burden of calculations off the CPU, and the program using the algorithm will run smoother. For the noise algorithm, I will be using an existing noise algorithm found at:

 

            http://mrl.nyu.edu/~perlin/noise/

 

Perlin Noise

 

Perlin Noise is a method to generate random noise functions by using the idea that summing signals with different frequencies leads to destructive interference. In Perlin’s case, he generated noise by summing functions whos reuqency term differed by 2­n.

 

Example:

 

noise(x) = a0f0(vx) + a1f1(2vx) + a2f2(4vx) + a3f3(8vx) + a4f4(16vx) + … + anfn(2­nvx)

 

In some cases the amplitude an is decreased at a rate inverse to the frequency (e.g. a0 is 2­n-1 larger than an). For this discussion the amplitude term will be ignored.

 

The reason the amplitude term is ignored is due to the fact the amiltude of any noise function is always scaled down between -1 and 1.

 

Main goal of this project was to develop a noise function in three dimensions: Fnoise(x,y,z). The main task was to look for a function which could manipulate verticies in three dimensions. The eqation is used in the program:

 

Let x,y,z represent components of a vertex K such that the noise Fnoise the vertex K. The algoirhtm used to generate the noise would be:

 

noise(x,y,z) = sin(x)*sin(y)*sin(z) +

                      sin(2x)*sin(2y)*sin(4z) +

                        sin(4x)*sin(4y)*sin(4z)…

 

 

Here are Some Screen Shots for the Noise Generation in my program:

 

 

 

 

 

 

 

 

CG

 

For my project is was also important that I learn CG. CG, which stands for “C for Graphics” and is Nvidia’s shading language. Here is some sample code:

 

 

void vp_reflection(float4 position : POSITION,

                   uniform float4x4 modelView,

                   out float4 outPos  : POSITION,

                    out float4 outCol  : COLOR){

 

outpos = mul(position,modelView);

outCol = float4(1.0,0.0,0.0,1.0);

 

}

 

The above program takes a set of input verticies, multiplies them by the specified ModelView matrix and outputs them in red.

 

Program Controls

 

‘L’ – Decrease Noise

‘K’ – Increase Noise

 

‘Q’ – Zoom In

‘A’ – Zoom Out

Mouse – Move Camera

 

Resources

 

CG Resources

http://www.cescg.org/CESCG-2004/web/Zdrojewska-Dorota/

 

http://www.csee.umbc.edu/~olano/s2006c03/ch05.pdf

 

GPU Programming Resource

http://www.cis.upenn.edu/~suvenkat/700/

 

Cloth Simulation Resource

http://developer.nvidia.com/object/gdc2001_clothsim.html

 

Perlin Noise Resource

http://www.cse.ohio-state.edu/~nouanese/781/finalproject.htm

 

http://www.mandelbrot-dazibao.com/Perlin/Perlin1.htm