This is a fun one, and thanks to my prof for teaching me all about ray tracing

To do bump mapping off of a texture map, let's take a simple example
(no, I am not giving code for this, but I can tell you how to do it)
Let us say your texture is 256x256
and this texture is rgb

Let us make a mesh that is 256x256
pretty simple there

When you create your geometry:
1)You set the vertex
2a)You then get a random number from using that vertex position
        a)This can be done by a random noise function, I have include my .dll
and Noise .java function for you all
                This might be something to put in a FAQ somewhere for people to
use?
        b)You give the DNoise vector your normal at that vertex, and it returns
a perturbed normal for you
2b)Or, if you have a texture all ready, you use that grayscale value, converted
from your rgb, to perturb your normal
3)apply perturbed normal to vertex
4)color vertex according to same random noise
        a)Use the Noise3 function this time, with your x,y,z vertex values
        b)the value coming back will be in the range -1 to 1
        c) and then use that to ramp your colors
5)continue to step 1 until mesh is done

The cool thing about this random noise stuff, is that when you run, the seed
value stays the same, so if you keep putting in the
same x,y,z values, you will get the same perturbation back. Likewise, if you
give it the next increment in the x,y,or z direction, you will not get some wild
random number, you will get a gradient from what the random number beside it is.
That is how you get nice smooth bumps and such.

Hopefully that helps
included files
extNoise.dll
Noise.java
 <<extNoise.dll>>  <<Noise.java>>

Scott Decker
Research Scientist
Pacific Northwest National Labs
[EMAIL PROTECTED]

extNoise.dll

Noise.java

Reply via email to