Comp 370 Final Project

Solid Texturing using Noise Functions

Chris Schellhaus & Matt Stechschulte

All scenes were created using the POV-ray raytracer

(A)               (B)   



(C)                                

                                                             

(D)    
                                                           
                                                                                         


(E)  

                                                                                           
 
(F)  

                                                                                           

(G)  

                                                                                           

Background Information on Texture and Noise

Computer Graphics using OpenGL
Second Edition
F.S. Hill, Jr.
Chapter 14.8 : Adding Surface Texture

For this project  we are working with creating 3D textures for objects while using noise functions.
3D texturing can be referred to as solid texturing.  Here the textures are like a block of texture with a
third texture coordinate.  A solid texture is represented by a function to create a texture and it produces
a color at every point in the 3D space.  So you could be able to see the texture on the inside of an object
by having for example what you would call the front of the object outside of the view volume.  Doing this
would clip away part of the object.

In making our textures we are experimenting with noise functions.  Noise functions are used to generate
random  values at each point.  The points in space are set up in an integer lattice, which looks like a grid
There is a picture of this on page 772 in reference below.  Every point on the lattice is given a noise value.
The noise values are generated at each time they are needed.  You could use a function as F.S Hill, Jr.in
the book suggests to send in the i, j, and k coordinates as parameters and have it return an apparently
random number.  The function needs to be able to return the same value for each i, j, and k coordinate
every time.  So every coordinate is given a random noise value no you have to decide how to get noise
values for points that are not on integers coordinates for example at (.5, 1.2).  There are ways this can be done
such as nearest neighbor which is the easiest.  Usually some time of interpolation is done.  An easy interpolation
would be linear.  F.S. Hill gives an example using multiple linear interpolations.  Cosine and Cubic interpolations
are examples of others that can be use.

There is also way of generating some more interesting noise functions.  This was developed by
Perlin.  His idea was to mix together different noise components.  This is called Turbulence.
F.S Hill gives an example of using a noise function and fluctuates slowly, then one that fluctuates
twice as fast, and then one that fluctuates 4 times as fast as the first and adding them up to get your
turbulence value.   Here is a link to A web site on Perlin noise.

Two of the most common textures developed with noise functions are wood and marble.
Wood textures are made with concentric circles of different colors.  This is done to look
like the rings you see in a wood grain when for example a log is cut in half.  A modulo function
can be used to switch between values based on a points distance from that axis.  This can be used
to give nice looking circles.  
For example you could have:  simple_wood(x, y, z) = rings(r/M)   //Here r is distance from the axis
and M is the thickness of a ring.  Rings performs a modulo using 2.
F.S Hill also uses a function to add some noisy qualities or some wobble to the rings.  On page 722 it
uses r/M plus a sinusoid. The function it gives is:
rings(r/M  + Ksin( O/N +Bz))  The sinusoidal parts will add waviness to the rings.
O is the angle while N is how many time it wobbles in and out.  K is basically amplitude.  Bz deals with the
phase of the sinusoid, so here it varies with z.
Marble materials have shades of light and dark textures with some regularities, but also
some strange looking irregularities.  F.S. Hill terms it as "veins" of dark  and light material.  It also uses and
undulate function.  An example is given where Sin(z) is the undulate argument and this produces some fluctuation
in z.  This will look regular so turbulence is used to get the best effects for marble.

The Raytracer

As mentioned before, all the scenes above were rendered using the POV-ray raytracer.   It provided us with its
own built-in solid textures, some of which can be manipulated, and others that cannot.   The stone, metal, and
glass textures cannot be manipulated, but the marble and wood textures can.   The appearance of marble and
wood is changed using the keyword turbulence.   If you want your texture to appear without turbulence, set it
to 0.   This will produce marble that consists of straight lines and wood that contains perfect circles.   Making
the turbulence value very high will result in marble that looks like a 'snowy' television screen and wood interior
that does not look even remotely similar to circles.   Achieving a good amount of turbulence is left up to the user
to determine.   Personally, a low amount of turbulence makes wood look the best, and a higher amount makes
marble look better.

Scene Descriptions

(A) This scene shows different types of textures including marble, wood, glass, copper, stone....                        
                                                                                 
(B) This scene is simple and shows some cloud texture as well as water, wood, marble, glass and, chrome.

(C) The sequence of scenes demonstrates the effect of turbulence on the different textures.   The scene on the left
      contains no turbulence, the scene in the center shows a good amount of turbulence, and the scene on the right shows
      an extreme amount of turbulence.

(D) This scene uses a lot of turbulence in the marble texture to produce a 'snowy' television
      screen.   Also the floor is given another  stone like texture which can use a form of
      turbulence to adjust the amount of 'flecks.'   As seen, the darker stone contains fewer
      of these 'flecks' than the reddish stone.   The giant globe on top the television is an example
      of the star texture POV-ray contains.

(E) This scene shows a more realistic image of water.   The waves are governed by a
      function similar to turbulence.   The sphere is reflective chrome and is placed on a marble
      stand.   

(F) Used a chessboard already defined in POV-ray, and added our own pieces.   All
      different types of textures and turbulence values were used to create each piece.   The
      scene depicts the king being captured and lying down.

(G) This is a variation of the scene (E).   It uses a different texture for the sphere
       and uses different colors.   The water can be seen much better using this scene.


Problems We have Experienced

We are having a hardware problem in that the machines we are attempting to render with using OpenGL only
has version 1.1 installed, and 3D texturing requires at least version 1.2.
                                         
We were slow going until we decided to render using the POV-ray raytracer.   Now we have a few scenes and
have been able to experiment with turbulence effects and what not.

Unfortunately, we have no way of importing our turbulence functions into the raytracer.

Task Log

   Date                                                                Task Accomplished

 28-Mar                Choose to implement solid texturing with noise function (marble, wood, etc..).           
                             These will be applied to any of the GLUT defined objects and/or any interesting            
                             objects found on the internet.           

30-Mar                 Got together and located samples of noise functions and began working           
                             on a sample project to implement these functions.   GL_TEXTURE_3D was            
                             an undefined identifier.           
                   
08-Apr                 We attempted to compile the code and discovered we were running on gl.h version           
                             1.1.   Tried to download an updated file.           

12-Apr                 Chris found an updated file of OpenGL.

19-Apr                 We compiled the new file and received the error of an undefined identifier :
                             glTexImage3D.   The definition is in glext.h, but it is not finding it.   Looked for more
                             samples of code to compare to.

23-Apr                 Chris downloaded POV-ray and was able to render marble, wood, etc…..
       
24-Apr                  We produced a scene that contained two objects, a wooden box and a marble sphere.

25-Apr                 Chris rendered another scene that demonstrates many different 3D textures including
                             marble, wood, glass, brass, copper, gold, silver, chrome, and stone.
 
26-Apr                  Matt updated the web page and we rendered more scenes showing the effect of turbulence
                              on the noise functions.

1-May                 We updated the web page with more scenes and added more background information.

2-May                 Matt rendered a scene and we got together to update the webpage.   Matt worked on
                            on the powerpoint presentation, and Chris worked on the README.txt.   We divided
                            up the topics to discuss during tomorrow's presentation.

3-May                 We gave our presentation and finished the required documents to turn in.