POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. New inbuilt f_agate(). : Function / pattern issues. New inbuilt f_agate(). Server Time
29 Apr 2024 12:32:02 EDT (-0400)
  Function / pattern issues. New inbuilt f_agate().  
From: William F Pokorny
Date: 7 May 2020 21:45:42
Message: <5eb4b9c6$1@news.povray.org>
<---------------------- References. Seven previous posts

http://news.povray.org/povray.beta-test.binaries/thread/%3C5ea57285%241%40news.povray.org%3E/

and

http://news.povray.org/povray.beta-test.binaries/thread/%3C5ead9027%40news.povray.org%3E/

Replacing the f_agate simple pattern{} wrap in functions.inc with a new 
inbuilt f_agate which brings out the x,y,z directions and power exponent 
as parameters in addition to parameters for the turbulence call's 
octaves, omega and lambda.

Parameters: x, y, z
7 extra parameter required:
---
1. 0,1 or 2 for x, y or z agate alignment. Pattern's agate always uses z 
(2).

2. Turbulence multiplier. Called agate_turb in the pattern version. (1.0).

3. Power exponent for pow(). Hard coded to 0.77 in the pattern version. 
(0.77)

4. Number of octaves for the turbulence call. Pattern version defaults 
to (6).

5. Omega value for the turbulence call. Pattern version defaults to 0.5.

6. Lambda value for the turbulence call. Pattern version defaults to 2.0.

7. The noise generator to use. Valid values 1-3. Pattern agate uses 
pattern or global setting.

Notes. To match the default pattern agate: 
f_agate(x,y,z,2,1.0,0.77,6,0.5,2.0,2)  <-- Matches pattern agate when 
everything defaulted.  With the pattern agate octaves, omega and lambda 
can be set with those bare keywords immediately after agate changing 
agate's inbuilt turbulence.

For the bottom of the attached image creating an isosurface using both 
the non-preferred directions looks like:

#declare Iso99 = isosurface {
     function { y+f_agate(x*2,y*2,z*2,0,0.08,0.20,6,0.5,2.0,2)*0.135
                 +f_agate(x*2,y*2,z*2,2,0.08,0.20,6,0.5,2.0,2)*0.135
     }
...

On the top of the image subtracted both f_agate()s at multiplier of 0.035.

In a surprise, I expected f_agate() to be a little slower than the 
inbuilt used as a pattern in a pigment, for example. It's running about 
16% faster for reasons not currently understood. This the first pattern 
where - other than f_dents which is cheap - the inbuilt function 
implementation can match the pattern one exactly. (My f_granite23 
inbuilt doesn't match granite.) A mystery for another day.

Bill P.


Post a reply to this message


Attachments:
Download 'story_f_agate.jpg' (285 KB)

Preview of image 'story_f_agate.jpg'
story_f_agate.jpg


 

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