POV-Ray : Newsgroups : povray.binaries.images : Media trees : Re: Media trees Server Time
24 Mar 2023 14:15:25 EDT (-0400)
  Re: Media trees  
From: Thomas de Groot
Date: 15 Dec 2021 08:33:18
Message: <61b9ee9e$1@news.povray.org>
Op 15-12-2021 om 11:00 schreef Kenneth:
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> Thanks Paolo. I am not entirely done, I think. But yes, there is much
>> room for experiments indeed.
> That is clever and effective. I have always been interested in the possibilities
> of using 'solid' (or semi-solid) media for creating interesting shapes.
> Currently, I'm working on using POV-Ray's 'object' pattern and filling that with
> media, along with applying an image_map for the media's colors. The code is
> complex and uses functions, which is why I haven't posted about it yet; it needs
> some detailed comments added, to explain how it works.
> Anyway...
> Examining your code, it looks like there are two different color schemes for the
> trees, in  #macro Tree(rd_)...
>    #local R1 = rd_;
>    #local R2 = RRand(0.0, 1.0, R1);
>    #if (R1 < 0.2) // yellowish-green
>       #local C_Media = <RRand(180, 200, R1), RRand(180, 200, R1), 90>/255;
>    #else // blue-ish
>      #local C_Media = <RRand(50, 100, R1), RRand(155, 200, R1), 87>/255;
>    #end
> ...... but when the macro is actually called later in the 'woods' #while loop to
> create the many trees, it's like this (in two places):
>         Tree(0)  // zero
yeah... there are still a couple of bugs in the code which I have not 
yet squashed under my heels. Left overs from Gilles, wild mindless 
changes by me, lack of dried frog pills, you name them.

> If I understand the code correctly, that imposes the same 'initial'
> yellowish-green color on *all* the trees-- because 0.0 is always less than
>           #if (R1 < 0.2)
> in the macro. To get a good distribution of the TWO colors, I used
>           Tree(rand(rd))
> for both of the macro calls in 'woods'. Or maybe some version of RRand(...)
> would work better.
> ----------
> [Somewhat off-topic):
> I am also curious about RRand(...) itself, and how it is used here. If rd_ (i.e.
> R1) in the 'Tree' macro *is* 0.0, than that is used as the random-number stream
> for RRand(...). I didn't know that 0.0 could be successfully used for that-- or
> even for seed(0). I have always used at least 1. But zero does work!
> I guess I need to take a look at 'math.inc', to see how RRand() is actually
> constructed. And to re-read the docs concerning seed() and rand() too  ;-)
I love RRand! you have a fine control over the range within which you 
want your random number to be. For me, who suffers from some mild 
dyscalculia, things remain much clearer. :-/


Post a reply to this message

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