[comp.graphics] Turbulence functions

po0o+@andrew.cmu.edu (Paul Andrew Olbrich) (09/13/89)

>  The combination of 3-d spacial texture mapping with a nice 3-d
>  turbulence function can give really neat results for marble, wood,
>  and such.

Could someone please post an example of a turbulence function, or
provide pointers to one?  I am very interested in using this idea in a
ray tracer that I am working on.  Thank you!

Drew Olbrich
po0o+@andrew.cmu.edu

ranjit@grad2.cis.upenn.edu (Ranjit Bhatnagar) (09/14/89)

>>  [Ranjit]The combination of 3-d spacial texture mapping with a nice 3-d
>>  turbulence function can give really neat results for marble, wood,
>>  and such.
>Could someone please post an example of a turbulence function, or
>provide pointers to one?  I am very interested in using this idea in a
>ray tracer that I am working on.  Thank you!
>   Drew Olbrich  po0o+@andrew.cmu.edu

The ideas of 3-d texture maps (perhaps we should call them texture
fields? :-) and the turbulence function appear - along with lots of
other neat ideas - in SIGGRAPH 85: 
	Solid Texturing of Complex Surfaces - Darwyn Peachey
	An Image Synthesizer - Ken Perlin

If someone's collecting a Commonly-Asked Questions of comp.graphics
file, this should probably go in there to encourage more people to
read these papers.

In March, Jon Buller (bullerj@handel.colostate.edu) posted a set of
turbulence routines in Pascal, and William Dirks (dirks@oak.cis.ohio-state.edu)
posted a translation into C in April.  I never got around to trying
them myself (drat), but I'll send a copy of those postings to
interested parties.  Perhaps Jon and William would like to repost
their code?

	- ranjit


"Trespassers w"   ranjit@eniac.seas.upenn.edu	mailrus!eecae!netnews!eniac!...
	   "Such a brute that even his shadow breaks things." (Lorca)

prem@geomag.fsu.edu (Prem Subrahmanyam) (09/14/89)

   I would suggest getting a copy of DBW_Render.  We have one lurking on
   our anon. ftp account (geomag.gly.fsu.edu 128.186.10.2).  It's under
   the directory /pub/pics/DBW.src.  In cal.c, it has all the turbulence/
   wave-mapping/noise functions (all based on wave sources defined by the
   user at run-time).  In tex.c are examples of implementing these 
   functions for doing turbulent textures.  In fil.c is an example of
   how to use the noise function to produce nice fractals.  In, I believe,
   int.c is shown how to use the wave sources to perturb the normal for
   reflection purposes.  Also included are how to randomly perturb it for
   pebbling and fuzziness.  DBW is by far the most advanced in implementing
   all of these textures of any publically available ray-tracer.
   ---Prem Subrahmanyam

jonb@vector.Dallas.TX.US (Jon Buller) (09/15/89)

I still have my code, and it is still in pascal (I unfortunately do NOT
have a C compiler for my Mac, or hard disk to put it on...), but if
everybody wants it again, I'll post it.  If you will kindly note the
.sig or return path, you will find that I have gotten my degree from
Colo. State and have moved to Dallas in pursuit of the task of putting
food on my table.  I saw my code translated to C and archived at uunet.uu.net
if the requesting persons desire it there.  I do not belive that the
turb() function was translated, but it is a simple hack.
     turb(x) = noise(x) + noise(2*x)/2 + noise(4*x)/4 ...) do this until
     noise is small enough to make a change for a single pixel.  i.e.
     calling turb on a region from 1 to 10: call noise up to *8/8 or so
     (you might want to go to *16/16 to be sure of everything)
I wrote a routine that generated a complete planet image (water, land, and
clouds) with a call to turb for choosing land or water, and another call
to add clouds. Then all you need is a sphere to apply the texture to
(I have been tempted to apply that texture to a cube for fun, maybe in
a few days...)

In any case, enjoy...

Jon

-- 
--------------------------------------------------------------------------
Jon Buller          texbell!vector!jonb          jonb@vector.dallas.tx.us
FROM lawyers IMPORT Disclaimer;                 FROM fortune IMPORT Quote;

hutch@fps.com (Jim Hutchison) (09/16/89)

In article <QZ3Y6tm00WB_01TGQw@andrew.cmu.edu> po0o+@andrew.cmu.edu (Paul Andrew Olbrich) writes:
>Could someone please post an example of a turbulence function, or
>provide pointers to one?

x,y,z in [0,1]

simple ones:
    f(x,y,z) = x^2 + y^2 + z^2
    f(x,y,z) = sin(x * 100 * pi) + sin(y * 100 * pi) + sin(z * 100 * pi)

or did you mean a turbulence function in terms of a function which is
"random" in its output, but for values spatially close together yield
outputs which are "near" to each other?

/*    Jim Hutchison   		{dcdwest,ucbvax}!ucsd!celerity!hutch  */
/*    Disclaimer:  I am not an official spokesman for FPS computing   */

po0o+@andrew.cmu.edu (Paul Andrew Olbrich) (09/18/89)

Jim Hutchinson writes:

>  or did you mean a turbulence function in terms of a function which is
>  random in its output, but for values spatially close together yield
>  outputs which are "neat" to each other?

Yes ... Like the wood or marble patterns.  I've received several replies
about those already, however, and I'm busy digesting them.  Thank you
for your input, though!

Drew Olbrich
po0o+@andrew.cmu.edu

"You cannot depend on your mind when your imagination is out of focus"
-- Mark Twain