

On 10/15/23 01:55, And wrote:
> What is the concept about f_hash()?
Sorry, I forget I'm playing way off in the weeds!
A newsgroup thread on f_hash() can be found here:
http://news.povray.org/povray.pov4.discussion.general/thread/%3C6117bc50%241%40news.povray.org%3E/
It's basically a much more general 'cells' like capability for creating
regions with discrete, constant values.

A problem I have, is that once I get an idea sort of working, I always
doubt whether it's worthwhile enough to endure the pain of complete
implementations! :) What I'm posting on here isn't in a final feature
form.
The basic idea I'm playing with here, coded as SDL in the povr fork, is
below. If I do adopt it as full scalar value pattern and/or a normal
perturbation method, all of it would be hard coded internally in C++ to
speed it up.
// This f_hash() bit creates a bunch of partitioned value regions
#declare Step = e*0.011; // e*0.015
#declare Fn00 = function {
f_hash(
f_hash(
f_hash(x,now,Step,0)+
f_hash(y,now+1,Step,0)+
f_hash(z,now+2,Step,0),
now+3,Step,0) +
f_hash(
f_hash(f_gradient(x,y,z,1,1,0),now+4,Step*1.414,0)+
f_hash(f_gradient(x,y,z,1,0,1),now+5,Step*1.414,0)+
f_hash(f_gradient(x,y,z,0,1,1),now+6,Step*1.414,0),
now+7,Step,0) +
f_hash(
f_hash(f_gradient(x,y,z,+1,+1,+1),now+8,Step*tau,0)+
f_hash(f_gradient(x,y,z,1,+1,+1),now+9,Step*pi,0)+
f_hash(f_gradient(x,y,z,+1,1,1),now1,Step*tau,0)+
f_hash(f_gradient(x,y,z,+1,+1,1),now2,Step*pi,0)
,now3,Step,0),
now4,0,1)
}
#declare TmpVal = pow(2,52);
// The bit below is doing a dot product of two sets(vectors) of
// 64 bits, where each bit represents 1 or 1. Why? It's a way to
// create values in a 64 to 63 integer range which conform to an
// approximate normal distribution. For something with crystal
// like facets, I don't want many final values for the normal
// perturbation vectors.
// Aside: The approach for this very fast dot product has seen
// renewed use in neural network programming. I suppose this due
// many recent, mainstream, processors adding a built in popcnt
// opcode. (I know very little about neural networks)
#declare Fn01 = function {
f_64x_ui1_popcnt(
f_64x_ui1_xor(
f_64x_ui1_fltto(Fn00(x,y,z)*TmpVal),
f_64x_ui1_ror(
f_64x_ui1_fltto(Fn00(z,y,x)*TmpVal),32,0),
1
)
)
}
#declare Fn02 = function {
2.0*Fn01(x,y,z)  64.0
}
sphere { 0, 0.7
pigment { rgb 1 }
normal {
function { Fn02(x,y,z)/63.0 }
bump_size 1 accuracy 0.0777
}
finish {
brilliance 7.0 reflection { 0.01, 0.3 fresnel}
}
interior { ior 2.5 }
}
#declare RangoonGreen = srgb <0.1098,0.11765,0.07451>;
plane { y, 1.1
pigment { RangoonGreen }
normal {
function { Fn02(x/2,y/2,z/2)/63.0 }
bump_size 1/3 accuracy 0.1777
}
finish {
brilliance 3.5 reflection { 0.01, 0.1 fresnel}
}
interior { ior 1.5 }
}
//
Attaching a couple more test images images.
Bill P.
Post a reply to this message
Attachments:
Download 'facetplay2.jpg' (182 KB)
Preview of image 'facetplay2.jpg'

