CG:SKEELOGY
CG:SKEELOGY
CATEGORIES
   REELS
       + demo reels (2)
   PROJECTS
       + games (4)
       + VFX & animations (4)
   PROGRAMMING
       + simulations (8)
       + computer vision (4)
       + rigging & deformation (4)
       + computer graphics (3)
       + artificial intelligence (2)
       + game technologies (2)
   CG
       + rigs (7)
       + models (7)
       + effects & simulations (3)
   TUTORIALS
       + physics simulation (1)
   ME
       + honours & awards (8)
       + events (7)
       + updates (3)
FEATURED PROJECTS
Soft Body Tutorial: Program soft bodies in XNA!
Cloud Guardian: Shape the Orb to fix clouds!
Muskeelar: Muscle system for games
LATEST UPDATES
  + Now On Twitter   + CG:Skeelogy v1.1: The Web 2.0 Version   + Best Physics Knowledge Base Entry In Intel Havok Physics Contest!   + Community Voting Prize In Intel Havok Physics Contest   + Working at Double Negative in London
TAGS
ARCHIVES
 
 
 
CURRENTLY VIEWING
SOLID TEXTURES
Generating a wood solid texture in OpenGL
DATE
TYPE
EFFORT
Mar 2007
Texturing
Solo
Solid Textures
@ programming > computer graphics
SECTION MENU
     + Depth Of Field Using Raytracing
     + Solid Textures
     + Raytracing

The wood texture that I have created is simply an offset to a cosine noise function. For any 3D point P(x,y,z), the wood texture is obtained by using cos(P.x + turbulence(P))/2+0.5. The last two numbers are used to clamp the result to [0, 1]. The final color produced by this wood function is modulated with a brown RGB color value.

The turbulence() function above is created by adding up the values of noise with different octaves. Each successive noise added should have twice the previous frequency (thus an octave) and half the amplitude. For noise i, the frequency is 2i and the amplitude is pi, where p is the persistence of the noise. Each successive addition of an octave will include noisier details to the result.

Turbulence render with: Octaves = 3, Persistence = 4
Turbulence render with: Octaves = 3, Persistence = 4

Turbulence render with: Octaves = 1, Persistence = 1
Turbulence render with: Octaves = 1, Persistence = 1

Turbulence render with: Octaves = 5, Persistence = 2
Turbulence render with: Octaves = 5, Persistence = 2 (Doesn’t look like wood anymore but I just wanted to show various settings)

Since wood textures normally stretch in a certain direction, I stretched the wood texture by multiplying a texture vector T(tx, ty, tz) where each element is the texture repeat factor for that axis e.g. T(2, 0.5, 1) will repeat texture in X-axis twice, stretch texture in Y-axis by 2 times, and no change texture in Z-axis. We obtain the result R by multiplying this vector T with the point P(x,y,z) as such: R = (tx*x, ty*y, tz*z).

So then how do we obtain the noise function? I used the gradient noise method to generate the pseudo-random noise values, similar to what Ken Perlin has suggested in his 1985 paper. A 3D grid with vertices at integer values is defined. Each vertex on the grid has a value of 0 and has an associated pseudo-random gradient vector. To obtain a value of any point within the grid, a trilinear interpolation (total of 7 linear interpolations) is applied on the 8 grid vertices surrounding the given point. Basically, given any point in the 3D space of the grid, I am now able to return the noise value associated with the point. An important characteristic of this noise function is that it must be pseudo-random and not really random i.e. it must return the same “random” noise value when the same (x,y,z) values are supplied.

Note: As this is part of a group project, this 3D wood texture is created by modifying a distributed raytracer done by my groupmate Neo Jiet Shern.

  • Share/Save/Bookmark
Tags: ,

Related posts


Leave a comment:


Allows tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
CG:SKEELOGY
ABOUT ME
I have experience with physics simulation programming, character rigging and R&D on anatomical and deformable models. In my free time, I work on small personal projects such as casual games and tools development.
I am currently working at Double Negative Visual Effects in London.
MY OTHER SITES
SUBSCRIBE TO SITE
SHARE THIS SITE
Copyright © 2003-2010.
All works are original ones by Skeel, unless otherwise stated.