|
|
I've been tuning / reworking the pattern and function handling in povr.
Reference:
pattern / function work postings in the not web mirrored
povray.beta-test.binaries group.
http://news.povray.org/povray.beta-test.binaries/thread/%3C5e8a0353%241%40news.povray.org%3E/
The work of the past day or two I think generally useful to POV-Ray
official use - so posting here.
Performance stuff.
---------
Today, using the f_dents definition in functions.inc, we get:
#declare f_dents = function {pow(f_noise3d(x, y, z), 3)}
which as measured used as the pattern for a dents pigment is 26.7%
slower than using the dents pattern directly(a) and 3.3% slower than coding:
#declare f_dents = function {pattern {dents}}
and 7.7% slower than using a custom inbuilt f_dents which I've coded up
in povr.
Results stuff due function noise generator handling!
---------
If you work enough with functions and patterns, you'll eventually stub
your toe on the fact functions use only the scene setting for the noise
generator(b) and not any pattern specific ones. This can be really
confusing. In my povr I'm moving all inbuilt functions using noise
generators directly or not to forms which require a noise generator
parameter.
Today, with something like dents, we can be working up a dents based
pattern planning some eventual functional customization - fading the
center portion to 1.0 or whatever. We start with:
#declare Pigm00 = pigment {
dents // The render is quicker starting with the pattern dents.
// function { f_dents(x,y,z)*f_fade(x,y,z) }
noise_generator 3 // Get the scene's setting - or 2 in demo.
scale 1/6
}
In the attached dents_to_f_dents_patNoise3.png the dents / ng(3) is
shown on the left. The function { f_dents...} ng(3), but really (2) is
shown on the middle. And yeah, I think the difference "pattern" between
the two noise generators on the right might be a useful pattern itself...
Not all patterns were updated noise gen 1 to 2.
---------
Patterns like granite were adjusted on the change from noise generator
Skinner form 1 to 2 so they more or less look similar with both. The
dents and f_dents was not one of these and the form 1 version is quite
different.
Aside: I've not run across any pattern making 2 vs Perlin(3) pattern
commonality adjustments.
For many years I wrongly assumed pattern distributions were somewhat
normalized in the 0-1 range so 0-1 maps could more or less be reasonably
switched between patterns. It's not always so. Pattern distributions
differ quite a lot and understanding this is important when best using
them. Be aware of each pattern's value distribution.
To this end I've been thinking about additional pattern related
documentation; The form it might take. See attached
dentsPatternDistDoc.png image for an idea on how this could be done. The
distribution show in green is the linear value distribution for the
dents pattern.
Bill P.
(a) - Mostly due the overhead of passing the function back into the
pattern mechanism. For maps use the inbuilt patterns if there is one
over any equivalent function.
(b) - Excepting there is an inbuilt f_noise_generator() function which
has a parameter which allows the noise generator to always be set. It's
indentical f_noise3d() except the latter - in official POV-Ray - always
uses the scene's noise generator setting.
Post a reply to this message
Attachments:
Download 'dentspatterndistdoc.png' (177 KB)
Download 'dents_to_f_dents_patnoise3.png' (120 KB)
Preview of image 'dentspatterndistdoc.png'
Preview of image 'dents_to_f_dents_patnoise3.png'
|
|