POV-Ray : Newsgroups : povray.general : random problem Server Time
2 Nov 2024 03:15:02 EDT (-0400)
  random problem (Message 1 to 6 of 6)  
From: ingo
Subject: random problem
Date: 17 May 1999 16:56:20
Message: <37407464.0@news.povray.org>
While making some pieces of wood with different colours, using random, I ran
into a problem.
Run the scene below.
The first number from the random stream ia always 0.118 .
Now comment out "#declare XX = ....." , "#debug concat(....." and in the the
first pigment replace XX by "Rmm(0.1,0.5,Sd)".
Run the scene again.

Why are the colours different?


ingo

--
Met dank aan de muze met het glazen oog.

#version 3.1; global_settings {assumed_gamma 1.0}
light_source {<500, 500,-500> rgb 1}
camera {location<0, 1.6, -5.0> look_at<0,0,0>}

#declare Sd=seed(7)

#macro Rmm(Min,Max,Stream)
   Max+((Min-Max)*rand(Stream))
#end //macro

#declare XX= Rmm(0.1,0.5,Sd)
#debug concat("\n XX= ",str(XX,3,3))

#declare Wood= texture {
   pigment {rgb <0.50,0.10,0.08>*XX}
}
texture {
   pigment {
      wood
      scale 0.05
      color_map {
         [0,rgbf <0.5,0.4,0.4,0.2>*0.5]
         [1,rgbf <0.5,0.4,0.4,0.7>*0.5]
      }
   }
}
box {-1,1 texture {Wood}}


Post a reply to this message

From: Nathan Kopp
Subject: Re: random problem
Date: 18 May 1999 00:20:49
Message: <3740DC55.26A3866B@Kopp.com>
Macros work via text substitution.  Rmm is not really a function returning
a number.

Right now, this:
    pigment {rgb <0.50,0.10,0.08>*Rmm(Min,Max,Stream)}

becomes:
    pigment {rgb <0.50,0.10,0.08>*Max+((Min-Max)*rand(Stream))}

So, you need to put parentheses in the macro.  Change it to look like
this:

#macro Rmm(Min,Max,Stream)
   (Max+((Min-Max)*rand(Stream)))
#end //macro


-Nathan

ingo wrote:
> 
> While making some pieces of wood with different colours, using random, I ran
> into a problem.
> Run the scene below.
> The first number from the random stream ia always 0.118 .
> Now comment out "#declare XX = ....." , "#debug concat(....." and in the the
> first pigment replace XX by "Rmm(0.1,0.5,Sd)".
> Run the scene again.
> 
> Why are the colours different?
> 
> ingo
> 
> --
> Met dank aan de muze met het glazen oog.
> 
> #version 3.1; global_settings {assumed_gamma 1.0}
> light_source {<500, 500,-500> rgb 1}
> camera {location<0, 1.6, -5.0> look_at<0,0,0>}
> 
> #declare Sd=seed(7)
> 
> #macro Rmm(Min,Max,Stream)
>    Max+((Min-Max)*rand(Stream))
> #end //macro
> 
> #declare XX= Rmm(0.1,0.5,Sd)
> #debug concat("\n XX= ",str(XX,3,3))
> 
> #declare Wood= texture {
>    pigment {rgb <0.50,0.10,0.08>*XX}
> }
> texture {
>    pigment {
>       wood
>       scale 0.05
>       color_map {
>          [0,rgbf <0.5,0.4,0.4,0.2>*0.5]
>          [1,rgbf <0.5,0.4,0.4,0.7>*0.5]
>       }
>    }
> }
> box {-1,1 texture {Wood}}


Post a reply to this message

From: Bill DeWitt
Subject: Re: random problem
Date: 18 May 1999 00:29:52
Message: <3740deb0.0@news.povray.org>
Nathan Kopp <Nat### [at] Koppcom> wrote in message
news:3740DC55.26A3866B@Kopp.com...
> Macros work via text substitution.  Rmm is not really a function returning
> a number.


    POVRay documentation says differently, see: "Returning a value from a
macro" or some such. I'm too groggy to think about his macro but it can be
made to act like a value in the pigment.


> Right now, this:
>     pigment {rgb <0.50,0.10,0.08>*Rmm(Min,Max,Stream)}
>
> becomes:
>     pigment {rgb <0.50,0.10,0.08>*Max+((Min-Max)*rand(Stream))}
>
> So, you need to put parentheses in the macro.  Change it to look like
> this:
>
> #macro Rmm(Min,Max,Stream)
>    (Max+((Min-Max)*rand(Stream)))
> #end file://macro
>
>
> -Nathan
>
> ingo wrote:
> >
> > While making some pieces of wood with different colours, using random, I
ran
> > into a problem.
> > Run the scene below.
> > The first number from the random stream ia always 0.118 .
> > Now comment out "#declare XX = ....." , "#debug concat(....." and in the
the
> > first pigment replace XX by "Rmm(0.1,0.5,Sd)".
> > Run the scene again.
> >
> > Why are the colours different?
> >
> > ingo
> >
> > --
> > Met dank aan de muze met het glazen oog.
> >
> > #version 3.1; global_settings {assumed_gamma 1.0}
> > light_source {<500, 500,-500> rgb 1}
> > camera {location<0, 1.6, -5.0> look_at<0,0,0>}
> >
> > #declare Sd=seed(7)
> >
> > #macro Rmm(Min,Max,Stream)
> >    Max+((Min-Max)*rand(Stream))
> > #end file://macro
> >
> > #declare XX= Rmm(0.1,0.5,Sd)
> > #debug concat("\n XX= ",str(XX,3,3))
> >
> > #declare Wood= texture {
> >    pigment {rgb <0.50,0.10,0.08>*XX}
> > }
> > texture {
> >    pigment {
> >       wood
> >       scale 0.05
> >       color_map {
> >          [0,rgbf <0.5,0.4,0.4,0.2>*0.5]
> >          [1,rgbf <0.5,0.4,0.4,0.7>*0.5]
> >       }
> >    }
> > }
> > box {-1,1 texture {Wood}}


Post a reply to this message

From: ingo
Subject: Re: random problem
Date: 18 May 1999 04:32:57
Message: <374117a9.0@news.povray.org>
Ahh, I see, thanks,


ingo
--
Met dank aan de muze met het glazen oog.

Nathan Kopp heeft geschreven in bericht <3740DC55.26A3866B@Kopp.com>...
>Macros work via text substitution.  Rmm is not really a function returning
>a number.
>
>Right now, this:
>    pigment {rgb <0.50,0.10,0.08>*Rmm(Min,Max,Stream)}
>
>becomes:
>    pigment {rgb <0.50,0.10,0.08>*Max+((Min-Max)*rand(Stream))}
>
>So, you need to put parentheses in the macro.  Change it to look like
>this:
>
>#macro Rmm(Min,Max,Stream)
>   (Max+((Min-Max)*rand(Stream)))
>#end //macro
>
>
>-Nathan


Post a reply to this message

From: Nathan Kopp
Subject: Re: random problem
Date: 18 May 1999 19:20:27
Message: <3741E76C.5F723D9B@Kopp.com>
The section "Returning a Value Like a Function" talks about needing the
extra set of parentheses.

-Nathan

Bill DeWitt wrote:
> 
> Nathan Kopp <Nat### [at] Koppcom> wrote in message
> news:3740DC55.26A3866B@Kopp.com...
> > Macros work via text substitution.  Rmm is not really a function returning
> > a number.
> 
>     POVRay documentation says differently, see: "Returning a value from a
> macro" or some such. I'm too groggy to think about his macro but it can be
> made to act like a value in the pigment.
> 
> > Right now, this:
> >     pigment {rgb <0.50,0.10,0.08>*Rmm(Min,Max,Stream)}
> >
> > becomes:
> >     pigment {rgb <0.50,0.10,0.08>*Max+((Min-Max)*rand(Stream))}
> >
> > So, you need to put parentheses in the macro.  Change it to look like
> > this:
> >
> > #macro Rmm(Min,Max,Stream)
> >    (Max+((Min-Max)*rand(Stream)))
> > #end file://macro
> >
> >
> > -Nathan
> >
> > ingo wrote:
> > >
> > > While making some pieces of wood with different colours, using random, I
> ran
> > > into a problem.
> > > Run the scene below.
> > > The first number from the random stream ia always 0.118 .
> > > Now comment out "#declare XX = ....." , "#debug concat(....." and in the
> the
> > > first pigment replace XX by "Rmm(0.1,0.5,Sd)".
> > > Run the scene again.
> > >
> > > Why are the colours different?
> > >
> > > ingo
> > >
> > > --
> > > Met dank aan de muze met het glazen oog.
> > >
> > > #version 3.1; global_settings {assumed_gamma 1.0}
> > > light_source {<500, 500,-500> rgb 1}
> > > camera {location<0, 1.6, -5.0> look_at<0,0,0>}
> > >
> > > #declare Sd=seed(7)
> > >
> > > #macro Rmm(Min,Max,Stream)
> > >    Max+((Min-Max)*rand(Stream))
> > > #end file://macro
> > >
> > > #declare XX= Rmm(0.1,0.5,Sd)
> > > #debug concat("\n XX= ",str(XX,3,3))
> > >
> > > #declare Wood= texture {
> > >    pigment {rgb <0.50,0.10,0.08>*XX}
> > > }
> > > texture {
> > >    pigment {
> > >       wood
> > >       scale 0.05
> > >       color_map {
> > >          [0,rgbf <0.5,0.4,0.4,0.2>*0.5]
> > >          [1,rgbf <0.5,0.4,0.4,0.7>*0.5]
> > >       }
> > >    }
> > > }
> > > box {-1,1 texture {Wood}}


Post a reply to this message

From: Bill DeWitt
Subject: Re: random problem
Date: 19 May 1999 00:37:00
Message: <374231dc.0@news.povray.org>
You are right, after a nap I was able to see what you meant. Before the nap
all I could read was the part about text substitution, and I had just set up
some macros that returned a value via a variable.

I apologize for my brain dead assertions.

Nathan Kopp <Nat### [at] Koppcom> wrote in message
news:3741E76C.5F723D9B@Kopp.com...
> The section "Returning a Value Like a Function" talks about needing the
> extra set of parentheses.
>
> -Nathan
>
> Bill DeWitt wrote:
> >
> > Nathan Kopp <Nat### [at] Koppcom> wrote in message
> > news:3740DC55.26A3866B@Kopp.com...
> > > Macros work via text substitution.  Rmm is not really a function
returning
> > > a number.
> >
> >     POVRay documentation says differently, see: "Returning a value from
a
> > macro" or some such. I'm too groggy to think about his macro but it can
be
> > made to act like a value in the pigment.
>


Post a reply to this message

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