POV-Ray : Newsgroups : povray.binaries.images : Media trees : Re: Media trees Server Time
20 Apr 2024 06:52:21 EDT (-0400)
  Re: Media trees  
From: Kenneth
Date: 15 Dec 2021 05:05:00
Message: <web.61b9ba19400fcdc54cef624e6e066e29@news.povray.org>
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

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  ;-)


Post a reply to this message

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