POV-Ray : Newsgroups : povray.general : Help with noise3d? Server Time
10 Aug 2024 13:21:54 EDT (-0400)
  Help with noise3d? (Message 1 to 4 of 4)  
From: Xplo Eristotle
Subject: Help with noise3d?
Date: 8 Jan 2000 07:05:44
Message: <387728C6.AA0BF2CE@unforgettable.com>
As some of you surely know, the existing documentation on isosurfaces is
rather minimal, and there aren't too many tutorials out there. I'm
wondering if anyone can explain the use of the noise3d function (I may
have missed an underscore, whatever, you know what I'm talking about)? I
looked at the demos, but they're a bit arcane (not to mention split up
into a zillion macros and #declares and gods-know-what), and I don't
care to try to discern a working syntax by trial and error... >_<;

-- 
Xplo Eristotle
http://start.at/xplosion/

"Error has no rights." - Tomas de Torquemada


Post a reply to this message

From: Reinhard Rettelbach
Subject: Re: Help with noise3d?
Date: 8 Jan 2000 09:19:39
Message: <3877471F.B7A150CA@t-online.de>
Xplo Eristotle schrieb:
> 
>:::::::, and I don't
> care to try to discern a working syntax by trial and error... >_<;
>
 
hi,
seems this can be subsumed to FAQ list meanwhile. ;-)
a working syntax for first trials will be something like follows:

//pov code

#declare SPHERE = function{x^2+y^2+z^2-1}          //a basic shape

isosurface{
	function{SPHERE(x,y,z)+0.2*noise3d(3*x, 3*y, 3*z)}  
	threshold 0.5
	accuracy 0.001
	eval method 1
	pigment{...}
	}

//end of example

now play around with the multiplicators in your noise3d function:
raising the values will yield smalles structures and vice versa.
replace e.g. 3*y by a constant, like 1; or another function like
sin(10*y) and watch, what will happen. btw: the multiplicator (0.2 in my
example) for noise function determines, how much noise you apply to your
basic function (best to be compared with bump_size value in the normal{}
statement.)
Now apply noise function not to the sphere as a whole but eg. to the
y-component selectively:
...function{SPHERE(x, (y-0.2*noise3d(3*x, 3*y, 3*z)), z)
and again watch, what will happen...
play around further, and again... have fun


ReVerSi


Post a reply to this message

From: Mike Williams
Subject: Re: Help with noise3d?
Date: 8 Jan 2000 13:00:52
Message: <WcTS4FAzr3d4Ewj$@econym.demon.co.uk>
Wasn't it Xplo Eristotle who wrote:

>As some of you surely know, the existing documentation on isosurfaces is
>rather minimal, and there aren't too many tutorials out there. I'm
>wondering if anyone can explain the use of the noise3d function (I may
>have missed an underscore, whatever, you know what I'm talking about)? I
>looked at the demos, but they're a bit arcane (not to mention split up
>into a zillion macros and #declares and gods-know-what), and I don't
>care to try to discern a working syntax by trial and error... >_<;

I tend to think of noise3d as being rather like a pigment function, but
with a different syntax. 

A pattern, such as "bozo", fills 3d space with numerical values. When you
use bozo as a pigment, this value is evaluated at each point of the
surface, and the result is used to determine the actual colour of that
point. It's as if the bozo pigment actually exists at all points in 3d
space, but you only see it when the surface of your object intersects it.

When you use bozo as a function for an isosurface the numerical value is
used to calculate where the surface is. If you use the bozo pigment on
its own, as an isosurface, you won't see anything. That's because the
numerical value of bozo is greater than zero (almost) everywhere. You can
make it visible by setting the threshold to a number between 0 and 1,
e.g.


#declare Bozo = function{pigment{bozo
                   colour_map {[0 rgb 1][1 rgb 0]}
                   scale <0.5,0.5,0.5>}
                }

isosurface {
  function{Bozo(x,y,z)}
  eval         
  threshold 0.3
  accuracy 0.01
  bounded_by{sphere{0,1}}
  pigment{rgb 0.8}
  }


However, that's not very useful on its own. It's more useful to add the
pigment function to some other function that's more structural, so that
the pigment function acts as a surface modifier rather than a surface in
its own right.

In the above example, I used "scale <0.5,0.5,0.5>" on the pigment, but I
could have omitted that and used "function{Bozo(x*2,y*2,z*2)}" instead.
That would have given identical results.


Now, having discussed pigment functions, I consider noise3d to behave
rather like such a function. The main differences are:-

  Noise3d starts life as a function. It is possible to use it as a   
  pigment, in which case it looks rather like spotted or bozo:-
     
      sphere {<0,0,0>,1 pigment{function{noise3d(x*2,y*2,z*2)}}}

  The numerical value of noise3d does have zones that evaluate to zero.   
  This means that it is visible when used alone with threshold 0.

Note that multiplication factors in a function work like the inverse of a
pigment scale. So if you would scale a pigment by "scale <A,B,C>" you
would achieve a similar effect on a function like "noise3d(x/A,y/B,z/C)".

Using "noise3d(x-1,y,z)" is equivalent to performing "translate <1,0,0>"
on a pigment function.

Here's an example that compares a bozo pigment function to noise3d.
The top row uses a bozo pigment function that's scaled at the pigment
stage. The middle row uses a fixed bozo pigment, but scales it at the
function stage, The third row uses noise3d.

camera { location  <0, 0, -8> look_at <0, 0, 0>}

background {rgb  <0,0,1>}

light_source {<-100,200,-100> colour rgb 1}

// ----------------------------------------

                       
#declare Bozo  = pigment {bozo
                   colour_map {[0 rgb 1][1 rgb 0]}}
#declare FBozo = function{pigment {Bozo}}                                          
#declare Sphere  = function{"Sphere" <1>}

#declare M = 1;
#while (M < 10) 

  #declare MBozo = function{pigment {Bozo scale 1/M}}

  isosurface {
    function{Sphere(x,y,z)+MBozo(x,y,z)*0.3}
    eval         
    accuracy 0.01
    bounded_by{sphere{0,1}}
    pigment{rgb 0.8}
    translate <-5+M, 2, 0>
  }

  isosurface {
    function{Sphere(x,y,z)+FBozo(x*M,y*M,z*M)*0.3}
    eval         
    accuracy 0.01
    bounded_by{sphere{0,1}}
    pigment{rgb 0.8}
    translate <-5+M, 0, 0>
  }
  
  isosurface {
    function{Sphere(x,y,z)+noise3d(x*M,y*M,z*M)*0.3}
    eval         
    accuracy 0.01
    bounded_by{sphere{0,1}}
    pigment{rgb 0.8}
    translate <-5+M, -2, 0>
  }

  #declare M=M+2;
#end


-- 
Mike Williams + #
Gentleman of Leisure


Post a reply to this message

From: Xplo Eristotle
Subject: Re: Help with noise3d?
Date: 8 Jan 2000 21:13:34
Message: <3877EF7F.270394F6@unforgettable.com>
Reinhard Rettelbach wrote:
> 
> Xplo Eristotle schrieb:
> >
> >:::::::, and I don't
> > care to try to discern a working syntax by trial and error... >_<;
> >
> 
> hi,
> seems this can be subsumed to FAQ list meanwhile. ;-)
> a working syntax for first trials will be something like follows:

<snip>

Right-o.. thanks, guys. I'll play around with it a bit now.

-- 
Xplo Eristotle
http://start.at/xplosion/

"Error has no rights." - Tomas de Torquemada


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.